erlang各种有用的函数包括一些有用nif封装,还有一些性能测试case。
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

25 行
974 B

  1. %% 三目元算符
  2. -define(IIF(Cond, Then, That), case Cond of true -> Then; _ -> That end).
  3. %%汉字unicode编码范围 0x4e00 - 0x9fa5
  4. -define(UNICODE_CHINESE_BEGIN, (4 * 16 * 16 * 16 + 14 * 16 * 16)).
  5. -define(UNICODE_CHINESE_END, (9 * 16 * 16 * 16 + 15 * 16 * 16 + 10 * 16 + 5)).
  6. -define(PRINT(Format, Args),
  7. io:format(Format, Args)).
  8. %% format_record(record名, record数据) -> [{#record.field, record_field_value}]
  9. -define(recordToKvList(RecordName, RecordData),
  10. fun() ->
  11. Fields = record_info(fields, RecordName),
  12. [_ | Data] = tuple_to_list(RecordData),
  13. {RecordName, lists:zip(Fields, Data)}
  14. end()).
  15. -define(pdMemInfo, '$pdMemInfo').
  16. %% 运行时内存初始化宏
  17. -define(MII(), utVMInfo:memInfoInit(?MODULE, ?LINE)).
  18. %% 运行时内存默认打印函数
  19. -define(MIP(), utVMInfo:memInfoPrint(?MODULE, ?LINE, 100)).
  20. %% 运行时内存带阀值参数打印函数
  21. -define(MIP(Threshold), utVMInfo:memInfoPrint(?MODULE, ?LINE, Threshold)).