Closed Bug 580063 Opened 14 years ago Closed 14 years ago

functiontimer: report timestamp of latest event

Categories

(Core :: XPCOM, enhancement)

All
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: sfink, Assigned: sfink)

References

Details

Attachments

(1 file, 2 obsolete files)

For bug 558200, I want to be able to detect what function timer events have occurred within the execution scope of a Javascript call. If the function timer interface provided a way to get a very precise timestamp of the last reported event, then I could compare the timestamps of matching enter/exit pairs to see if it changed.

Attached is a patch that implements a NS_TIME_FUNCTION_LATEST that returns the TimeDuration since app startup.

I originally was thinking that I would use byte offsets within the function timer log file, but that would be even more racy than what's already there. Assuming the precision is high enough, the timestamps should be enough to find the exact points in the log.
Not sure why it rejected my attachment the first time.

Note that the reason why I want the TimeDuration rather than a TimeStamp is because I need to be able to generate printouts that can be exactly matched against function timer printouts, and those are relative to sAppStart.
Assignee: nobody → sphink
Status: NEW → ASSIGNED
Attachment #458451 - Flags: review?(vladimir)
Comment on attachment 458451 [details] [diff] [review]
Add NS_TIME_FUNCTION_LATEST for latest event timestamp

Looks fine, though I would call the Latest() method something that implies that it's a duration since startup.. LatestSinceStartup() is a bit wordy, but maybe something else.  Dunno.
Attachment #458451 - Flags: review?(vladimir) → review+
Ok, I renamed it to LatestSinceStartup and will blame you if anyone complains. I couldn't think of anything else to call it. LatestElapsed() sounded confusing to me. But I agree that it was weird having mLatest and Latest() return entirely different things.
Attachment #458451 - Attachment is obsolete: true
Try server shows all happy green.
Keywords: checkin-needed
Found a problem when using this. If no timer events have occurred when you first ask for the latest event time, it'll deref a null pointer.
Attachment #458493 - Attachment is obsolete: true
Attachment #461334 - Flags: review?(vladimir)
Requesting blocking2.0 (see also bug 507012) because it is very useful for performance profiling (eg what slow internal calls are invoked by this JS call -- see also bug 558200) and is low risk. This would be particularly helpful for mobile.
blocking2.0: --- → ?
This needs approval2.0 before it can land.
Component: General → XPCOM
Keywords: checkin-needed
QA Contact: general → xpcom
Comment on attachment 461334 [details] [diff] [review]
Retrieve latest event timestamp - avoid crash for early use

Whoops, I requesting blocking2.0 instead of approval2.0. Doh!
Attachment #461334 - Flags: approval2.0?
Attachment #461334 - Flags: approval2.0? → approval2.0+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/c5acd5e8f2a8
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b6
blocking2.0: ? → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: