uber / nanoscope-art

Apache License 2.0
49 stars 13 forks source link

Add Sampling to Nanoscope-art. #22

Closed Lun-Liu closed 6 years ago

Lun-Liu commented 6 years ago

Major changes

Sampling support

These new changes add sampling support to nanoscope. Currently supports two sampling mode:

Usage

Sampling only works on real device. For some of the devices, may need to change the kernel.perf_event_paranoid setting: adb shell "echo -1 >/proc/sys/kernel/perf_event_paranoid"

adb shell setprop dev.nanoscope com.example:data.txt:perf_timer starts tracing with sampling in perf_timer mode

adb shell setprop dev.nanoscope com.example:data.txt:cpu_timer starts tracing with sampling in cpu_timer mode

adb shell setprop dev.nanoscope com.example:data.txt starts tracing without sampling

Default sampling interval is 1ms. In perf_timer sampling is based on wall clock time and in cpu_timer sampling is based on cpu time.

Log files

In additional to data.ext file, we will also be generating two additional files: data.ext.timer which contains all sample data and data.ext.state which contains state transition trace. Those two files will be consumed by the new Nanoscope Visualizer. If sampling is not enabled, those two files will be empty.

data.ext.timer is organized in the following format: Each row represents a sample, each sample is in the format of: wall clock ts, cpu ts, # of major page faults, # of minor page faults, context switches, process memory usage (bytes), process memory usage (objects), memory ever allocated by traced thread (bytes), memory ever freed by traced thread

CLAassistant commented 6 years ago

CLA assistant check
All committers have signed the CLA.