[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1228461385.18899.13.camel@twins>
Date: Fri, 05 Dec 2008 08:16:25 +0100
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Ingo Molnar <mingo@...e.hu>
Cc: Paul Mackerras <paulus@...ba.org>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Stephane Eranian <eranian@...glemail.com>,
Eric Dumazet <dada1@...mosbay.com>,
Robert Richter <robert.richter@....com>,
Arjan van de Veen <arjan@...radead.org>,
Peter Anvin <hpa@...or.com>,
Steven Rostedt <rostedt@...dmis.org>,
David Miller <davem@...emloft.net>
Subject: Re: [patch 0/3] [Announcement] Performance Counters for Linux
On Fri, 2008-12-05 at 08:03 +0100, Ingo Molnar wrote:
> int main(void)
> {
> unsigned long long count1, count2;
> int fd1, fd2, ret;
>
> fd1 = perf_counter_open(PERF_COUNT_INSTRUCTIONS, 0, 0, 0, -1);
> assert(fd1 >= 0);
> fd2 = perf_counter_open(PERF_COUNT_CACHE_MISSES, 0, 0, 0, -1);
> assert(fd1 >= 0);
>
> for (;;) {
> ret = read(fd1, &count1, sizeof(count1));
> assert(ret == 8);
> ret = read(fd2, &count2, sizeof(count2));
> assert(ret == 8);
>
> printf("counter1 value: %Ld instructions\n", count1);
> printf("counter2 value: %Ld cachemisses\n", count2);
> sleep(1);
> }
> return 0;
> }
So, while most people would not consider two consecutive read() ops to
be close or near the same time, due to preemption and such, that is
taken away by the fact that the counters are task local time based - so
preemption doesn't affect thing. Right?
--
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