各种有用的erlang行为
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
438 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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).