The default event list includes the most common events which are widely
used by users. But with -e option, the current perf only counts the events
assigned by -e option. Users may want to collect some extra events with
the default list. For this case, users have to manually add all the events
from the default list. It's inconvenient. Also, users may don't know how to
get the default list.
Now it supports a simple syntax: -e +event
The prefix '+' tells perf to append this event (or event list) to default
event list.
Before:
root@kbl-ppc:~# ./perf stat -e power/energy-pkg/ -a -- sleep 1
Performance counter stats for 'system wide':
2.04 Joules power/energy-pkg/
1.000863884 seconds time elapsed
After:
root@kbl-ppc:~# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
Performance counter stats for 'system wide':
2.11 Joules +power/energy-pkg/ # 0.000 K/sec
8,007.17 msec cpu-clock # 7.993 CPUs utilized
125 context-switches # 0.016 K/sec
8 cpu-migrations # 0.001 K/sec
2 page-faults # 0.000 K/sec
8,520,084 cycles # 0.001 GHz
2,808,302 instructions # 0.33 insn per cycle
555,427 branches # 0.069 M/sec
59,005 branch-misses # 10.62% of all branches
1.001832003 seconds time elapsed
Signed-off-by: Jin Yao <[email protected]>
---
v2:
We just use a simple syntax: -e +event to append the -e event
to default list.
v1:
Create a new option '--add-default' to append -e event to
default list.
tools/perf/Documentation/perf-stat.txt | 1 +
tools/perf/builtin-stat.c | 3 ++-
tools/perf/util/evlist.c | 10 ++++++++++
tools/perf/util/evlist.h | 1 +
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
index 5d4a673d7621..f60af902b8e1 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -63,6 +63,7 @@ report::
Multiple PMU instances are typical for uncore PMUs, so the prefix
'uncore_' is also ignored when performing this match.
+ If the prefix '+' is used, the event is appended to default event list.
-i::
--no-inherit::
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8cc24967bc27..8400953473ef 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1763,7 +1763,8 @@ static int add_default_attributes(void)
free(str);
}
- if (!evsel_list->core.nr_entries) {
+ if (!evsel_list->core.nr_entries ||
+ evlist__append_default_list(evsel_list)) {
if (target__has_cpu(&target))
default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 05363a7247c4..fceef4e57964 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -2010,3 +2010,13 @@ struct evsel *evlist__find_evsel(struct evlist *evlist, int idx)
}
return NULL;
}
+
+bool evlist__append_default_list(struct evlist *evlist)
+{
+ struct evsel *first = evlist__first(evlist);
+
+ if (first->name && first->name[0] == '+')
+ return true;
+
+ return false;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 1aae75895dea..54592bd22bc2 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -353,4 +353,5 @@ int evlist__ctlfd_ack(struct evlist *evlist);
#define EVLIST_DISABLED_MSG "Events disabled\n"
struct evsel *evlist__find_evsel(struct evlist *evlist, int idx);
+bool evlist__append_default_list(struct evlist *evlist);
#endif /* __PERF_EVLIST_H */
--
2.17.1
On Mon, Jan 04, 2021 at 10:18:37AM +0800, Jin Yao wrote:
> The default event list includes the most common events which are widely
> used by users. But with -e option, the current perf only counts the events
> assigned by -e option. Users may want to collect some extra events with
> the default list. For this case, users have to manually add all the events
> from the default list. It's inconvenient. Also, users may don't know how to
> get the default list.
>
> Now it supports a simple syntax: -e +event
>
> The prefix '+' tells perf to append this event (or event list) to default
> event list.
>
> Before:
>
> root@kbl-ppc:~# ./perf stat -e power/energy-pkg/ -a -- sleep 1
>
> Performance counter stats for 'system wide':
>
> 2.04 Joules power/energy-pkg/
>
> 1.000863884 seconds time elapsed
>
> After:
>
> root@kbl-ppc:~# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>
> Performance counter stats for 'system wide':
>
> 2.11 Joules +power/energy-pkg/ # 0.000 K/sec
I dont think we should print the extra '+' prefix
jirka
> 8,007.17 msec cpu-clock # 7.993 CPUs utilized
> 125 context-switches # 0.016 K/sec
> 8 cpu-migrations # 0.001 K/sec
> 2 page-faults # 0.000 K/sec
> 8,520,084 cycles # 0.001 GHz
> 2,808,302 instructions # 0.33 insn per cycle
> 555,427 branches # 0.069 M/sec
> 59,005 branch-misses # 10.62% of all branches
>
> 1.001832003 seconds time elapsed
>
> Signed-off-by: Jin Yao <[email protected]>
Hi Jiri,
On 1/12/2021 6:08 PM, Jiri Olsa wrote:
> On Mon, Jan 04, 2021 at 10:18:37AM +0800, Jin Yao wrote:
>> The default event list includes the most common events which are widely
>> used by users. But with -e option, the current perf only counts the events
>> assigned by -e option. Users may want to collect some extra events with
>> the default list. For this case, users have to manually add all the events
>> from the default list. It's inconvenient. Also, users may don't know how to
>> get the default list.
>>
>> Now it supports a simple syntax: -e +event
>>
>> The prefix '+' tells perf to append this event (or event list) to default
>> event list.
>>
>> Before:
>>
>> root@kbl-ppc:~# ./perf stat -e power/energy-pkg/ -a -- sleep 1
>>
>> Performance counter stats for 'system wide':
>>
>> 2.04 Joules power/energy-pkg/
>>
>> 1.000863884 seconds time elapsed
>>
>> After:
>>
>> root@kbl-ppc:~# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>>
>> Performance counter stats for 'system wide':
>>
>> 2.11 Joules +power/energy-pkg/ # 0.000 K/sec
>
> I dont think we should print the extra '+' prefix
>
> jirka
>
>> 8,007.17 msec cpu-clock # 7.993 CPUs utilized
>> 125 context-switches # 0.016 K/sec
>> 8 cpu-migrations # 0.001 K/sec
>> 2 page-faults # 0.000 K/sec
>> 8,520,084 cycles # 0.001 GHz
>> 2,808,302 instructions # 0.33 insn per cycle
>> 555,427 branches # 0.069 M/sec
>> 59,005 branch-misses # 10.62% of all branches
>>
>> 1.001832003 seconds time elapsed
>>
>> Signed-off-by: Jin Yao <[email protected]>
>
Printing '+' prefix is the original behavior.
Without this patch,
root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
Performance counter stats for 'system wide':
2.02 Joules +power/energy-pkg/
1.000859434 seconds time elapsed
The '+' prefix is printed. So I finally decide not to remove the '+' prefix in order to keep
original behavior.
Thanks
Jin Yao
Em Wed, Jan 20, 2021 at 10:25:53PM +0100, Jiri Olsa escreveu:
> On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
> > root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
> > Performance counter stats for 'system wide':
> > 2.02 Joules +power/energy-pkg/
> > 1.000859434 seconds time elapsed
> > The '+' prefix is printed. So I finally decide not to remove the '+' prefix
> > in order to keep original behavior.
> hm, originaly there's no purpose for the '+', right?
> it seems it's more like bug then anything else
> you added function to the '+' to add default events to specified event,
> which I think is good idea, but I don't think we should display the
> extra '+' in output
The value would be to stress that that is an event added to the ones
without the + prefix, i.e. the default ones.
But by having the command line copied over and the added events at the
first lines we should have that abundantly clear.
Also we won't print removed events (using -), is that available already?
Nope:
[root@quaco ~]# perf stat -e -cycles sleep
event syntax error: '-cycles'
\___ parser error
Run 'perf list' for a list of valid events
Usage: perf stat [<options>] [<command>]
-e, --event <event> event selector. use 'perf list' to list available events
[root@quaco ~]#
Like with:
[root@quaco ~]# perf stat -d sleep 1
Performance counter stats for 'sleep 1':
0.80 msec task-clock # 0.001 CPUs utilized
1 context-switches # 0.001 M/sec
0 cpu-migrations # 0.000 K/sec
59 page-faults # 0.073 M/sec
2,215,522 cycles # 2.757 GHz (7.40%)
1,073,189 instructions # 0.48 insn per cycle (80.59%)
203,615 branches # 253.392 M/sec
8,309 branch-misses # 4.08% of all branches
245,866 L1-dcache-loads # 305.972 M/sec
14,024 L1-dcache-load-misses # 5.70% of all L1-dcache accesses (92.60%)
<not counted> LLC-loads (0.00%)
<not counted> LLC-load-misses (0.00%)
1.001887261 seconds time elapsed
0.000000000 seconds user
0.001413000 seconds sys
Some events weren't counted. Try disabling the NMI watchdog:
echo 0 > /proc/sys/kernel/nmi_watchdog
perf stat ...
echo 1 > /proc/sys/kernel/nmi_watchdog
[root@quaco ~]# perf stat -e -LLC* -d sleep 1
event syntax error: '-LLC*'
\___ parser error
Run 'perf list' for a list of valid events
Usage: perf stat [<options>] [<command>]
-e, --event <event> event selector. use 'perf list' to list available events
[root@quaco ~]#
- Arnaldo
Hi Jiri,
On 1/21/2021 5:25 AM, Jiri Olsa wrote:
> On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
>> Hi Jiri,
>>
>> On 1/12/2021 6:08 PM, Jiri Olsa wrote:
>>> On Mon, Jan 04, 2021 at 10:18:37AM +0800, Jin Yao wrote:
>>>> The default event list includes the most common events which are widely
>>>> used by users. But with -e option, the current perf only counts the events
>>>> assigned by -e option. Users may want to collect some extra events with
>>>> the default list. For this case, users have to manually add all the events
>>>> from the default list. It's inconvenient. Also, users may don't know how to
>>>> get the default list.
>>>>
>>>> Now it supports a simple syntax: -e +event
>>>>
>>>> The prefix '+' tells perf to append this event (or event list) to default
>>>> event list.
>>>>
>>>> Before:
>>>>
>>>> root@kbl-ppc:~# ./perf stat -e power/energy-pkg/ -a -- sleep 1
>>>>
>>>> Performance counter stats for 'system wide':
>>>>
>>>> 2.04 Joules power/energy-pkg/
>>>>
>>>> 1.000863884 seconds time elapsed
>>>>
>>>> After:
>>>>
>>>> root@kbl-ppc:~# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>>>>
>>>> Performance counter stats for 'system wide':
>>>>
>>>> 2.11 Joules +power/energy-pkg/ # 0.000 K/sec
>>>
>>> I dont think we should print the extra '+' prefix
>>>
>>> jirka
>>>
>>>> 8,007.17 msec cpu-clock # 7.993 CPUs utilized
>>>> 125 context-switches # 0.016 K/sec
>>>> 8 cpu-migrations # 0.001 K/sec
>>>> 2 page-faults # 0.000 K/sec
>>>> 8,520,084 cycles # 0.001 GHz
>>>> 2,808,302 instructions # 0.33 insn per cycle
>>>> 555,427 branches # 0.069 M/sec
>>>> 59,005 branch-misses # 10.62% of all branches
>>>>
>>>> 1.001832003 seconds time elapsed
>>>>
>>>> Signed-off-by: Jin Yao <[email protected]>
>>>
>>
>> Printing '+' prefix is the original behavior.
>>
>> Without this patch,
>>
>> root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>>
>> Performance counter stats for 'system wide':
>>
>> 2.02 Joules +power/energy-pkg/
>>
>> 1.000859434 seconds time elapsed
>>
>> The '+' prefix is printed. So I finally decide not to remove the '+' prefix
>> in order to keep original behavior.
>
> hm, originaly there's no purpose for the '+', right?
> it seems it's more like bug then anything else
>
Yes, I also don't understand what's the purpose for the '+'. Just a bug is possible.
> you added function to the '+' to add default events to specified event,
> which I think is good idea, but I don't think we should display the
> extra '+' in output
>
I'm OK to remove the extra '+' in output.
Thanks
Jin Yao
> thanks,
> jirka
>
Hi Arnaldo,
On 1/21/2021 8:03 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jan 20, 2021 at 10:25:53PM +0100, Jiri Olsa escreveu:
>> On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
>>> root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>
>>> Performance counter stats for 'system wide':
>
>>> 2.02 Joules +power/energy-pkg/
>
>>> 1.000859434 seconds time elapsed
>
>>> The '+' prefix is printed. So I finally decide not to remove the '+' prefix
>>> in order to keep original behavior.
>
>> hm, originaly there's no purpose for the '+', right?
>> it seems it's more like bug then anything else
>
>> you added function to the '+' to add default events to specified event,
>> which I think is good idea, but I don't think we should display the
>> extra '+' in output
>
> The value would be to stress that that is an event added to the ones
> without the + prefix, i.e. the default ones.
>
> But by having the command line copied over and the added events at the
> first lines we should have that abundantly clear.
>
> Also we won't print removed events (using -), is that available already?
>
Sorry, the '-' support is not available in this patch. Can I do the patch for '+' first and then do
a follow up patch for '-' at next step?
> Nope:
>
> [root@quaco ~]# perf stat -e -cycles sleep
> event syntax error: '-cycles'
> \___ parser error
> Run 'perf list' for a list of valid events
>
> Usage: perf stat [<options>] [<command>]
>
> -e, --event <event> event selector. use 'perf list' to list available events
> [root@quaco ~]#
>
> Like with:
>
> [root@quaco ~]# perf stat -d sleep 1
> > Performance counter stats for 'sleep 1':
>
> 0.80 msec task-clock # 0.001 CPUs utilized
> 1 context-switches # 0.001 M/sec
> 0 cpu-migrations # 0.000 K/sec
> 59 page-faults # 0.073 M/sec
> 2,215,522 cycles # 2.757 GHz (7.40%)
> 1,073,189 instructions # 0.48 insn per cycle (80.59%)
> 203,615 branches # 253.392 M/sec
> 8,309 branch-misses # 4.08% of all branches
> 245,866 L1-dcache-loads # 305.972 M/sec
> 14,024 L1-dcache-load-misses # 5.70% of all L1-dcache accesses (92.60%)
> <not counted> LLC-loads (0.00%)
> <not counted> LLC-load-misses (0.00%)
>
> 1.001887261 seconds time elapsed
>
> 0.000000000 seconds user
> 0.001413000 seconds sys
>
>
> Some events weren't counted. Try disabling the NMI watchdog:
> echo 0 > /proc/sys/kernel/nmi_watchdog
> perf stat ...
> echo 1 > /proc/sys/kernel/nmi_watchdog
> [root@quaco ~]# perf stat -e -LLC* -d sleep 1
> event syntax error: '-LLC*'
> \___ parser error
> Run 'perf list' for a list of valid events
>
> Usage: perf stat [<options>] [<command>]
>
> -e, --event <event> event selector. use 'perf list' to list available events
> [root@quaco ~]#
>
> - Arnaldo
>
So if we just want to append the default list, we only need to set detailed_run=1, then ideally
perf-stat will print the default list.
But for now, there are no task-clock, context-switches, cpu-migrations, page-faults, instructions,
branches and branch-misses displayed.
root@kbl-ppc:~# ./perf stat -e cycles -d -a -- sleep 1
Performance counter stats for 'system wide':
124,178,207 cycles (80.02%)
6,444,490 L1-dcache-loads (80.01%)
1,043,169 L1-dcache-load-misses # 16.19% of all L1-dcache accesses (80.02%)
564,474 LLC-loads (80.02%)
49,262 LLC-load-misses # 8.73% of all LL-cache accesses (79.92%)
1.001614947 seconds time elapsed
Do we still need the '+' prefix to add the specified event on top of default list? It looks current
syntax should already support that feature, but just need to fix some issues.
Thanks
Jin Yao
On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
> Hi Jiri,
>
> On 1/12/2021 6:08 PM, Jiri Olsa wrote:
> > On Mon, Jan 04, 2021 at 10:18:37AM +0800, Jin Yao wrote:
> > > The default event list includes the most common events which are widely
> > > used by users. But with -e option, the current perf only counts the events
> > > assigned by -e option. Users may want to collect some extra events with
> > > the default list. For this case, users have to manually add all the events
> > > from the default list. It's inconvenient. Also, users may don't know how to
> > > get the default list.
> > >
> > > Now it supports a simple syntax: -e +event
> > >
> > > The prefix '+' tells perf to append this event (or event list) to default
> > > event list.
> > >
> > > Before:
> > >
> > > root@kbl-ppc:~# ./perf stat -e power/energy-pkg/ -a -- sleep 1
> > >
> > > Performance counter stats for 'system wide':
> > >
> > > 2.04 Joules power/energy-pkg/
> > >
> > > 1.000863884 seconds time elapsed
> > >
> > > After:
> > >
> > > root@kbl-ppc:~# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
> > >
> > > Performance counter stats for 'system wide':
> > >
> > > 2.11 Joules +power/energy-pkg/ # 0.000 K/sec
> >
> > I dont think we should print the extra '+' prefix
> >
> > jirka
> >
> > > 8,007.17 msec cpu-clock # 7.993 CPUs utilized
> > > 125 context-switches # 0.016 K/sec
> > > 8 cpu-migrations # 0.001 K/sec
> > > 2 page-faults # 0.000 K/sec
> > > 8,520,084 cycles # 0.001 GHz
> > > 2,808,302 instructions # 0.33 insn per cycle
> > > 555,427 branches # 0.069 M/sec
> > > 59,005 branch-misses # 10.62% of all branches
> > >
> > > 1.001832003 seconds time elapsed
> > >
> > > Signed-off-by: Jin Yao <[email protected]>
> >
>
> Printing '+' prefix is the original behavior.
>
> Without this patch,
>
> root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
>
> Performance counter stats for 'system wide':
>
> 2.02 Joules +power/energy-pkg/
>
> 1.000859434 seconds time elapsed
>
> The '+' prefix is printed. So I finally decide not to remove the '+' prefix
> in order to keep original behavior.
hm, originaly there's no purpose for the '+', right?
it seems it's more like bug then anything else
you added function to the '+' to add default events to specified event,
which I think is good idea, but I don't think we should display the
extra '+' in output
thanks,
jirka
Em Thu, Jan 21, 2021 at 02:08:52PM +0800, Jin, Yao escreveu:
> Hi Arnaldo,
>
> On 1/21/2021 8:03 AM, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Jan 20, 2021 at 10:25:53PM +0100, Jiri Olsa escreveu:
> > > On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
> > > > root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
> >
> > > > Performance counter stats for 'system wide':
> >
> > > > 2.02 Joules +power/energy-pkg/
> >
> > > > 1.000859434 seconds time elapsed
> >
> > > > The '+' prefix is printed. So I finally decide not to remove the '+' prefix
> > > > in order to keep original behavior.
> > > hm, originaly there's no purpose for the '+', right?
> > > it seems it's more like bug then anything else
> > > you added function to the '+' to add default events to specified event,
> > > which I think is good idea, but I don't think we should display the
> > > extra '+' in output
> >
> > The value would be to stress that that is an event added to the ones
> > without the + prefix, i.e. the default ones.
> >
> > But by having the command line copied over and the added events at the
> > first lines we should have that abundantly clear.
> >
> > Also we won't print removed events (using -), is that available already?
> >
>
> Sorry, the '-' support is not available in this patch. Can I do the patch
> for '+' first and then do a follow up patch for '-' at next step?
Yeah, it can be done afterwards, to be symmetric.
> > Nope:
> >
> > [root@quaco ~]# perf stat -e -cycles sleep
> > event syntax error: '-cycles'
> > \___ parser error
> > Run 'perf list' for a list of valid events
> >
> > Usage: perf stat [<options>] [<command>]
> >
> > -e, --event <event> event selector. use 'perf list' to list available events
> So if we just want to append the default list, we only need to set
> detailed_run=1, then ideally perf-stat will print the default list.
> But for now, there are no task-clock, context-switches, cpu-migrations,
> page-faults, instructions, branches and branch-misses displayed.
> root@kbl-ppc:~# ./perf stat -e cycles -d -a -- sleep 1
>
> Performance counter stats for 'system wide':
>
> 124,178,207 cycles (80.02%)
> 6,444,490 L1-dcache-loads (80.01%)
> 1,043,169 L1-dcache-load-misses # 16.19% of all L1-dcache accesses (80.02%)
> 564,474 LLC-loads (80.02%)
> 49,262 LLC-load-misses # 8.73% of all LL-cache accesses (79.92%)
>
> 1.001614947 seconds time elapsed
>
> Do we still need the '+' prefix to add the specified event on top of default
> list? It looks current syntax should already support that feature, but just
> need to fix some issues.
I think we can do away with that '+' when showing the added events and
its counts.
- Arnaldo
Hi Arnaldo,
On 1/21/2021 9:02 PM, Arnaldo Carvalho de Melo wrote:
>> So if we just want to append the default list, we only need to set
>> detailed_run=1, then ideally perf-stat will print the default list.
>
>> But for now, there are no task-clock, context-switches, cpu-migrations,
>> page-faults, instructions, branches and branch-misses displayed.
>
>> root@kbl-ppc:~# ./perf stat -e cycles -d -a -- sleep 1
>>
>> Performance counter stats for 'system wide':
>>
>> 124,178,207 cycles (80.02%)
>> 6,444,490 L1-dcache-loads (80.01%)
>> 1,043,169 L1-dcache-load-misses # 16.19% of all L1-dcache accesses (80.02%)
>> 564,474 LLC-loads (80.02%)
>> 49,262 LLC-load-misses # 8.73% of all LL-cache accesses (79.92%)
>>
>> 1.001614947 seconds time elapsed
>>
>> Do we still need the '+' prefix to add the specified event on top of default
>> list? It looks current syntax should already support that feature, but just
>> need to fix some issues.
> I think we can do away with that '+' when showing the added events and
> its counts.
>
> - Arnaldo
Can you help to look at my v3 (I will post it soon)? It only has one line change but it can achieve
the goal. Another advantage is it can append the metrics to the default event list easily.
For example,
root@kbl-ppc:~# ./perf stat -M Page_Walks_Utilization -d -a -- sleep 1
Performance counter stats for 'system wide':
1,417,358 itlb_misses.walk_pending # 0.177 M/sec
# 0.05 Page_Walks_Utilization (30.44%)
1,145,481 dtlb_store_misses.walk_pending # 0.143 M/sec (30.85%)
126,098,937 cycles # 0.016 GHz (31.25%)
9,069,839 dtlb_load_misses.walk_pending # 1.132 M/sec (31.64%)
0 ept.walk_pending # 0.000 K/sec (31.61%)
8,009.41 msec cpu-clock # 7.994 CPUs utilized
300 context-switches # 0.037 K/sec
8 cpu-migrations # 0.001 K/sec
3 page-faults # 0.000 K/sec
124,456,362 cycles # 0.016 GHz (31.20%)
23,924,628 instructions # 0.19 insn per cycle (38.79%)
4,532,511 branches # 0.566 M/sec (38.39%)
650,797 branch-misses # 14.36% of all branches (38.00%)
6,332,823 L1-dcache-loads # 0.791 M/sec (37.95%)
1,056,199 L1-dcache-load-misses # 16.68% of all L1-dcache accesses (37.95%)
572,791 LLC-loads # 0.072 M/sec (30.36%)
52,025 LLC-load-misses # 9.08% of all LL-cache accesses (30.36%)
1.001966758 seconds time elapsed
It appends the metric 'Page_Walks_Utilization' to the default event list.
Anyway, if you think it's not a good solution, I'd like to change it. :)
Thanks
Jin Yao
On Thu, Jan 21, 2021 at 10:02:25AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jan 21, 2021 at 02:08:52PM +0800, Jin, Yao escreveu:
> > Hi Arnaldo,
> >
> > On 1/21/2021 8:03 AM, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Jan 20, 2021 at 10:25:53PM +0100, Jiri Olsa escreveu:
> > > > On Mon, Jan 18, 2021 at 12:54:37PM +0800, Jin, Yao wrote:
> > > > > root@kbl-ppc:# ./perf stat -e +power/energy-pkg/ -a -- sleep 1
> > >
> > > > > Performance counter stats for 'system wide':
> > >
> > > > > 2.02 Joules +power/energy-pkg/
> > >
> > > > > 1.000859434 seconds time elapsed
> > >
> > > > > The '+' prefix is printed. So I finally decide not to remove the '+' prefix
> > > > > in order to keep original behavior.
> > > > hm, originaly there's no purpose for the '+', right?
> > > > it seems it's more like bug then anything else
> > > > you added function to the '+' to add default events to specified event,
> > > > which I think is good idea, but I don't think we should display the
> > > > extra '+' in output
> > >
> > > The value would be to stress that that is an event added to the ones
> > > without the + prefix, i.e. the default ones.
> > >
> > > But by having the command line copied over and the added events at the
> > > first lines we should have that abundantly clear.
> > >
> > > Also we won't print removed events (using -), is that available already?
> > >
> >
> > Sorry, the '-' support is not available in this patch. Can I do the patch
> > for '+' first and then do a follow up patch for '-' at next step?
>
> Yeah, it can be done afterwards, to be symmetric.
>
> > > Nope:
> > >
> > > [root@quaco ~]# perf stat -e -cycles sleep
> > > event syntax error: '-cycles'
> > > \___ parser error
> > > Run 'perf list' for a list of valid events
> > >
> > > Usage: perf stat [<options>] [<command>]
> > >
> > > -e, --event <event> event selector. use 'perf list' to list available events
>
> > So if we just want to append the default list, we only need to set
> > detailed_run=1, then ideally perf-stat will print the default list.
>
> > But for now, there are no task-clock, context-switches, cpu-migrations,
> > page-faults, instructions, branches and branch-misses displayed.
>
> > root@kbl-ppc:~# ./perf stat -e cycles -d -a -- sleep 1
> >
> > Performance counter stats for 'system wide':
> >
> > 124,178,207 cycles (80.02%)
> > 6,444,490 L1-dcache-loads (80.01%)
> > 1,043,169 L1-dcache-load-misses # 16.19% of all L1-dcache accesses (80.02%)
> > 564,474 LLC-loads (80.02%)
> > 49,262 LLC-load-misses # 8.73% of all LL-cache accesses (79.92%)
> >
> > 1.001614947 seconds time elapsed
> >
> > Do we still need the '+' prefix to add the specified event on top of default
> > list? It looks current syntax should already support that feature, but just
> > need to fix some issues.
>
> I think we can do away with that '+' when showing the added events and
> its counts.
I was thinking of people parsing the stat output (this is probably also
in CSV output, right?) having the extra '+' prrefix could cause issues
jirka