pLua 0.1 release, Lua performance analysis tools

further

Lua performance analysis tools

principle

Similar gperftools, by timer signal callbacks to view the call stack, calls to locate hot spots

characteristic

  • Simple, just a few lines of code, you can output the results
  • Accurate, compared lua Hook, sampling timing more accurately capture mode execution hot lua
  • Lightweight, because it is sampled, a row lua hook, can minimize the impact of running the host program directly comparable
  • Intuitive, call graph output can directly see the hot spots and call relations

use

Lua code

- introducing libplua.so 
local P = the require "libplua" 
- Sampling opening 
- Parameter 1: sampling time (in seconds), sampling has been represents 0 
- 2 parameters: the sampling result file 
p.start (0, "call.pro ") 

do_some_thing () 

- end of the sampling, the output file 
p.stop () 

- the result into the txt format 
p.text (" call.pro "," call.txt ") 
- the result converted into dot format available graphviz view 
p.dot ( "call.pro", "call.dot") 
- the result converted into svg format that can be viewed directly opens a browser 
p.svg ( "call.pro", "call.svg ")

Compile

  • Install lua 5.3
  • Install graphviz
  • Compile pLua
$ cmake .
$ make

Examples

Run lua test1.lua, lua test2.luaview svg result image[test1]

image [Test2]

Guess you like

Origin www.oschina.net/news/109807/plua-0-1-released