lkml.org 
[lkml]   [2005]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to measure time accurately.
Peter Chubb wrote:
>>>>>>"Chris" == Chris Friesen <cfriesen@nortel.com> writes:

> Chris> Most cpus have some way of getting at a counter or decrementer
> Chris> of various frequencies. Usually it requires low-level hardware
> Chris> knowledge and often it needs assembly code.
>
> As a device driver is inside the linux kernel (unless you're writein a
> user-mode device driver :-)) you can use the getcycles() macro that's
> defined for most architectures. It provides a snapshot of the
> cycle-counter.

For ppc this only gives 32-bit values, which overflow every 129 seconds
on my G5. Depending on how long you're trying to time, this could be a
problem.

Chris
-
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-04-06 13:31    [W:0.056 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site