lkml.org 
[lkml]   [2009]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/2] perf tools: Fixup read ABI breakage
From
Date
Subject: perf tools: Fixup read ABI breakage
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
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@chello.nl>
---
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;
};



\
 
 \ /
  Last update: 2009-08-13 09:55    [W:0.058 / U:1.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site