Re: [PATCH] perf: add csv-style output to perf stat (v2)

From: Stephane Eranian
Date: Fri Dec 03 2010 - 11:46:43 EST


Arnaldo,

sorry for the delay. The upstream version works for me.
Thanks.


On Wed, Dec 1, 2010 at 7:54 PM, Arnaldo Carvalho de Melo
<acme@xxxxxxxxxxxxx> wrote:
> Em Wed, Dec 01, 2010 at 04:10:01PM -0200, Arnaldo Carvalho de Melo escreveu:
>> Em Wed, Dec 01, 2010 at 06:49:05PM +0200, Stephane Eranian escreveu:
>> > This patch adds an option (-x/--field-separator) to print counts using
>> > a CSV-style output. The user can pass a custom separator. This makes it
>> > very easy to import counts directly into your favorite spreadsheet without
>> > having to write scripts.
>>
>> [root@mica ~]# perf stat -x, Â-a -A -- sleep 1
>> -B option not supported with -x
>>
>> Âusage: perf stat [<options>] [<command>]
>>
>> Â Â -e, --event <event> Â event selector. use 'perf list' to list
>>
>> Guess we'll have to disable big_num automatically when -x is specified,
>> but at the same time notice if the user _explicitely_ asked for -B.
>>
>> I'll fix this now.
>
> Should be OK now, patch attached. Please check if it works as expected
> and then I'll push it to Ingo, thanks.
>
> [root@mica ~]# perf stat -x, -a -A -- sleep 1 2>&1 | head -5
> CPU0,998.225789,task-clock-msecs
> CPU1,998.385393,task-clock-msecs
> CPU2,998.370913,task-clock-msecs
> CPU3,998.356865,task-clock-msecs
> CPU0,2272,context-switches
> [root@mica ~]# perf stat -B -x, -a -A -- sleep 1 2>&1 | head -5
> -B option not supported with -x
>
> Âusage: perf stat [<options>] [<command>]
>
> Â Â-e, --event <event> Â event selector. use 'perf list' to list available events
> [root@mica ~]# perf stat -B -a -- sleep 1 2>&1 | head -10
>
> ÂPerformance counter stats for 'sleep 1':
>
>    3992.488962 task-clock-msecs     #   Â3.988 CPUs
>       9,082 context-switches     #   Â0.002 M/sec
>        Â15 CPU-migrations      #   Â0.000 M/sec
>        160 page-faults       Â#   Â0.000 M/sec
>    Â84,802,643 cycles          #   21.241 M/sec Â(scaled from 70.03%)
>    Â45,056,634 instructions       #   Â0.531 IPC  Â(scaled from 80.02%)
>     8,672,889 branches         #   Â2.172 M/sec Â(scaled from 80.01%)
> [root@mica ~]# perf stat -B -A -a -- sleep 1 2>&1 | head -10
>
> ÂPerformance counter stats for 'sleep 1':
>
> CPU0      Â998.135082 task-clock-msecs     #   Â0.997 CPUs
> CPU1      Â998.137405 task-clock-msecs     #   Â0.997 CPUs
> CPU2      Â998.144046 task-clock-msecs     #   Â0.997 CPUs
> CPU3      Â998.146202 task-clock-msecs     #   Â0.997 CPUs
> CPU0         2,280 context-switches     #   Â0.002 M/sec
> CPU1         2,282 context-switches     #   Â0.002 M/sec
> CPU2         2,244 context-switches     #   Â0.002 M/sec
> [root@mica ~]# perf stat --no-big-num -A -a -- sleep 1 2>&1 | head -10
>
> ÂPerformance counter stats for 'sleep 1':
>
> CPU0      Â998.125848 task-clock-msecs     #   Â0.997 CPUs
> CPU1      Â998.244633 task-clock-msecs     #   Â0.997 CPUs
> CPU2      Â998.337969 task-clock-msecs     #   Â0.997 CPUs
> CPU3      Â998.313756 task-clock-msecs     #   Â0.997 CPUs
> CPU0         Â2268 context-switches     #   Â0.002 M/sec
> CPU1         Â2218 context-switches     #   Â0.002 M/sec
> CPU2         Â2218 context-switches     #   Â0.002 M/sec
> [root@mica ~]#
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/