Last Comment Bug 55675 - Mac NSPR should not calls Microseconds for thread scheduling
: Mac NSPR should not calls Microseconds for thread scheduling
Status: RESOLVED WONTFIX
:
Product: NSPR
Classification: Components
Component: NSPR (show other bugs)
: 4.0.2
: PowerPC Mac System 8.5
: P2 normal (vote)
: 4.2
Assigned To: Simon Fraser
: Wan-Teh Chang
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2000-10-07 13:32 PDT by Simon Fraser
Modified: 2003-01-27 11:18 PST (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Patch to replace Microseconds() call by UpTime() (1.27 KB, patch)
2001-02-15 18:52 PST, Simon Fraser
no flags Details | Diff | Splinter Review
Patched with fixed spacing (1.29 KB, patch)
2001-02-15 18:53 PST, Simon Fraser
no flags Details | Diff | Splinter Review

Description Simon Fraser 2000-10-07 13:32:54 PDT
_MD_GetInterval() on Mac calls Microseconds()

http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/src/md/mac/mactime.c#234

and Microseconds is known to have some performance and accuracy problems:

http://developer.apple.com/technotes/tn/tn1063.html#Microseconds

We should use UpTime() instead.
Comment 1 Wan-Teh Chang 2000-10-09 21:57:44 PDT
Simon, please advise on when this bug needs to be fixed.
Thanks.
Comment 2 Simon Fraser 2001-02-15 18:50:19 PST
I collected some data on this, and have a patch.

Using the current Microseconds call, which is a 68k call, the average time spent 
in _MD_GetInterval() is 8.48ms. Changing that to use UpTime() and 
AbsoluteToNanoseconds() reduces the average time in this call to 2.83ms.

I actually think we should change the NSPR timing implementation (PR_IntervalNow, 
PR_MillisecondsToInterval and friends) to use more of the Multiprocessing and 
Driver Services APIs under the hood, since these provide efficient absolute time 
and time interval APIs.
Comment 3 Simon Fraser 2001-02-15 18:52:20 PST
Created attachment 25405 [details] [diff] [review]
Patch to replace Microseconds() call by UpTime()
Comment 4 Simon Fraser 2001-02-15 18:53:52 PST
Created attachment 25406 [details] [diff] [review]
Patched with fixed spacing
Comment 5 Simon Fraser 2001-02-16 08:07:57 PST
Those times I gave above are of course microseconds, not milliseconds
Comment 6 Kathleen Brade 2001-02-20 11:27:12 PST
I tried this patch and kept landing in macsbug (dsFSErr) and had to reboot my 
Mac.  I'm running OS 9.1.  I did try running other TCP/IP apps before mozilla but 
I still couldn't get past the profile picker dismissal.
Comment 7 Simon Fraser 2001-02-20 11:37:50 PST
brade: did you try just this patch, or this and the MP Task one? I'd be surprised 
if just this one caused dsFSErrs.
Comment 8 Kathleen Brade 2001-02-20 13:56:21 PST
sorry; my previous comment was intended for the other bug... I'll copy it over.

I haven't seen any errors attributable to this patch yet.
Comment 9 Wan-Teh Chang 2001-03-01 21:01:00 PST
Assigned the bug to Steve.
Comment 10 Jo Hermans 2001-06-16 03:27:48 PDT
Any progress on this improvement ? It might seems something very small to a non-
Mac developer, but I can assure you that it makes a huge difference. I used the 
same trick in my driver for an ADSL modem (not yet announced, so don't ask me for 
details).
Comment 11 Kathleen Brade 2001-10-24 11:04:06 PDT
What is the status of this bug (besides "sdagley is on sabbatical"); can we check 
it in or is it insufficient or ?
Comment 12 Simon Fraser 2001-10-24 11:26:35 PDT
Fixing this would make a very minor performance difference (probably below the 
noise).
Comment 13 thebeastwitheyesthatstared 2003-01-25 10:22:28 PST
what is the current status on this? Is this something that is still an issue?
(trying to help focus)

Would I be remembering wrong, if I said that, I remembered reading next 
releases of Mozilla wouldn´t be supported pre 9.0? I guess my next question 
would be, are older versions of Mozilla supported still?
Comment 14 Simon Fraser 2003-01-27 11:18:12 PST
No longer relevant since we don't care about CFM.

Note You need to log in before you can comment on or make changes to this bug.