Closed Bug 604761 Opened 14 years ago Closed 13 years ago

Improve rdtsc support in the JavaScript engine

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file, 1 obsolete file)

There are occasional calls to rdtsc() in the JS engine. It's a useful function for performance work. On my machine, it's about 10x faster than gettimeofday (which PRMJ_Now uses under Linux). It would be nice to be able to use rdtsc more. Unfortunately, the definition is squirreled away in nanojit code. Also, the interpretation of the result depends on CPU frequency.
Attached patch patch (obsolete) — Splinter Review
This code moves the definition of rdtsc to a new header and renames it to something js-friendly. It also adds some calibration code that measures the ratio between rdtsc-time and wallclock time (as measured by PRMJ_Now). Finally, it patches jsgcstats to use the normalized times (rather than just dividing by 10e6).
Assignee: general → wmccloskey
Status: NEW → ASSIGNED
Attached patch updated patchSplinter Review
This patch adds an Accounting class that Shaver had that looks pretty nice.
Attachment #483595 - Attachment is obsolete: true
How are we handling cross-processor rdtsc skew, if at all?
(In reply to comment #3)
> How are we handling cross-processor rdtsc skew, if at all?

Not at all. Usually I only use rdtsc for very short-running things, so migration is unlikely. Also, I don't know of any way to fix this besides pinning to a particular CPU.
I was looking to use it around "script execution", which might be long enough to migrate if it has to page memory.  (Mind, I think that if there is "page something in" in the counted time, the error from cross-processor skew is unlikely to dominate.)

Chromium has a timer-duration class that has all manner of complication for different Windows setups etc.
Bill, is this still wanted?
I guess we don't need this.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.