public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Calculating time in order of 0.1usec on x86 system
@ 2008-09-30  7:01 Parav Pandit
  2008-09-30  9:37 ` Parav Pandit
  0 siblings, 1 reply; 2+ messages in thread
From: Parav Pandit @ 2008-09-30  7:01 UTC (permalink / raw)
  To: Linux kernel

Hi,

I need to calculate time spent by a function in order of less then a microsecond on x86 SMP platform.

Current profiling tools and gettimeofday() are not sufficient.

So I am using get_cycles() to get the CPU cycles.

Now how do I convert it into the time interval?

Do I have to divide it by "cpu_khz" variable? Or some other method?
Is yes, what will be the unit of the result (time interval)? nsec/usec/msec?

e.g. get_cycles()/cpu_khz (unit?)

Or Is there more simpler method exist?

Regards,
Parav Pandit


      

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Calculating time in order of 0.1usec on x86 system
  2008-09-30  7:01 Calculating time in order of 0.1usec on x86 system Parav Pandit
@ 2008-09-30  9:37 ` Parav Pandit
  0 siblings, 0 replies; 2+ messages in thread
From: Parav Pandit @ 2008-09-30  9:37 UTC (permalink / raw)
  To: Linux kernel

I am getting my desired numbers.
get_cycles()/cpu_khz gives the right time interval on x86 system.

Parav



--- On Tue, 9/30/08, Parav Pandit <paravpandit@yahoo.com> wrote:

> From: Parav Pandit <paravpandit@yahoo.com>
> Subject: Calculating time in order of 0.1usec on x86 system
> To: "Linux kernel" <linux-kernel@vger.kernel.org>
> Date: Tuesday, September 30, 2008, 12:31 PM
> Hi,
> 
> I need to calculate time spent by a function in order of
> less then a microsecond on x86 SMP platform.
> 
> Current profiling tools and gettimeofday() are not
> sufficient.
> 
> So I am using get_cycles() to get the CPU cycles.
> 
> Now how do I convert it into the time interval?
> 
> Do I have to divide it by "cpu_khz" variable? Or
> some other method?
> Is yes, what will be the unit of the result (time
> interval)? nsec/usec/msec?
> 
> e.g. get_cycles()/cpu_khz (unit?)
> 
> Or Is there more simpler method exist?
> 
> Regards,
> Parav Pandit
> 
> 
>       
> --
> 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/


      

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-30  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-30  7:01 Calculating time in order of 0.1usec on x86 system Parav Pandit
2008-09-30  9:37 ` Parav Pandit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox