[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51227A07.5020508@gmail.com>
Date: Mon, 18 Feb 2013 11:59:19 -0700
From: David Ahern <dsahern@...il.com>
To: Stephane Eranian <eranian@...gle.com>
CC: Pawel Moll <pawel.moll@....com>,
Steven Rostedt <rostedt@...dmis.org>,
John Stultz <john.stultz@...aro.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
"mingo@...e.hu" <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Anton Blanchard <anton@...ba.org>,
Will Deacon <Will.Deacon@....com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
Pekka Enberg <penberg@...il.com>,
Robert Richter <robert.richter@....com>,
tglx <tglx@...utronix.de>
Subject: Re: [RFC] perf: need to expose sched_clock to correlate user samples
with kernel samples
On 2/18/13 8:16 AM, Stephane Eranian wrote:
> Hi,
>
>
> I think the advantage of the ioctl() is that is reuses existing infrastructure.
> The downside is that to get the timestamp you need at a minimum:
>
> uint64_t get_perf_timestamp(void)
> {
> struct perf_event_attr attr;
> uint64_t ts = 0;
> int fd;
>
> memset(&attr, 0, sizeof(attr));
>
> /* pick a dummy SW event (no PMU HW resource allocated), keep it disabled */
> attr.type = PERF_TYPE_SOFTWARE;
> attr.config = PERF_COUNT_SW_CPU_CLOCK; /* dummy event */
> attr.disabled = 1;
>
> /* attach to self in per-thread mode */
> fd = perf_event_open(&attr, 0, -1, -1, 0);
> if (fd == -1)
> return 0;
>
> ioctl(fd, PERF_EVENT_IOC_GET_TIME, &ts);
> close(fd);
>
> return ts;
> }
>
That's the approach I took with an update to my perf_clock to
time-of-day series. Specific patch:
https://github.com/dsahern/linux/commit/7e6f40fca5f8cdbee1cd46d42b11aee71d0ffd34
and series:
https://github.com/dsahern/linux/commits/perf-time-of-day-3.7
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists