• Jin Yao's avatar
    perf diff: Support --time filter option · 4802138d
    Jin Yao authored
    To improve 'perf diff', implement a --time filter option to diff the
    samples within given time window.
    
    It supports time percent with multiple time ranges. The time string
    format is 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.
    
    For example:
    
    Select the second 10% time slice to diff:
    
      perf diff --time 10%/2
    
    Select from 0% to 10% time slice to diff:
    
      perf diff --time 0%-10%
    
    Select the first and the second 10% time slices to diff:
    
      perf diff --time 10%/1,10%/2
    
    Select from 0% to 10% and 30% to 40% slices to diff:
    
      perf diff --time 0%-10%,30%-40%
    
    It also supports analysing samples within a given time window
    <start>,<stop>.
    
    Times have the format seconds.microseconds.
    
    If 'start' is not given (i.e., time string is ',x.y') then analysis starts at
    the beginning of the file.
    
    If the stop time is not given (i.e, time string is 'x.y,') then analysis
    goes to end of file.
    
    Time string is 'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps for
    different perf.data files.
    
    For example, we get the timestamp information from perf script.
    
      perf script -i perf.data.old
    
        mgen 13940 [000]  3946.361400: ...
    
      perf script -i perf.data
    
        mgen 13940 [000]  3971.150589 ...
    
      perf diff --time 3946.361400,:3971.150589,
    
    It analyzes the perf.data.old from the timestamp 3946.361400 to the end of
    perf.data.old and analyzes the perf.data from the timestamp 3971.150589 to the
    end of perf.data.
    
     v4:
     ---
     Update abstime_str_dup(), let it return error if strdup
     is failed, and update __cmd_diff() accordingly.
    Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jin Yao <yao.jin@intel.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/1551791143-10334-2-git-send-email-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    4802138d
perf-diff.txt 7.89 KB