perf: Use PERF_SAMPLE_IDENTIFIER
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 15 Jun 2016 20:30:31 +0000 (16:30 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 17 Jun 2016 16:17:55 +0000 (12:17 -0400)
Instead of PERF_SAMPLE_ID.  It's the preferred way to ID an event, and both
older and newer perfs can handle it.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/profile/perf/perf_format.h
tools/profile/perf/perfconv.c

index 9cf64f1..f355aa1 100644 (file)
@@ -563,15 +563,15 @@ struct perf_record_comm {
 /* For type PERF_RECORD_SAMPLE
  *
  * Configured with: PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
- * PERF_SAMPLE_ADDR | PERF_SAMPLE_ID | PERF_SAMPLE_CPU |
+ * PERF_SAMPLE_ADDR | PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_CPU |
  * PERF_SAMPLE_CALLCHAIN. */
 struct perf_record_sample {
        struct perf_event_header header;
+       uint64_t identifier;
        uint64_t ip;
        uint32_t pid, tid;
        uint64_t time;
        uint64_t addr;
-       uint64_t id;
        uint32_t cpu, res;
        uint64_t nr;
        uint64_t ips[0];
index db8a404..fdcd2f5 100644 (file)
@@ -572,8 +572,8 @@ static uint64_t perfconv_get_event_id(struct perfconv_context *cctx,
        attr.sample_period = sel->ev.trigger_count;
        /* Closely coupled with struct perf_record_sample */
        attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
-                          PERF_SAMPLE_ADDR | PERF_SAMPLE_ID | PERF_SAMPLE_CPU |
-                          PERF_SAMPLE_CALLCHAIN;
+                          PERF_SAMPLE_ADDR | PERF_SAMPLE_IDENTIFIER |
+                          PERF_SAMPLE_CPU | PERF_SAMPLE_CALLCHAIN;
        attr.exclude_guest = 1; /* we can't trace VMs yet */
        attr.exclude_hv = 1;    /* we aren't tracing our hypervisor, AFAIK */
        attr.exclude_user = !PMEV_GET_USR(raw_event);
@@ -673,7 +673,7 @@ static void emit_kernel_trace64(struct perf_record *pr,
        xrec->tid = 0;
        xrec->time = rec->tstamp;
        xrec->addr = rec->trace[0];
-       xrec->id = perfconv_get_event_id(cctx, rec->info);
+       xrec->identifier = perfconv_get_event_id(cctx, rec->info);
        xrec->cpu = rec->cpu;
        xrec->nr = rec->num_traces - 1;
        memcpy(xrec->ips, rec->trace + 1, (rec->num_traces - 1) * sizeof(uint64_t));
@@ -699,7 +699,7 @@ static void emit_user_trace64(struct perf_record *pr,
        xrec->pid = xrec->tid = rec->pid;
        xrec->time = rec->tstamp;
        xrec->addr = rec->trace[0];
-       xrec->id = perfconv_get_event_id(cctx, rec->info);
+       xrec->identifier = perfconv_get_event_id(cctx, rec->info);
        xrec->cpu = rec->cpu;
        xrec->nr = rec->num_traces - 1;
        memcpy(xrec->ips, rec->trace + 1, (rec->num_traces - 1) * sizeof(uint64_t));