FluffOS v2019 正式版 lpc tracing 说明

FluffOS v2019 第一个正式版今天发布了,除了WEBSOCKET支持和UTF-8支持,还有一个重要的功能就是 lpc trace,新增了二个efun:trace_starttrace_end。驱动运行追踪使用方式如下:

Full driver tracing

trace driver from startup, this is suitable if you want an full trace of single run of the driver . This is the method currently used in testsuite.

Execute ./driver --tracing trace_driver.json <config> and driver will automatically collect all traces and save it on exit.

In driver tracing

in LPC , call trace_start("trace.json", 10); , this will have driver to collect trace for the next 10 seconds, If you need to end collection sooner, you can call trace_end() , otherwise driver will automatically stop collecting after timeout.

Analyze output

  1. Open chrome Devtools file
  2. Open as full window , Switch to “Performance" Tab , and load the trace json. file
  3. zoom in and figure out what is costing CPU! As you can see, The trace is color coded, The stack usually start at apply_low() , and the longer the span is, meaning the longer it costs to execute that function. You can zoom in and figure out what has been executing on CPU.


Tracing has performance cost, make sure you don’t run tracing for too long, otherwise driver will run out of memory.

For safety reason, tracing efun is restricted to at most 5 minutes and 1 million events .