• Leo Yan's avatar
    samples/bpf: Add program for CPU state statistics · c5350777
    Leo Yan authored
    CPU is active when have running tasks on it and CPUFreq governor can
    select different operating points (OPP) according to different workload;
    we use 'pstate' to present CPU state which have running tasks with one
    specific OPP.  On the other hand, CPU is idle which only idle task on
    it, CPUIdle governor can select one specific idle state to power off
    hardware logics; we use 'cstate' to present CPU idle state.
    
    Based on trace events 'cpu_idle' and 'cpu_frequency' we can accomplish
    the duration statistics for every state.  Every time when CPU enters
    into or exits from idle states, the trace event 'cpu_idle' is recorded;
    trace event 'cpu_frequency' records the event for CPU OPP changing, so
    it's easily to know how long time the CPU stays in the specified OPP,
    and the CPU must be not in any idle state.
    
    This patch is to utilize the mentioned trace events for pstate and
    cstate statistics.  To achieve more accurate profiling data, the program
    uses below sequence ...
    c5350777
Makefile 9.11 KB