Add procfs based memory and network tool events
Ian Rogers
reviewercover Add procfs based memory and network tool events
Add events for memory use and network activity based on data readily available in /prod/pid/statm, /proc/pid/smaps_rollup and /proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:
```
$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000
1.001023475 0 net_rx_bytes
1.001023475 0 net_rx_compressed
1.001023475 42,647,328 net_rx_drop
1.001023475 463,069,152 net_rx_errors
1.001023475 0 net_rx_fifo
1.001023475 0 net_rx_frame
1.001023475 0 net_rx_multicast
1.001023475 423,195,831,744 net_rx_packets
1.001023475 0 net_tx_bytes
1.001023475 0 net_tx_carrier
1.001023475 0 net_tx_colls
1.001023475 0 net_tx_compressed
1.001023475 0 net_tx_drop
1.001023475 0 net_tx_errors
1.001023475 0 net_tx_fifo
1.001023475 0 net_tx_packets
```As the events are in the tool_pmu they can be used in metrics. The json descriptions they are exposed in perf list and the events can be seen in the python ilist application.
Note, if a process terminates then the count reading returns an error and this can expose what appear to be latent bugs in the aggregation and display code.
Ian Rogers (2):
perf tool_pmu: Add memory events
perf tool_pmu: Add network events
tools/perf/builtin-stat.c | 10 +- .../pmu-events/arch/common/common/tool.json | 266 ++++++++- tools/perf/pmu-events/empty-pmu-events.c | 312 +++++++---- tools/perf/util/tool_pmu.c | 514 +++++++++++++++++- tools/perf/util/tool_pmu.h | 44 ++ 5 files changed, 1026 insertions(+), 120 deletions(-)
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
Ian Rogers
reviewerPATCH 1/2 perf tool_pmu: Add memory events
Add tool PMU events to report memory usage information exposed by /proc/pid/smaps_rollup and /proc/pid/statm.
The following events are added:
- memory_anon_huge_pages
- memory_anonymous
- memory_data
- memory_file_pmd_mapped
- memory_ksm
- memory_lazyfree
- memory_locked
- memory_private_clean
- memory_private_dirty
- memory_private_hugetlb
- memory_pss
- memory_pss_anon
- memory_pss_dirty
- memory_pss_file
- memory_pss_shmem
- memory_referenced
- memory_resident
- memory_rss
- memory_shared
- memory_shared_clean
- memory_shared_dirty
- memory_shared_hugetlb
- memory_shmem_pmd_mapped
- memory_size
- memory_swap
- memory_swap_pss
- memory_text
- memory_uss
The events are aggregated across processes in system-wide mode, or reported per-process when monitoring specific tasks. The tool_pmu implementation is updated to read from /proc files and tool.json is updated with the new events and detailed descriptions. The data can only be gathered for a running process except for memory_rss and memory_resident that use rusage data from wait4 to give a final value.
Examples of gathering system-wide statm and smaps_rollup based events:
```
$ perf stat -e memory_size,memory_resident,memory_shared,memory_text,memory_data -I 1000
1.001046524 94,942,406,868,992 memory_size
1.001046524 24,885,137,408 memory_resident
1.001046524 15,494,561,792 memory_shared
1.001046524 15,249,453,056 memory_text
1.001046524 74,510,024,704 memory_data
...
$ perf stat -e memory_anon_huge_pages,memory_anonymous,memory_file_pmd_mapped,memory_ksm,memory_lazyfree,memory_locked,memory_private_clean,memory_private_dirty,memory_private_hugetlb,memory_pss,memory_pss_anon,memory_pss_dirty,memory_pss_file,memory_pss_shmem,memory_referenced,memory_rss,memory_shared,memory_shared_clean,memory_shared_dirty,memory_shared_hugetlb,memory_shmem_pmd_mapped,memory_swap,memory_swap_pss,memory_uss -I 1000
1.001107268 981,467,136 memory_anon_huge_pages
1.001107268 9,459,105,792 memory_anonymous
1.001107268 0 memory_file_pmd_mapped
1.001107268 0 memory_ksm
1.001107268 1,269,760 memory_lazyfree
1.001107268 634,880 memory_locked
1.001107268 958,963,712 memory_private_clean
1.001107268 8,400,080,896 memory_private_dirty
1.001107268 0 memory_private_hugetlb
1.001107268 10,711,451,648 memory_pss
1.001107268 8,387,961,856 memory_pss_anon
1.001107268 8,642,944,000 memory_pss_dirty
1.001107268 2,078,282,752 memory_pss_file
1.001107268 245,125,120 memory_pss_shmem
1.001107268 24,356,818,944 memory_referenced
1.001107268 25,256,157,184 memory_rss
1.001107268 15,757,029,376 memory_shared
1.001107268 14,230,978,560 memory_shared_clean
1.001107268 1,670,934,528 memory_shared_dirty
1.001107268 0 memory_shared_hugetlb
1.001107268 0 memory_shmem_pmd_mapped
1.001107268 0 memory_swap
1.001107268 0 memory_swap_pss
1.001107268 9,328,041,984 memory_uss
...
```--- tools/perf/builtin-stat.c | 10 +- .../pmu-events/arch/common/common/tool.json | 168 ++++++++ tools/perf/pmu-events/empty-pmu-events.c | 280 +++++++------ tools/perf/util/tool_pmu.c | 375 +++++++++++++++++- tools/perf/util/tool_pmu.h | 28 ++ 5 files changed, 742 insertions(+), 119 deletions(-)
tools/perf/builtin-stat.c +8 -2
@@ -107,6 +107,7 @@struct rusage_stats {struct stats ru_utime_usec_stat;struct stats ru_stime_usec_stat; +struct stats ru_maxrss_stat; };static void print_counters (struct timespec *ts,int argc,const char **argv);
@@ -288,7 +289,9 @@ static int read_single_counter(struct evsel *counter, int cpu_map_idx, int threa*/ if (err && cpu_map_idx ==0 && (evsel__tool_event (counter) ==TOOL_PMU__EVENT_USER_TIME || -evsel__tool_event (counter) ==TOOL_PMU__EVENT_SYSTEM_TIME )) { +evsel__tool_event (counter) ==TOOL_PMU__EVENT_SYSTEM_TIME || +evsel__tool_event (counter) ==TOOL_PMU__EVENT_MEMORY_RESIDENT || +evsel__tool_event (counter) ==TOOL_PMU__EVENT_MEMORY_RSS )) {struct perf_counts_values *count =perf_counts (counter->counts, cpu_map_idx, thread);struct perf_counts_values *old_count =NULL ;
@@ -299,8 +302,10 @@ static int read_single_counter(struct evsel *counter, int cpu_map_idx, int threaif (evsel__tool_event (counter) ==TOOL_PMU__EVENT_USER_TIME ) val = ru_stats.ru_utime_usec_stat.mean; -else +else if (evsel__tool_event (counter) ==TOOL_PMU__EVENT_SYSTEM_TIME ) val = ru_stats.ru_stime_usec_stat.mean; +else + val = ru_stats.ru_maxrss_stat.mean; count->val = val;if (old_count) {
@@ -778,6 +783,7 @@ static void update_rusage_stats(const struct rusage *rusage) (rusage->ru_utime.tv_usec * us_to_ns + rusage->ru_utime.tv_sec * s_to_ns));update_stats (&ru_stats.ru_stime_usec_stat, (rusage->ru_stime.tv_usec * us_to_ns + rusage->ru_stime.tv_sec * s_to_ns)); +update_stats (&ru_stats.ru_maxrss_stat, rusage->ru_maxrss *1024 ); }static int __run_perf_stat (int argc,const char **argv,int run_idx)
tools/perf/pmu-events/arch/common/common/tool.json +168 -0
173 lines not on this page · raw message
tools/perf/pmu-events/empty-pmu-events.c +168 -112
364 lines not on this page · raw message
tools/perf/util/tool_pmu.c +370 -5
437 lines not on this page · raw message
tools/perf/util/tool_pmu.h +28 -0
@@ -24,6 +24,34 @@ enum tool_pmu_event {TOOL_PMU__EVENT_SYSTEM_TSC_FREQ ,TOOL_PMU__EVENT_CORE_WIDE ,TOOL_PMU__EVENT_TARGET_CPU , +TOOL_PMU__EVENT_MEMORY_ANON_HUGE_PAGES , +TOOL_PMU__EVENT_MEMORY_ANONYMOUS , +TOOL_PMU__EVENT_MEMORY_DATA , +TOOL_PMU__EVENT_MEMORY_FILE_PMD_MAPPED , +TOOL_PMU__EVENT_MEMORY_KSM , +TOOL_PMU__EVENT_MEMORY_LAZYFREE , +TOOL_PMU__EVENT_MEMORY_LOCKED , +TOOL_PMU__EVENT_MEMORY_PRIVATE_CLEAN , +TOOL_PMU__EVENT_MEMORY_PRIVATE_DIRTY , +TOOL_PMU__EVENT_MEMORY_PRIVATE_HUGETLB , +TOOL_PMU__EVENT_MEMORY_PSS , +TOOL_PMU__EVENT_MEMORY_PSS_ANON , +TOOL_PMU__EVENT_MEMORY_PSS_DIRTY , +TOOL_PMU__EVENT_MEMORY_PSS_FILE , +TOOL_PMU__EVENT_MEMORY_PSS_SHMEM , +TOOL_PMU__EVENT_MEMORY_REFERENCED , +TOOL_PMU__EVENT_MEMORY_RESIDENT , +TOOL_PMU__EVENT_MEMORY_RSS , +TOOL_PMU__EVENT_MEMORY_SHARED , +TOOL_PMU__EVENT_MEMORY_SHARED_CLEAN , +TOOL_PMU__EVENT_MEMORY_SHARED_DIRTY , +TOOL_PMU__EVENT_MEMORY_SHARED_HUGETLB , +TOOL_PMU__EVENT_MEMORY_SHMEM_PMD_MAPPED , +TOOL_PMU__EVENT_MEMORY_SIZE , +TOOL_PMU__EVENT_MEMORY_SWAP , +TOOL_PMU__EVENT_MEMORY_SWAP_PSS , +TOOL_PMU__EVENT_MEMORY_TEXT , +TOOL_PMU__EVENT_MEMORY_USS , TOOL_PMU__EVENT_MAX, };
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
Ian Rogers
reviewerPATCH 2/2 perf tool_pmu: Add network events
In reply to Ian RogersAdd tool PMU events to report network statistics from /proc/net/dev. The events can be read system-wide (from /proc/net/dev) or per-process (from /proc/pid/net/dev).
The following events are added for both RX (receive) and TX (transmit):
- bytes
- packets
- errors
- drop
- fifo
- frame (RX only) / colls (TX only)
- compressed
- multicast (RX only) / carrier (TX only)
Updates tool.json with the new events and descriptions. Updates tool_pmu implementation to parse the net/dev format.
Below are examples of system-wide and per-process gathering respectively:
```
$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -I 1000
1.001154872 0 net_rx_bytes
1.001154872 0 net_rx_compressed
1.001154872 444,577 net_rx_drop
1.001154872 4,824,888 net_rx_errors
1.001154872 0 net_rx_fifo
1.001154872 0 net_rx_frame
1.001154872 0 net_rx_multicast
1.001154872 4,408,889,452 net_rx_packets
1.001154872 0 net_tx_bytes
1.001154872 0 net_tx_carrier
1.001154872 0 net_tx_colls
1.001154872 0 net_tx_compressed
1.001154872 0 net_tx_drop
1.001154872 0 net_tx_errors
1.001154872 0 net_tx_fifo
1.001154872 0 net_tx_packets
$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000
1.001023475 0 net_rx_bytes
1.001023475 0 net_rx_compressed
1.001023475 42,647,328 net_rx_drop
1.001023475 463,069,152 net_rx_errors
1.001023475 0 net_rx_fifo
1.001023475 0 net_rx_frame
1.001023475 0 net_rx_multicast
1.001023475 423,195,831,744 net_rx_packets
1.001023475 0 net_tx_bytes
1.001023475 0 net_tx_carrier
1.001023475 0 net_tx_colls
1.001023475 0 net_tx_compressed
1.001023475 0 net_tx_drop
1.001023475 0 net_tx_errors
1.001023475 0 net_tx_fifo
1.001023475 0 net_tx_packets
...
```--- .../pmu-events/arch/common/common/tool.json | 98 ++++++- tools/perf/pmu-events/empty-pmu-events.c | 256 ++++++++++-------- tools/perf/util/tool_pmu.c | 155 ++++++++++- tools/perf/util/tool_pmu.h | 16 ++ 4 files changed, 404 insertions(+), 121 deletions(-)
tools/perf/pmu-events/arch/common/common/tool.json +97 -1
@@ -250,5 +250,101 @@ "EventName": "memory_uss", "BriefDescription": "Unique Set Size (USS) in bytes", "ConfigCode": "42" - } + }, + { + "Unit": "tool", + "EventName": "net_rx_bytes", + "BriefDescription": "Network received bytes", + "ConfigCode": "43" + }, + { + "Unit": "tool", + "EventName": "net_rx_packets", + "BriefDescription": "Network received packets", + "ConfigCode": "44" + }, + { + "Unit": "tool", + "EventName": "net_rx_errors", + "BriefDescription": "Network received errors", + "ConfigCode": "45" + }, + { + "Unit": "tool", + "EventName": "net_rx_drop", + "BriefDescription": "Network received dropped packets", + "ConfigCode": "46" + }, + { + "Unit": "tool", + "EventName": "net_rx_fifo", + "BriefDescription": "Network received fifo overruns", + "ConfigCode": "47" + }, + { + "Unit": "tool", + "EventName": "net_rx_frame", + "BriefDescription": "Network received framing errors", + "ConfigCode": "48" + }, + { + "Unit": "tool", + "EventName": "net_rx_compressed", + "BriefDescription": "Network received compressed packets", + "ConfigCode": "49" + }, + { + "Unit": "tool", + "EventName": "net_rx_multicast", + "BriefDescription": "Network received multicast packets", + "ConfigCode": "50" + }, + { + "Unit": "tool", + "EventName": "net_tx_bytes", + "BriefDescription": "Network transmitted bytes", + "ConfigCode": "51" + }, + { + "Unit": "tool", + "EventName": "net_tx_packets", + "BriefDescription": "Network transmitted packets", + "ConfigCode": "52" + }, + { + "Unit": "tool", + "EventName": "net_tx_errors", + "BriefDescription": "Network transmitted errors", + "ConfigCode": "53" + }, + { + "Unit": "tool", + "EventName": "net_tx_drop", + "BriefDescription": "Network transmitted dropped packets", + "ConfigCode": "54" + }, + { + "Unit": "tool", + "EventName": "net_tx_fifo", + "BriefDescription": "Network transmitted fifo overruns", + "ConfigCode": "55" + }, + { + "Unit": "tool", + "EventName": "net_tx_colls", + "BriefDescription": "Network transmitted collisions", + "ConfigCode": "56" + }, + { + "Unit": "tool", + "EventName": "net_tx_carrier", + "BriefDescription": "Network transmitted carrier losses", + "ConfigCode": "57" + }, + { + "Unit": "tool", + "EventName": "net_tx_compressed", + "BriefDescription": "Network transmitted compressed packets", + "ConfigCode": "58" + } ]
tools/perf/pmu-events/empty-pmu-events.c +144 -112
340 lines not on this page · raw message
tools/perf/util/tool_pmu.c +147 -8
219 lines not on this page · raw message
tools/perf/util/tool_pmu.h +16 -0
@@ -52,6 +52,22 @@ enum tool_pmu_event {TOOL_PMU__EVENT_MEMORY_SWAP_PSS ,TOOL_PMU__EVENT_MEMORY_TEXT ,TOOL_PMU__EVENT_MEMORY_USS , +TOOL_PMU__EVENT_NET_RX_BYTES , +TOOL_PMU__EVENT_NET_RX_PACKETS , +TOOL_PMU__EVENT_NET_RX_ERRORS , +TOOL_PMU__EVENT_NET_RX_DROP , +TOOL_PMU__EVENT_NET_RX_FIFO , +TOOL_PMU__EVENT_NET_RX_FRAME , +TOOL_PMU__EVENT_NET_RX_COMPRESSED , +TOOL_PMU__EVENT_NET_RX_MULTICAST , +TOOL_PMU__EVENT_NET_TX_BYTES , +TOOL_PMU__EVENT_NET_TX_PACKETS , +TOOL_PMU__EVENT_NET_TX_ERRORS , +TOOL_PMU__EVENT_NET_TX_DROP , +TOOL_PMU__EVENT_NET_TX_FIFO , +TOOL_PMU__EVENT_NET_TX_COLLS , +TOOL_PMU__EVENT_NET_TX_CARRIER , +TOOL_PMU__EVENT_NET_TX_COMPRESSED , TOOL_PMU__EVENT_MAX, };
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
Ian Rogers
reviewerQuoted 25 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:``` $ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000 1.001023475 0 net_rx_bytes 1.001023475 0 net_rx_compressed 1.001023475 42,647,328 net_rx_drop 1.001023475 463,069,152 net_rx_errors 1.001023475 0 net_rx_fifo 1.001023475 0 net_rx_frame 1.001023475 0 net_rx_multicast 1.001023475 423,195,831,744 net_rx_packets 1.001023475 0 net_tx_bytes 1.001023475 0 net_tx_carrier 1.001023475 0 net_tx_colls 1.001023475 0 net_tx_compressed 1.001023475 0 net_tx_drop 1.001023475 0 net_tx_errors 1.001023475 0 net_tx_fifo 1.001023475 0 net_tx_packets ```
Quoted 7 lines
As the events are in the
tool_pmuthey can be used in metrics. The json descriptions they are exposed inperf listand the events can be seen in the python ilist application.Note, if a process terminates then the count reading returns an error and this can expose what appear to be latent bugs in the aggregation and display code.
I forgot to mention there are also other events that could be added. For example, from /proc/self/status the signal information could be useful as could voluntary vs involuntary context switch counts. What is here is likely useful enough that a bigger patch series isn't warranted.
Thanks,
Ian
Quoted 14 lines
Ian Rogers (2):
perftool_pmu: Add memory events
perftool_pmu: Add network eventstools/perf/builtin-stat.c | 10 +- .../pmu-events/arch/common/common/tool.json | 266 ++++++++- tools/perf/pmu-events/empty-pmu-events.c | 312 +++++++---- tools/perf/util/tool_pmu.c | 514 +++++++++++++++++- tools/perf/util/tool_pmu.h | 44 ++ 5 files changed, 1026 insertions(+), 120 deletions(-)--
2.52.0.351.gbe84eed79e-goog
Namhyung Kim
maintainerHi Ian,
Quoted 15 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:``` $ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000 1.001023475 0 net_rx_bytes 1.001023475 0 net_rx_compressed 1.001023475 42,647,328 net_rx_drop 1.001023475 463,069,152 net_rx_errors 1.001023475 0 net_rx_fifo 1.001023475 0 net_rx_frame 1.001023475 0 net_rx_multicast 1.001023475 423,195,831,744 net_rx_packets 1.001023475 0 net_tx_bytes
Quoted 8 lines
1.001023475 0 net_tx_carrier
1.001023475 0 net_tx_colls
1.001023475 0 net_tx_compressed
1.001023475 0 net_tx_drop
1.001023475 0 net_tx_errors
1.001023475 0 net_tx_fifo
1.001023475 0 net_tx_packets
```Interesting.
Quoted 8 lines
As the events are in the
tool_pmuthey can be used in metrics. The json descriptions they are exposed inperf listand the events can be seen in the python ilist application.Note, if a process terminates then the count reading returns an error and this can expose what appear to be latent bugs in the aggregation and display code.
How do you handle system-wide mode and sampling (perf record)?
Thanks,
Namhyung
Quoted 15 lines
Ian Rogers (2):
perftool_pmu: Add memory events
perftool_pmu: Add network eventstools/perf/builtin-stat.c | 10 +- .../pmu-events/arch/common/common/tool.json | 266 ++++++++- tools/perf/pmu-events/empty-pmu-events.c | 312 +++++++---- tools/perf/util/tool_pmu.c | 514 +++++++++++++++++- tools/perf/util/tool_pmu.h | 44 ++ 5 files changed, 1026 insertions(+), 120 deletions(-)Signature · 1 line
2.52.0.351.gbe84eed79e-goog
Ian Rogers
reviewerQuoted 28 lines · Namhyung Kim
Hi Ian,
Quoted 15 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:``` $ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000 1.001023475 0 net_rx_bytes 1.001023475 0 net_rx_compressed 1.001023475 42,647,328 net_rx_drop 1.001023475 463,069,152 net_rx_errors 1.001023475 0 net_rx_fifo 1.001023475 0 net_rx_frame 1.001023475 0 net_rx_multicast 1.001023475 423,195,831,744 net_rx_packets 1.001023475 0 net_tx_bytesQuoted 8 lines
1.001023475 0 net_tx_carrier 1.001023475 0 net_tx_colls 1.001023475 0 net_tx_compressed 1.001023475 0 net_tx_drop 1.001023475 0 net_tx_errors 1.001023475 0 net_tx_fifo 1.001023475 0 net_tx_packets ```
Quoted 1 line
Interesting.
Thanks.
Quoted 10 lines
Quoted 8 lines
As the events are in the
tool_pmuthey can be used in metrics. The json descriptions they are exposed inperf listand the events can be seen in the python ilist application.Note, if a process terminates then the count reading returns an error and this can expose what appear to be latent bugs in the aggregation and display code.
How do you handle system-wide mode and sampling (perf record)?
So tool events don't support perf record and fail at opening due to the invalid PMU type and config. This is the same as if you did perf record -e duration_time with a perf today, which looks like:
``` $ perf record -e duration_time -a sleep 1 Error: Failure to open event 'duration_time' on PMU 'tool' which will be removed. No fallback found for 'duration_time' for error 0 Error: Failure to open any events for recording. ```
For system-wide the behavior is hopefully intuitive in that the memory and network counts are for the whole system rather than the given processes. For the memory events the proc directory is scanned and all processes counts aggregated. For network data /proc/net/dev is read rather than /proc/pid/net/dev. There is more detail in the individual commit messages on this.
Thanks,
Ian
Quoted 18 lines
Thanks,
NamhyungQuoted 15 lines
Ian Rogers (2):
perftool_pmu: Add memory events
perftool_pmu: Add network eventstools/perf/builtin-stat.c | 10 +- .../pmu-events/arch/common/common/tool.json | 266 ++++++++- tools/perf/pmu-events/empty-pmu-events.c | 312 +++++++---- tools/perf/util/tool_pmu.c | 514 +++++++++++++++++- tools/perf/util/tool_pmu.h | 44 ++ 5 files changed, 1026 insertions(+), 120 deletions(-)--
2.52.0.351.gbe84eed79e-goog
Quoted 8 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:
```$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000
But AFAIK that's for the complete network name space, not just the process, thus highly misleading in perf context because the scope is incompatible.
-Andi
Ian Rogers
reviewerQuoted 12 lines · Andi Kleen
Quoted 8 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:
```$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000
Quoted 3 lines
But AFAIK that's for the complete network name space, not just the process, thus highly misleading in perf context because the scope is incompatible.
Yeah, we can point this out in the event descriptions or just not have the events and try to do some per process BPF type thing. Given we don't have the BPF thing it is still tempting to have these counters as-is for the system-wide case.
Thanks,
Ian
Namhyung Kim
maintainerQuoted 13 lines · Ian Rogers
Quoted 12 lines · Andi Kleen
Quoted 8 lines · Ian Rogers
Add events for memory use and network activity based on data readily available in /prod/pid/statm,
/proc/pid/smaps_rollupand/proc/pid/net/dev. For example the network usage of chrome processes on a system may be gathered with:
```$ perf stat -e net_rx_bytes,net_rx_compressed,net_rx_drop,net_rx_errors,net_rx_fifo,net_rx_frame,net_rx_multicast,net_rx_packets,net_tx_bytes,net_tx_carrier,net_tx_colls,net_tx_compressed,net_tx_drop,net_tx_errors,net_tx_fifo,net_tx_packets -p $(pidof -d, chrome) -I 1000
Quoted 8 lines
Quoted 3 lines
But AFAIK that's for the complete network name space, not just the process, thus highly misleading in perf context because the scope is incompatible.
Yeah, we can point this out in the event descriptions or just not have the events and try to do some per process BPF type thing. Given we don't have the BPF thing it is still tempting to have these counters as-is for the system-wide case.
You may want to make it fail to open for per-process mode.
Thanks,
Namhyung