These new changes add sampling support to nanoscope. Currently supports two sampling mode:
perf_timer mode uses perf_event_open to generate sampling signals
cpu_timer mode uses timer_settime to generate sampling signals
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
Major changes
Sampling support
These new changes add sampling support to nanoscope. Currently supports two sampling mode:
perf_timer
mode usesperf_event_open
to generate sampling signalscpu_timer
mode usestimer_settime
to generate sampling signalsUsage
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 inperf_timer
modeadb shell setprop dev.nanoscope com.example:data.txt:cpu_timer
starts tracing with sampling incpu_timer
modeadb shell setprop dev.nanoscope com.example:data.txt
starts tracing without samplingDefault sampling interval is 1ms. In
perf_timer
sampling is based on wall clock time and incpu_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 anddata.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