各种有用的erlang行为
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

17 linhas
438 B

há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
há 4 anos
  1. -module(ping1).
  2. -compile([export_all, nowarn_export_all]).
  3. call(N) ->
  4. {ok, Pid} = pong1:start(),
  5. StartTime = erlang:system_time(nanosecond),
  6. doCall(N, Pid, StartTime).
  7. doCall(0, Pid, StartTime) ->
  8. EndTime = erlang:system_time(nanosecond),
  9. exit(Pid, kill),
  10. io:format("call1 over use time: ~p ns~n", [EndTime - StartTime]);
  11. doCall(N, Pid, StartTime) ->
  12. gen_server:call(Pid, ping),
  13. doCall(N - 1, Pid, StartTime).