diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2021-06-29 02:21:43 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-06-30 09:52:37 +0000 |
commit | d0f447976149e48382ab9e999ca4744b281c5a83 (patch) | |
tree | cfd931ed30ae7a4bd230844a8e4dc97f0045ae39 | |
parent | 3ce9f441ec259af2278a91c0df8b234d60c41a43 (diff) | |
download | strace-d0f447976149e48382ab9e999ca4744b281c5a83.tar.gz |
perf: implement struct perf_event_attr.cgroup field decoding
Introduced in Linux commit v5.7-rc1~77^2^2~24.
* src/perf_event_struct.h (struct perf_event_attr): Add cgroup field.
* src/perf.c (print_perf_event_attr): Print it; correct __reserved_1 comment.
* tests/perf_event_open.c (struct pea_flags): Add cgroup field.
(print_event_attr): Print it, correct the __reserved_1 field comment.
-rw-r--r-- | src/perf.c | 4 | ||||
-rw-r--r-- | src/perf_event_struct.h | 3 | ||||
-rw-r--r-- | tests/perf_event_open.c | 8 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/perf.c b/src/perf.c index 264aee58d..363410709 100644 --- a/src/perf.c +++ b/src/perf.c @@ -309,6 +309,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) PRINT_FIELD_U_CAST(*attr, bpf_event, unsigned int); tprint_struct_next(); PRINT_FIELD_U_CAST(*attr, aux_output, unsigned int); + tprint_struct_next(); + PRINT_FIELD_U_CAST(*attr, cgroup, unsigned int); /* * Print it only in case it is non-zero, since it may contain flags we @@ -317,7 +319,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr) if (attr->__reserved_1) { tprint_struct_next(); PRINT_FIELD_X_CAST(*attr, __reserved_1, uint64_t); - tprints_comment("Bits 63..32"); + tprints_comment("Bits 63..33"); } if (attr->watermark) { diff --git a/src/perf_event_struct.h b/src/perf_event_struct.h index 4d4f989c2..1f237b0a7 100644 --- a/src/perf_event_struct.h +++ b/src/perf_event_struct.h @@ -52,7 +52,8 @@ struct perf_event_attr { ksymbol :1, bpf_event :1, aux_output :1, - __reserved_1 :32; + cgroup :1, + __reserved_1 :31; union { uint32_t wakeup_events; uint32_t wakeup_watermark; diff --git a/tests/perf_event_open.c b/tests/perf_event_open.c index d7c083f42..77e5e967a 100644 --- a/tests/perf_event_open.c +++ b/tests/perf_event_open.c @@ -79,7 +79,8 @@ struct pea_flags { ksymbol :1, bpf_event :1, aux_output :1, - __reserved_1 :32; + cgroup :1, + __reserved_1 :31; }; static const char * @@ -280,9 +281,12 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size, val = attr->aux_output; printf(", aux_output=%" PRIu64, val); + val = attr->cgroup; + printf(", cgroup=%" PRIu64, val); + val = flags_data.flags.__reserved_1; if (val) - printf(", __reserved_1=%#" PRIx64 " /* Bits 63..32 */", val); + printf(", __reserved_1=%#" PRIx64 " /* Bits 63..33 */", val); printf(", %s=%u", attr->watermark ? "wakeup_watermark" : "wakeup_events", |