lkml.org 
[lkml]   [2002]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Measuring execution time
Mark Cuss wrote:

> I am working on optimizing some software and would like to be able to
> measure how long an instruction takes (down to the clock cycle of the CPU).
> I recall reading somewhere about a kernel time measurement called a "Jiffy"
> and figured that it would probably apply to this.
>
> If anyone has any tips on how to figure out how to do this I'd really
> appreciate it.

Jiffies are quite coarse-grained. On x86 you want the rdtsc instruction, while
on ppc you want mfrtcu/mfrtcl or mftbu/mftb depending on the version of the
chip. These are used as inline assembly, and if you do a google search you
should be able to find code snippets.

Chris

--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:23    [W:0.101 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site