Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. diff -r 3e4ce5ec50fd lua/userver/controller.lua
  2. --- a/lua/userver/controller.lua Tue Jun 13 11:23:19 2017 +0300
  3. +++ b/lua/userver/controller.lua Thu Jun 22 20:27:57 2017 +0300
  4. @@ -710,7 +710,14 @@
  5. local action = get_param('action')
  6. if action == 'start' then
  7. local file_name
  8. - if get_param('leaf') == '1' then
  9. + local PROFILER_MODES = {
  10. + ["default"] = "default",
  11. + ["leaf"] = "leaf",
  12. + ["callgraph"] = "callgraph",
  13. + }
  14. + local mode = PROFILER_MODES[get_param('mode')] or error ("Wrong profiler mode");
  15. +
  16. + if not (mode == 'default') then
  17. file_name = userver.table.pindex(
  18. server_conf, 'lua', 'jit', 'profile', 'file_name')
  19. if not file_name then
  20. @@ -719,7 +726,7 @@
  21. end
  22.  
  23. local interval = tonumber(get_param('interval')) or 100 -- microseconds
  24. - local started = debug.profile.start(interval, file_name)
  25. + local started = debug.profile.start(interval, mode, file_name)
  26.  
  27. response.content = started and 'OK' or 'Already started'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement