luat_lib_profiler.c 794 B

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