[Patches] [ python-Patches-645894 ] better timer resolution for profile.py

SourceForge.net noreply at sourceforge.net
Thu Mar 3 12:40:43 CET 2005


Patches item #645894, was opened at 2002-11-30 01:17
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645894&group_id=5470

Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: John-Mark Gurney (jmg)
Assigned to: Nobody/Anonymous (nobody)
Summary: better timer resolution for profile.py

Initial Comment:
On some platforms time.clock() does not return a high
resolution counter.  On FreeBSD, it's resolution is
only 1/128th of a second.  In order to get microsecond
accuracy, the getrusage syscall from resource needs to
be used.

Attached is a patch that uses getrusage from the
resource library in preference of os.clock.

This was done on behalf of Vernier Networks, Inc.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2005-03-03 12:40

Message:
Logged In: YES 
user_id=21627

I believe getrusage is always the better choice, as clock()
wraps around after 36 minutes on a POSIX system. Committed as

profile.py 1.62
NEWS 1.1258


----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-02-23 19:28

Message:
Logged In: YES 
user_id=1188172

If this leads to better resolution on FreeBSD, it seems like
a good idea. However, if you don't know about other OS, what
about restricting the patch to FreeBSD?

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-07-06 22:28

Message:
Logged In: YES 
user_id=357491

Is there any possibility that using this could lead to worse timing 
under another OS?

And I assume this is still an issue under FreeBSD 5.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=645894&group_id=5470


More information about the Patches mailing list