luat_lib_profiler.c 728 B

123456789101112131415161718192021222324252627282930313233
  1. #include "luat_base.h"
  2. #include "luat_malloc.h"
  3. #include "luat_malloc.h"
  4. #include "luat_timer.h"
  5. static int l_profiler_start(lua_State *L) {
  6. luat_profiler_start();
  7. return 0;
  8. }
  9. static int l_profiler_stop(lua_State *L) {
  10. luat_profiler_stop();
  11. return 0;
  12. }
  13. static int l_profiler_print(lua_State *L) {
  14. luat_profiler_print();
  15. return 0;
  16. }
  17. #include "rotable2.h"
  18. static const rotable_Reg_t reg_profiler[] =
  19. {
  20. { "start" , ROREG_FUNC(l_profiler_start)},
  21. { "stop" , ROREG_FUNC(l_profiler_stop)},
  22. { "print", ROREG_FUNC(l_profiler_print)},
  23. { NULL, ROREG_INT(0)}
  24. };
  25. LUAMOD_API int luaopen_profiler( lua_State *L ) {
  26. luat_newlib2(L, reg_profiler);
  27. return 1;
  28. }