Networking Forums

Networking Forums > Computer Networking > Linux Networking > Implementation of High Precision Timer

Reply
Thread Tools Display Modes

Implementation of High Precision Timer

 
 
bieradler@gmx.de
Guest
Posts: n/a

 
      01-01-2009, 10:30 PM
Hello,

I need to implement a high precision timer for a network driver. I
need high resolution like µs or even ns - so much more presision than
using jiffies. Unfortunately I can't find some code examples for
implementing it in kernel mode.

Can anybody help me with this - send me code examples or give me some
useful links ?

Thanks a lot!

Thilo
 
Reply With Quote
 
 
 
 
Unruh
Guest
Posts: n/a

 
      01-02-2009, 05:13 AM
(E-Mail Removed) writes:

>Hello,


>I need to implement a high precision timer for a network driver. I
>need high resolution like =B5s or even ns - so much more presision than
>using jiffies. Unfortunately I can't find some code examples for
>implementing it in kernel mode.


You cannot do it. There are far too many thngs in a multitasking operating
system which can vary the response time of the system. A few usec is
possible, but hard. Better than that I do ot think so.
If you want to build a hardware clock then maybe it is possible.

Now perhaps if you told us what theproblem was rather than how you were
going to solve theproblem someone could give some advice as to how to do
it.


>Can anybody help me with this - send me code examples or give me some
>useful links ?


>Thanks a lot!


>Thilo

 
Reply With Quote
 
Boon
Guest
Posts: n/a

 
      01-02-2009, 11:42 AM
bieradler wrote:

> I need to implement a high precision timer for a network driver. I
> need high resolution like µs or even ns - so much more presision than
> using jiffies. Unfortunately I can't find some code examples for
> implementing it in kernel mode.


Linux Device Drivers, Third Edition
http://lwn.net/Kernel/LDD3/

Chapter 7: Time, Delays, and Deferred Work
http://lwn.net/images/pdf/LDD3/ch07.pdf

Real-Time Linux Wiki
http://rt.wiki.kernel.org/index.php/Main_Page

hrtimers (already in mainline)
http://www.tglx.de/hrtimers.html

Regards.
 
Reply With Quote
 
Boon
Guest
Posts: n/a

 
      01-02-2009, 11:44 AM
Boon wrote:

> bieradler wrote:
>
>> I need to implement a high precision timer for a network driver. I
>> need high resolution like µs or even ns - so much more presision than
>> using jiffies. Unfortunately I can't find some code examples for
>> implementing it in kernel mode.

>
> Linux Device Drivers, Third Edition
> http://lwn.net/Kernel/LDD3/
>
> Chapter 7: Time, Delays, and Deferred Work
> http://lwn.net/images/pdf/LDD3/ch07.pdf
>
> Real-Time Linux Wiki
> http://rt.wiki.kernel.org/index.php/Main_Page
>
> hrtimers (already in mainline)
> http://www.tglx.de/hrtimers.html


http://elinux.org/High_Resolution_Timers
 
Reply With Quote
 
bieradler@gmx.de
Guest
Posts: n/a

 
      01-02-2009, 03:40 PM
Hello thanks for your help!

Some more information about my problem, so maybe someone has the right
solution for my problem:

I need to program a driver for a hardware device which doesn't support
interrupts. So i have to periodically poll the register contents of
the device (connected via PCI). At the moment I use a timer therfore
which is based on jiffies - but is much to slow. The polling cycles
are about 2-4 ms.

I looked at the PTPD protocol which uses high resolution timers. But I
can't use this code in kernel space.

So if anybody use an idea i would be very pleased!!!

thanks a lot!
 
Reply With Quote
 
Boon
Guest
Posts: n/a

 
      01-02-2009, 04:23 PM
bieradler wrote:

> I need to program a driver for a hardware device which doesn't support
> interrupts. So i have to periodically poll the register contents of
> the device (connected via PCI). At the moment I use a timer therfore
> which is based on jiffies - but is much to slow. The polling cycles
> are about 2-4 ms.


If you set HZ to 1000, then the PIT will fire every millisecond.

I've played with the -hrt infrastructure on x86. My app would sleep
for 250 microseconds, then wake up, in an infinite loop.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer Issue with DD-WRT v23SP2 wm_walsh@hotmail.com Wireless Internet 0 05-10-2007 01:45 PM
Timer RP Wireless Networks 1 12-15-2006 12:33 AM
Overecoming persist timer vishal.study@gmail.com Linux Networking 0 06-09-2006 06:47 PM
BK Precision Frequency counter - does it work? Zoltan Lazar Wireless Internet 7 07-17-2004 03:23 AM
precision 350 gigabit adapter CSA? Rob Windows Networking 0 12-27-2003 07:32 AM



1 2 3 4 5 6 7 8 9 10 11