• Namhyung Kim's avatar
    perf diff: Fix to sort by baseline field by default · e7024fc3
    Namhyung Kim authored
    The currently perf diff didn't add the baseline and delta (or other
    compute) fields to the sort list so output will be sorted by other
    fields like alphabetical order of DSO or symbol as below example.
    
    Fix it by adding hpp formats for the fields and provides default compare
    functions.
    
    Before:
    
      $ perf diff
      # Event 'cycles'
      #
      # Baseline    Delta  Shared Object       Symbol
      # ........  .......  ..................  ...............................
      #
                           [bridge]            [k] ip_sabotage_in
                           [btrfs]             [k] __etree_search.constprop.47
           0.01%           [btrfs]             [k] btrfs_file_mmap
           0.01%   -0.01%  [btrfs]             [k] btrfs_getattr
                           [e1000e]            [k] e1000_watchdog
           0.00%           [kernel.vmlinux]    [k] PageHuge
           0.00%           [kernel.vmlinux]    [k] __acct_update_integrals
           0.00%           [kernel.vmlinux]    [k] __activate_page
                           [kernel.vmlinux]    [k] __alloc_fd
           0.02%   +0.02%  [kernel.vmlinux]    [k] __alloc_pages_nodemask
           ...
    
    After:
    
      # Baseline    Delta  Shared Object       Symbol
      # ........  .......  ..................  ................................
      #
          24.73%   -4.62%  perf                [.] append_chain_children
           7.96%   -1.29%  perf                [.] dso__find_symbol
           6.97%   -2.07%  libc-2.20.so        [.] vfprintf
           4.61%   +0.88%  libc-2.20.so        [.] __fprintf_chk
           4.41%   +2.43%  perf                [.] sort__comm_cmp
           4.10%   -0.16%  perf                [.] comm__str
           4.03%   -0.93%  perf                [.] machine__findnew_thread_time
           3.82%   +3.09%  perf                [.] __hists__add_entry
           2.95%   -0.18%  perf                [.] sort__dso_cmp
           ...
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1419656793-32756-1-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e7024fc3
builtin-diff.c 27 KB