By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

Time.sleep(0.0125) not available within Linux

P: n/a
To All,
I was wondering if anyone has come across the issue of not being allowed
to have the following within a Python script operating under Linux:

time.sleep(0.0125)

It appears that I am not allowed to have the object sleep. Has anyone
encountered this specific issue before in the past?
Thank You,
David Blubaugh



This e-mail transmission contains information that is confidential and may be
privileged. It is intended only for the addressee(s) named above. If you receive
this e-mail in error, please do not read, copy or disseminate it in any manner.
If you are not the intended recipient, any disclosure, copying, distribution or
use of the contents of this information is prohibited. Please reply to the
message immediately by informing the sender that the message was misdirected.
After replying, please erase it from your computer system. Your assistance in
correcting this error is appreciated.

Sep 23 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
On 2008-09-23, Blubaugh, David A. <db*******@belcan.comwrote:
I was wondering if anyone has come across the issue of not being allowed
to have the following within a Python script operating under Linux:

time.sleep(0.0125)
No, I have not. And I doubt anybody else has.
It appears that I am not allowed to have the object sleep.
It doesn't appear that way to me. Care to explain how you
arrived at that conclusion?
Has anyone encountered this specific issue before in the past?
$ python
Python 2.5.2 (r252:60911, Aug 28 2008, 15:54:48)
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>import time
time.sleep(0.0125)
The above code has worked as far back as I can recall (which I
think includes Python 1.4).

--
Grant

Sep 23 '08 #2

P: n/a
In message <__******************************@posted.usinterne t>, Grant
Edwards wrote:
On 2008-09-23, Blubaugh, David A. <db*******@belcan.comwrote:
>I was wondering if anyone has come across the issue of not being allowed
to have the following within a Python script operating under Linux:

time.sleep(0.0125)

No, I have not. And I doubt anybody else has.
Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

and search for the value of the "CONFIG_HZ" setting. On the Athlon 64
machine I'm using to write this, it's 250, which should allow for sleep
intervals in multiples of 0.004 seconds.
Sep 24 '08 #3

P: n/a
On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?

--
Steven
Sep 25 '08 #4

P: n/a
In message <00**********************@news.astraweb.com>, Steven D'Aprano
wrote:
On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
>Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?
The one named in the subject line?
Sep 26 '08 #5

P: n/a
On Fri, 26 Sep 2008 19:46:10 +1200, Lawrence D'Oliveiro wrote:
In message <00**********************@news.astraweb.com>, Steven D'Aprano
wrote:
>On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
>>Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?

The one named in the subject line?
Are you asking me or telling me?
I've tried on five different Linux machines I have access to, and there
is no such /proc/config.gz on any of them:

two different versions of Centos
two versions of Fedora
one version of Ubuntu

So let me rephrase my question... what *specific* OS are you using?

--
Steven
Sep 26 '08 #6

P: n/a
In message <pa*********************@REMOVE.THIS.cybersource.c om.au>, Steven
D'Aprano wrote:
On Fri, 26 Sep 2008 19:46:10 +1200, Lawrence D'Oliveiro wrote:
>In message <00**********************@news.astraweb.com>, Steven D'Aprano
wrote:
>>On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:

Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?

The one named in the subject line?

Are you asking me or telling me?
I've tried on five different Linux machines I have access to, and there
is no such /proc/config.gz on any of them:

two different versions of Centos
two versions of Fedora
one version of Ubuntu

So let me rephrase my question... what *specific* OS are you using?
<http://lxr.linux.no/linux+v2.6.26.5/kernel/configs.c#L82>
Sep 26 '08 #7

P: n/a
jkn
On Sep 26, 9:26 am, Steven D'Aprano
<ste...@REMOVE.THIS.cybersource.com.auwrote:
On Fri, 26 Sep 2008 19:46:10 +1200, Lawrence D'Oliveiro wrote:
In message <00eb2560$0$20666$c3e8...@news.astraweb.com>, Steven D'Aprano
wrote:
On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
>Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type
> less /proc/config.gz
$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?
The one named in the subject line?

Are you asking me or telling me?

I've tried on five different Linux machines I have access to, and there
is no such /proc/config.gz on any of them:
/proc/config.gz is not directly connected with a specific linux
distribution; it's a function of the kernel build configuration. If
the appropriate setting is enabled, then /proc/config.gz will show
(via eg. zcat) the equivalent of the .config file used to build the
kernel you are actually running. It's a useful feature in all linuces,
going back quite a way IIRC.

J^n
Sep 26 '08 #8

P: n/a
On 2008-09-26, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealandwrote:
In message <00**********************@news.astraweb.com>, Steven D'Aprano
wrote:
>On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
>>Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
What OS are you using?

The one named in the subject line?
Never assume somebody reading the article and attempting to
help you can see the subject line.

--
Grant Edwards grante Yow! I'm encased in the
at lining of a pure pork
visi.com sausage!!
Sep 26 '08 #9

P: n/a
helllo,

On Fri, Sep 26, 2008 at 3:46 PM, Lawrence D'Oliveiro
<ld*@geek-central.gen.new_zealandwrote:
In message <00**********************@news.astraweb.com>, Steven D'Aprano
wrote:
>On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote:
>>Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

$ less /proc/config.gz
/proc/config.gz: No such file or directory
or: less /boot/config-`uname -r`
>>
What OS are you using?

The one named in the subject line?
--
http://mail.python.org/mailman/listinfo/python-list


--
edel
Sep 26 '08 #10

P: n/a
In message <Qt******************************@posted.visi>, Grant Edwards
wrote:
Never assume somebody reading the article and attempting to
help you can see the subject line.
Why not?
Sep 26 '08 #11

P: n/a
On 2008-09-26, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealandwrote:
In message <Qt******************************@posted.visi>, Grant Edwards
wrote:
>Never assume somebody reading the article and attempting to
help you can see the subject line.

Why not?
Because it might not be. It depends on the user's newsreader
and editor settings. Assuming the reader can't see the subject
line while reading the article has been one of the basic rules
of Usenet posting for decades. At least that's what I've
always been told: make sure the body of a posting contains
sufficient information to answer the question.

--
Grant

Sep 27 '08 #12

P: n/a
In message <dZ******************************@posted.usinterne t>, Grant
Edwards wrote:
On 2008-09-26, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand>
wrote:
>In message <Qt******************************@posted.visi>, Grant Edwards
wrote:
>>Never assume somebody reading the article and attempting to
help you can see the subject line.

Why not?

Because it might not be. It depends on the user's newsreader
and editor settings.
So, should I not assume that they can see the content as well, because it
might not be visible, depending on the user's newsreader and editor
settings?
Sep 27 '08 #13

P: n/a
On 2008-09-27, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealandwrote:
In message <dZ******************************@posted.usinterne t>, Grant
Edwards wrote:
>On 2008-09-26, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand>
wrote:
>>In message <Qt******************************@posted.visi>, Grant Edwards
wrote:

Never assume somebody reading the article and attempting to
help you can see the subject line.

Why not?

Because it might not be. It depends on the user's newsreader
and editor settings.

So, should I not assume that they can see the content as well,
because it might not be visible, depending on the user's
newsreader and editor settings?
Thats seems like a bit of reductio ad absurdum. My
observations over the years confirm the advice that you
shouldn't place information solely in the subject line. If you
rely on people re-reading the subject line as the read and
reply to the body of the posting, you'll often get bad results.
People will miss information that was left out of the body and
placed solely in the subject line. I've seen it happen over an
over again (this thread is an example).

If you don't care whether you get timely and accurate
responses, then do whatever you want. Otherwise, include all
the pertinent information in the body of the posting.

--
Grant

Sep 27 '08 #14

P: n/a
En Sat, 27 Sep 2008 01:46:45 -0300, Lawrence D'Oliveiro
<ld*@geek-central.gen.new_zealandescribió:
In message <dZ******************************@posted.usinterne t>, Grant
Edwards wrote:
>On 2008-09-26, Lawrence D'Oliveiro <ld*@geek-central.gen.new_zealand>
wrote:
>>In message <Qt******************************@posted.visi>, Grant
Edwards wrote:

Never assume somebody reading the article and attempting to
help you can see the subject line.

Why not?

Because it might not be. It depends on the user's newsreader
and editor settings.

So, should I not assume that they can see the content as well, because it
might not be visible, depending on the user's newsreader and editor
settings?
Of course not. But the space allowed for the subject line may be limited -
body usually wraps, but subject might not. Add a few Re: Rv: at the start
and even fewer characters are displayed.
I currently see the subject line shortened at: available wi...

--
Gabriel Genellina

Sep 30 '08 #15

P: n/a
Lawrence D'Oliveiro wrote:
In message <__******************************@posted.usinterne t>, Grant
Edwards wrote:
>On 2008-09-23, Blubaugh, David A. <db*******@belcan.comwrote:
>>I was wondering if anyone has come across the issue of not being allowed
to have the following within a Python script operating under Linux:

time.sleep(0.0125)
No, I have not. And I doubt anybody else has.

Just a thought, your minimum sleep time is probably limited by the
resolution of the system "HZ" clock. Type

less /proc/config.gz

and search for the value of the "CONFIG_HZ" setting. On the Athlon 64
machine I'm using to write this, it's 250, which should allow for sleep
intervals in multiples of 0.004 seconds.
Since most distributions do not create this file in /proc for whatever
reason, and some people are being deliberately obtuse, does anyone know
how to ask the kernel what the timer resolution is? Is it stored
anywhere else in /proc or /sys? I kind of think most distros set it to
1000 Hz, but I'm not sure.


Sep 30 '08 #16

P: n/a
On 2008-09-30, Michael Torrie <to*****@gmail.comwrote:
>Just a thought, your minimum sleep time is probably limited by
the resolution of the system "HZ" clock. Type

less /proc/config.gz

and search for the value of the "CONFIG_HZ" setting. On the
Athlon 64 machine I'm using to write this, it's 250, which
should allow for sleep intervals in multiples of 0.004
seconds.

Since most distributions do not create this file in /proc for whatever
reason,
It's also common to put a copy of the config file in /boot (or
wherever the kernel binaries are installed). I prefer the
/proc/config.gz setup myself, and that's how I configure all my
systems.
and some people are being deliberately obtuse, does anyone
know how to ask the kernel what the timer resolution is? Is
it stored anywhere else in /proc or /sys? I kind of think
most distros set it to 1000 Hz, but I'm not sure.
We could look in /usr/include:

$ grep -r ' HZ ' /usr/include
/usr/include/scsi/sg.h:#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */
/usr/include/linux/ixjuser.h:* IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in
/usr/include/linux/n_r3964.h: * Fixed HZ usage on 2.6 kernels
/usr/include/asm/param.h:#define HZ 100

But, I happen to know that's wrong and I'm running a kernel with HZ=250.

So let's look elsewhere. How about in /proc/sys/kernel?

$ cat /proc/sys/kernel/sched_min_granularity_ns
4000000

That looks suspiciously like 1/HZ in nanoseconds.

--
Grant
Oct 1 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.