]> granicus.if.org Git - strace/commitdiff
perf.c: add support for struct perf_event_attr.namespaces
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 8 Jan 2018 18:48:42 +0000 (19:48 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Jan 2018 15:54:33 +0000 (15:54 +0000)
This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10.

* configure.ac (AC_CHECK_MEMBERS): Add  perf_event_attr.namespaces.
* perf_event_struct.h (struct perf_event_attr): Add namespaces field.
* perf.c (print_perf_event_attr): Print namespaces field.
Update comment for __reserved_1 field.
* tests/perf_event_open.c (struct pea_flags): Add namespaces field.
(print_event_attr): Update expected output.

configure.ac
perf.c
perf_event_struct.h
tests/perf_event_open.c

index 82de8476c995cda435ff8fcb9dc4a2d6e43d3e03..b0ffa57d0e9b15f60e7592e790440c192e1355c4 100644 (file)
@@ -367,6 +367,7 @@ AC_CHECK_MEMBERS(m4_normalize([
        struct perf_event_attr.use_clockid,
        struct perf_event_attr.context_switch,
        struct perf_event_attr.write_backward,
+       struct perf_event_attr.namespaces,
        struct perf_event_attr.bp_type,
        struct perf_event_attr.config1,
        struct perf_event_attr.config2,
diff --git a/perf.c b/perf.c
index 6af0f42a1b09610164f86998602cb9401ee1c4cd..84dac114ada0075319c038f7b802024f9fd4117e 100644 (file)
--- a/perf.c
+++ b/perf.c
@@ -304,7 +304,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
                ", comm_exec=%u"
                ", use_clockid=%u"
                ", context_switch=%u"
-               ", write_backward=%u",
+               ", write_backward=%u"
+               ", namespaces=%u",
                attr->mmap_data,
                attr->sample_id_all,
                attr->exclude_host,
@@ -315,7 +316,8 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
                attr->comm_exec,
                attr->use_clockid,
                attr->context_switch,
-               attr->write_backward);
+               attr->write_backward,
+               attr->namespaces);
 
        /*
         * Print it only in case it is non-zero, since it may contain flags we
@@ -324,7 +326,7 @@ print_perf_event_attr(struct tcb *const tcp, const kernel_ulong_t addr)
        if (attr->__reserved_1) {
                tprintf(", __reserved_1=%#" PRIx64,
                        (uint64_t) attr->__reserved_1);
-               tprints_comment("Bits 63..28");
+               tprints_comment("Bits 63..29");
        }
 
        if (attr->watermark)
index b5a15bb5bcc8964edf153f049aacf1d6808a2f17..a75b88ad76ed0f18e512e47393a3f002529b3561 100644 (file)
@@ -40,7 +40,8 @@ struct perf_event_attr {
                 use_clockid                    :1,
                 context_switch                 :1,
                 write_backward                 :1,
-                __reserved_1                   :36;
+                namespaces                     :1,
+                __reserved_1                   :35;
        union {
                uint32_t wakeup_events;
                uint32_t wakeup_watermark;
index 74ff9527e20fb2cb614e884c9bfa77799889a850..baed1d781beaaf0a09e103964bbd498eb706783f 100644 (file)
@@ -102,7 +102,8 @@ struct pea_flags {
                 use_clockid                    :1,
                 context_switch                 :1,
                 write_backward                 :1,
-                __reserved_1                   :36;
+                namespaces                     :1,
+                __reserved_1                   :35;
 };
 
 static const char *
@@ -351,9 +352,17 @@ print_event_attr(struct perf_event_attr *attr_ptr, size_t size,
 # endif
        printf(", write_backward=%" PRIu64, val);
 
+       val =
+# ifdef HAVE_STRUCT_PERF_EVENT_ATTR_NAMESPACES
+               attr->namespaces;
+# else
+               flags_data.flags.namespaces;
+# endif
+       printf(", namespaces=%" PRIu64, val);
+
        val = flags_data.flags.__reserved_1;
        if (val)
-               printf(", __reserved_1=%#" PRIx64 " /* Bits 63..28 */", val);
+               printf(", __reserved_1=%#" PRIx64 " /* Bits 63..29 */", val);
 
        printf(", %s=%u",
                attr->watermark ? "wakeup_watermark" : "wakeup_events",