[PATCH 3/2] perf tools: Fixup read ABI breakage

From: Peter Zijlstra
Date: Thu Aug 13 2009 - 03:52:41 EST


Subject: perf tools: Fixup read ABI breakage
From: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Date: Thu Aug 13 09:03:33 CEST 2009

Update the perf tool to the new read output format.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
tools/perf/builtin-record.c | 2 +-
tools/perf/builtin-stat.c | 8 +++++---
tools/perf/util/event.h | 10 ++++++++--
3 files changed, 14 insertions(+), 6 deletions(-)

Index: linux-2.6/tools/perf/builtin-record.c
===================================================================
--- linux-2.6.orig/tools/perf/builtin-record.c
+++ linux-2.6/tools/perf/builtin-record.c
@@ -370,9 +370,9 @@ static void create_counter(int counter,
struct perf_header_attr *h_attr;
int track = !counter; /* only the first counter needs these */
struct {
- u64 count;
u64 time_enabled;
u64 time_running;
+ u64 count;
u64 id;
} read_data;

Index: linux-2.6/tools/perf/builtin-stat.c
===================================================================
--- linux-2.6.orig/tools/perf/builtin-stat.c
+++ linux-2.6/tools/perf/builtin-stat.c
@@ -168,10 +168,12 @@ static void read_counter(int counter)
close(fd[cpu][counter]);
fd[cpu][counter] = -1;

- count[0] += single_count[0];
if (scale) {
- count[1] += single_count[1];
- count[2] += single_count[2];
+ count[0] += single_count[2]; /* value */
+ count[1] += single_count[0]; /* enabled */
+ count[2] += single_count[1]; /* running */
+ } else {
+ count[0] += single_count[0]; /* value */
}
}

Index: linux-2.6/tools/perf/util/event.h
===================================================================
--- linux-2.6.orig/tools/perf/util/event.h
+++ linux-2.6/tools/perf/util/event.h
@@ -4,6 +4,9 @@
#include "util.h"
#include <linux/list.h>

+/*
+ * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
+ */
struct ip_event {
struct perf_event_header header;
u64 ip;
@@ -38,12 +41,15 @@ struct lost_event {
u64 lost;
};

-struct read_event {
+/*
+ * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
+ */
+struct read_event {
struct perf_event_header header;
u32 pid,tid;
- u64 value;
u64 time_enabled;
u64 time_running;
+ u64 value;
u64 id;
};


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/