From: george anzinger <george@mvista.com>
To: Michael Reinelt <reinelt@eunet.at>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: nanosleep question
Date: Sat, 10 Mar 2001 02:03:03 -0800 [thread overview]
Message-ID: <3AA9FBD7.A3EDD325@mvista.com> (raw)
In-Reply-To: <3AA607E7.6B94D2D@eunet.at> <3AA936B2.D2F26847@mvista.com> <3AA9D575.1345EF2@eunet.at>
Michael Reinelt wrote:
>
> george anzinger wrote:
> >
> > Michael Reinelt wrote:
> > >
> > > At the moment I implemented by own delay loop using a small assembler
> > > loop similar to the one used in the kernel. This has two disadvantages:
> > > assembler isn't that portable, and the loop has to be calibrated.
> >
> > Why not use C? As long as you calibrate it, it should do just fine.
> Because the compiler might optimize it away.
Not if you use volatile on the data type.
>
> > On
> > the other hand, since you are looping anyway, why not loop on a system
> > time of day call and have the loop exit when you have the required time
> > in hand. These calls have microsecond resolution.
> I'm afraid they don't (at least with kernel 2.0, I didn't try this with
> 2.4).
Gosh, I started with 2.2.14 and it does full microsecond resolution.
They have microsecond resolution, but increment only every 1/HZ.
>
> Someone gave me a hint to loop on rdtsc. I will look into this.
This ticks at 1/"cpu MHz", which can be found by: "cat /proc/cpuinfo"
>
> > > - why are small delays only possible up to 2 msec? what if I needed a
> > > delay of say 5msec? I can't get it?
> >
> > If you want other times, you can always make more than one call to
> > nanosleep.
> Good point!
~snip~
George
next prev parent reply other threads:[~2001-03-10 10:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-07 10:05 nanosleep question Michael Reinelt
2001-03-09 20:01 ` george anzinger
2001-03-10 7:19 ` Michael Reinelt
2001-03-10 10:03 ` george anzinger [this message]
2001-03-11 11:20 ` Michael Reinelt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3AA9FBD7.A3EDD325@mvista.com \
--to=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reinelt@eunet.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox