erlang各种有用的函数包括一些有用nif封装,还有一些性能测试case。
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

21 lignes
671 B

il y a 5 ans
il y a 2 ans
il y a 5 ans
  1. -ifdef(OTP_RELEASE). %% this implies 21 or higher
  2. -define(EXCEPTION(Class, Reason, Stacktrace), Class:Reason:Stacktrace).
  3. -define(GET_STACK(Stacktrace), Stacktrace).
  4. -else.
  5. -define(EXCEPTION(Class, Reason, _), Class:Reason).
  6. -define(GET_STACK(_), erlang:get_stacktrace()).
  7. -endif.
  8. -define(GSS(Stacktrace), try throw(0) catch _:_:Stacktrace -> Stacktrace end).
  9. %% 追溯打印函数调用流程
  10. -define(PRINT_STACK(Tag),
  11. Stack =
  12. try
  13. throw(0)
  14. catch
  15. ?EXCEPTION(_Class, _Reason, Stacktrace) ->
  16. ?GET_STACK(Stacktrace)
  17. end,
  18. io:format("tarce tag:~p cur Stacktrace:", [Tag]),
  19. io:format(utParseStack:parseStack(Stack))
  20. ).