Skip to contentSkip to conversation

Question about cpu time accuracy.

DISCUSSION Jennifer Huang 3 participants 4 messages May 12, 2002 – May 13, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a question about cpu time accuracy.

I am using kernel 2.4.18. But, when I tried "utime" and "nanosleep" to get a process suspended, it only worked in 10ms granularity, and it's no way to sleep for 1 microsecond.

Anyone can help me out of this?
Thanks in advance,

-Jenny

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

#1 lore raw

Scribbling feverishly on May 12, Jennifer Huang managed to emit:

Quoted 8 lines

Hi all,

I have a question about cpu time accuracy.

I am using kernel 2.4.18. But, when I tried "utime" and "nanosleep" to get a process suspended, it only worked in 10ms granularity, and it's no way to sleep for 1 microsecond.

The standard kernel timer has a resolution of 1/HZ, which is 10ms on an x86. You could try a scheduling policy of SCHED_FIFO or SCHED_RR, but this only gets you 2ms resolution.

Quoted 1 line

Anyone can help me out of this?

There are patches available for high resolution timers:

http://sourceforge.net/projects/high-res-timers/
http://www.cs.wisc.edu/paradyn/libhrtime/

Kurt

Signature · 2 lines
Anarchy may not be the best form of government, but it's better than no
government at all.
#2 lore raw

Thanks very much for your information.

Just one more question, does it work for 2.4.18?
Thanks.

Quoted 22 lines · --- Kurt Wall

Scribbling feverishly on May 12, Jennifer Huang managed to emit:

Quoted 5 lines

Hi all,

I have a question about cpu time accuracy.

I am using kernel 2.4.18. But, when I tried

"utime"

Quoted 1 line

and "nanosleep" to get a process suspended, it

only

Quoted 1 line

worked in 10ms granularity, and it's no way to

sleep

Quoted 1 line

for 1 microsecond.

The standard kernel timer has a resolution of 1/HZ, which is 10ms on
an x86. You could try a scheduling policy of SCHED_FIFO or SCHED_RR,
but this only gets you 2ms resolution.

Quoted 1 line

Anyone can help me out of this?

Quoted 18 lines

There are patches available for high resolution timers:

http://sourceforge.net/projects/high-res-timers/
http://www.cs.wisc.edu/paradyn/libhrtime/

Kurt

Signature · 10 lines
Anarchy may not be the best form of government, but
it's better than no
government at all.
-
To unsubscribe from this list: send the line
"unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at 
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

#3 lore raw

Re: Question about cpu time accuracy. Er resolution!

Quoted 4 lines · Jennifer Huang

Thanks very much for your information.

Just one more question, does it work for 2.4.18?

Uh, thats what you are there for :) Let me know what you find out.

Signature · 4 lines
George Anzinger   [email protected]
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml