Skip to content

Instantly share code, notes, and snippets.

@thlorenz
Created August 16, 2014 18:07
Show Gist options
  • Save thlorenz/84bc76272aff3ab5851b to your computer and use it in GitHub Desktop.
Save thlorenz/84bc76272aff3ab5851b to your computer and use it in GitHub Desktop.
perf related one liners

perf list

pl-csv alias

Remove first 3 lines of perf list output and join the remaining ones together with ,

alias pl-csv='tail -n+3 | grep -v ^$ | awk '\''{print $1}'\'' | tr "\\n" "," | sed -e s/,$//'

Example:

➝  perf stat -e `perf list L1* | pl-csv` curl https://perf.wiki.kernel.org/index.php/Main_Page > /dev/null

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14138    0 14138    0     0  13289      0 --:--:--  0:00:01 --:--:-- 13300

 Performance counter stats for 'curl https://perf.wiki.kernel.org/index.php/Main_Page':

        15,095,849      L1-dcache-loads                                              [47.02%]
           465,219      L1-dcache-load-misses     #    3.08% of all L1-dcache hits   [48.99%]
         7,423,453      L1-dcache-stores                                             [43.50%]
            82,369      L1-dcache-store-misses                                       [53.22%]
           244,820      L1-dcache-prefetches                                         [51.73%]
            62,057      L1-dcache-prefetch-misses                                    [36.76%]
        26,752,656      L1-icache-loads                                              [47.44%]
           800,685      L1-icache-load-misses     #    2.99% of all L1-icache hits   [48.65%]

       1.073100167 seconds time elapsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment