Closed Bug 1013601 Opened 11 years ago Closed 11 years ago

Add uptimeMillis() to UITelemetry.jsm for getting current timestamp

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 32

People

(Reporter: liuche, Assigned: liuche)

References

Details

Attachments

(2 files)

No description provided.
Assignee: nobody → liuche
Status: NEW → ASSIGNED
Attachment #8425912 - Flags: review?(rnewman)
Blocks: 979443
Comment on attachment 8425912 [details] [diff] [review] Part 1: handle timestamp in UITelemetry Review of attachment 8425912 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/telemetry/UITelemetry.jsm @@ +83,5 @@ > * and should be registered with addSimpleMeasureFunction. > */ > _simpleMeasureFunctions: {}, > > + _uptimeMillis: function() { Comment the hack! We're attempting to convert between two dissimilar timelines by using a single known point of intersection, and this will fail under clock corrections and pauses. @@ +107,5 @@ > type: "event", > action: aAction, > method: aMethod, > sessions: sessions, > + timestamp: aTimestamp || this._uptimeMillis(), These guards should probably be (aTimestamp == undefined) ? this._uptimeMillis() : aTimestamp Here's why: 0 == undefined false null == undefined true undefined == undefined true
Attachment #8425912 - Flags: review?(rnewman) → review+
Comment on attachment 8425913 [details] [diff] [review] Part 2: Change callers from generating timestamps Review of attachment 8425913 [details] [diff] [review]: ----------------------------------------------------------------- ::: mobile/android/chrome/content/aboutReader.js @@ -289,5 @@ > this._isReadingListItem = (this._isReadingListItem == 1) ? 0 : 1; > this._updateToggleButton(); > > - // Create a relative timestamp for telemetry > - let uptime = Date.now() - Services.startup.getStartupInfo().linkerInitialized; Keep this one, but make it call the utility function (and kill the comment). The timestamp is more accurate if it's computed prior to the storeArticleInCache callback. Furthermore, I don't think it's bad practice for callers to be specifying timestamps; by all means elide it in the simplest of cases, but this is not a concept I want to hide from developers adding probes -- it's a core concept.
Attachment #8425913 - Flags: review?(rnewman) → review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: Firefox 31 → Firefox 32
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: