linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <daahern@cisco.com>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: acme@ghostprotocols.net, mingo@elte.hu, peterz@infradead.org,
	fweisbec@gmail.com, paulus@samba.org, tglx@linutronix.de,
	David Ahern <daahern@cisco.com>
Subject: [PATCH 2/5] perf events: userspace plumbing for realtime sample attribute
Date: Sun, 20 Mar 2011 12:54:34 -0600	[thread overview]
Message-ID: <1300647277-8431-3-git-send-email-daahern@cisco.com> (raw)
In-Reply-To: <1300647277-8431-1-git-send-email-daahern@cisco.com>

Signed-off-by: David Ahern <daahern@cisco.com>
---
 tools/perf/util/event.c   |    1 +
 tools/perf/util/event.h   |    1 +
 tools/perf/util/evsel.c   |   10 ++++++++++
 tools/perf/util/session.c |    6 ++++++
 4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2b15c36..8abd33a 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -39,6 +39,7 @@ static struct perf_sample synth_sample = {
 	.pid	   = -1,
 	.tid	   = -1,
 	.time	   = -1,
+	.realtime  = -1,
 	.stream_id = -1,
 	.cpu	   = -1,
 	.period	   = 1,
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 9c35170..0c8dc11 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -65,6 +65,7 @@ struct perf_sample {
 	u64 ip;
 	u32 pid, tid;
 	u64 time;
+	u64 realtime;
 	u64 addr;
 	u64 id;
 	u64 stream_id;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 662596a..8768ea9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -286,6 +286,11 @@ static int perf_event__parse_id_sample(const union perf_event *event, u64 type,
 	array += ((event->header.size -
 		   sizeof(event->header)) / sizeof(u64)) - 1;
 
+	if (type & PERF_SAMPLE_REALTIME) {
+		sample->realtime = *array;
+		array--;
+	}
+
 	if (type & PERF_SAMPLE_CPU) {
 		u32 *p = (u32 *)array;
 		sample->cpu = *p;
@@ -371,6 +376,11 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 		array++;
 	}
 
+	if (type & PERF_SAMPLE_REALTIME) {
+		data->realtime = *array;
+		array++;
+	}
+
 	if (type & PERF_SAMPLE_PERIOD) {
 		data->period = *array;
 		array++;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c68cf40..b220c93 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -90,6 +90,9 @@ static void perf_session__id_header_size(struct perf_session *session)
 
        if (sample_type & PERF_SAMPLE_CPU)
                size += sizeof(data->cpu) * 2;
+
+       if (sample_type & PERF_SAMPLE_REALTIME)
+               size += sizeof(data->realtime);
 out:
        session->id_hdr_size = size;
 }
@@ -658,6 +661,9 @@ static void perf_session__print_tstamp(struct perf_session *session,
 
 	if (session->sample_type & PERF_SAMPLE_TIME)
 		printf("%" PRIu64 " ", sample->time);
+
+	if (session->sample_type & PERF_SAMPLE_REALTIME)
+		printf("%" PRIu64 " ", sample->realtime);
 }
 
 static void dump_event(struct perf_session *session, union perf_event *event,
-- 
1.7.4

  parent reply	other threads:[~2011-03-20 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-20 18:54 [PATCH 0/5] perf events: Add time-of-day to perf samples David Ahern
2011-03-20 18:54 ` [PATCH 1/5] perf events: add support for realtime clock attribute David Ahern
2011-03-20 19:08   ` Thomas Gleixner
2011-03-20 19:49     ` David Ahern
2011-03-20 20:05       ` Thomas Gleixner
2011-03-20 18:54 ` David Ahern [this message]
2011-03-20 18:54 ` [PATCH 3/5] perf record: add time-of-day option David Ahern
2011-03-20 18:54 ` [PATCH 4/5] perf script: add support for time-of-day strings in output David Ahern
2011-03-20 18:54 ` [PATCH 5/5] perf python: add REALTIME to constants David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300647277-8431-3-git-send-email-daahern@cisco.com \
    --to=daahern@cisco.com \
    --cc=acme@ghostprotocols.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).