On Tue, Jul 13, 2010 at 09:34:50PM +0800, Samuel Xu wrote:
> Hi, Cascardo:
> Thanks for reply! I just want to get the guide on some sample code of
> HPET usage invoked from kernel mode driver.
> Any directly guide?
> Thanks!
> 

You asked if this is the right API. And the answer depends on what do
you want to use it for.

Do you want to count CPU cycles for the purpose of performance analysis?
Take a look at perf!

Do you need to keep track of time to communicate with some
soft-real-time device (like audio devices)? Use hrtimers.

Do you want a piece of software that only works on PCs that have HPET
device available without any given reason? I can't help you more than
pointing you to Documentation/timers/hpet.txt, which does not point to
an API. So you are better off reading source code. hpet_readl is not
exported. Try 'grep EXPORT arch/x86/kernel/hpet.c'.

Regards,
Cascardo.

> 2010/7/13 Thadeu Lima de Souza Cascardo <[email protected]>:
> > On Tue, Jul 13, 2010 at 05:39:11PM +0800, Samuel Xu wrote:
> >> I tried hpet_readl() from my driver code, while hit compiling error.
> >> is it a correct API for kernel driver to invoke? any more hint?
> >>
> >
> > What are you trying to do exactly? Using TSC or HPET is not
> > platform-independent. You may take a look at hrtimers.
> >
> > Regards,
> > Cascardo.
> >
> >> 2010/7/13 Samuel Xu <[email protected]>:
> >> > HI:
> >> > I am a freshman for HPET timer. Previously, I use TSC counter, to use
> >> > rdtsc to get the time stamp. elapsed cycle can be counter from 2 time
> >> > stamps.
> >> > As a advanced replacement of TSC, I suppose HPET timer can be
> >> > conveniently to read time stamp from both kernel mode user  and user
> >> > mode apps.
> >> > While I failed to find a way to get time stamp value of HPET in Linux
> >> > kenerl (I am doing a driver and want to know elapsed cycle from driver
> >> > code).
> >> >
> >> > Anyone can help me?
> >> >
> >> > Thanks!
> >> >
> >> > Samuel
> >> >
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe 
> >> platform-driver-x86" in
> >> the body of a message to [email protected]
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.10 (GNU/Linux)
> >
> > iQIcBAEBAgAGBQJMPGVTAAoJEEWxSg7udFZIZHoQAKj0xOvvtE5pEZqau1OnFz1t
> > q15VC2q/OYQRRjAT5kRFEfWk7NcCaJmw4Y0TdrOjEW9YpYnZARksH2UwFA8myf9g
> > WOUpRe0o3HcuiutlxB321bI7mpJLHAaxpFwB8/10iXGjrH0LUQeOWkNo5smd9RQK
> > 1WfQ6BVEOqeyfY9ISnwzqhZQMu3AG0DbqnZQe6QtvE4Epg4L8ZeROL1piJqLGtlv
> > IGQ4fn+Pdu9+VXpmVl4Uzc/bLF1j2HTTKwwHO0KHTYZty40K8NnbCPJJp00KTfnN
> > TYVdEEgWzvIrJmB7hlrdl5gmjs9KYmOe3lpkRdotCzca9VNxFLvyi6ogkE/qiLpY
> > Au8wts22+qikxAkHdDfFdlnYAiiguGCJvku2usCtkEbTxsYWHKp/maP8xcNDE52H
> > HHwKmkKuYA/m+ML7kKmE7goDHjFvG0SZcm8Gjj4ghxbobhzQ6XGxzsGpJ9GwYz/E
> > JqAiqob3lD8TljWXPGN839pi0KHBivH71p9UoCC856G3GL4nXahsBSwMMg3KWj5i
> > avvQSCR838LK7qesKYak3xgjmLl9vRWVQwbx1vIlgjpOsBnmhUttUOKFy1eb4THz
> > EX080354M5mVfXsoiDVqUy3W5PwL1Yna9AaMVk+05lKg6OR/b0cMC6PFocGkgxRM
> > Okd0gXuUGv5IIy38UGSO
> > =BMoU
> > -----END PGP SIGNATURE-----
> >
> >

Attachment: signature.asc
Description: Digital signature

Reply via email to