Closed
Bug 972847
Opened 12 years ago
Closed 11 years ago
Characterize the time offset between profile slices and ammeter samples
Categories
(Powertool Graveyard :: Software, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jhylands, Assigned: jhylands)
References
Details
(Keywords: perf, Whiteboard: [c=power p=3 s= u=])
When using Benoit's patch in bug 928475, there is an approximate 40-50 ms offset in the millisecond counter between the ammeter timestamps and the profiler timestamps. Account for this time, and if possible, eliminate it in a way that is reasonable (i.e., not hacked or hard-coded).
Assignee | ||
Updated•12 years ago
|
Assignee | ||
Comment 1•12 years ago
|
||
After doing some analysis, I have determined that almost none of that offset is coming from the ammeter side of things. I added some pin-toggles to the ammeter code, and hooked up my logic analyzer while retrieving a sample, which allows me to measure the timings of the pin changes with sub-microsecond accuracy.
It takes about 7.75 ms to request and retrieve a sample from the ammeter. The timestamp for the sample is set between 0.2 and 0.45 ms from the end of this period.
Here's a timeline that illustrates what is happening:
Time 0 ms - (q)
- send packet from PC
Time 0 ms
- receive packet on AVR
- average 10 samples from A/D converter
- create sample from average
Time 7.3 ms
- set ms counter
- create response packet & send back
Time 7.5 ms
- receive data on PC
Time 7.5 ms + (r)
On my machine, (q) and (r) combined are ~0.25 ms.
Assignee | ||
Comment 2•12 years ago
|
||
I have to update the timeline, I mistakenly hit "Enter" which saved the changes before I was done:
Time 0 ms - (q)
- send packet from PC
Time 0 ms
- receive packet on AVR (ammeter)
- retrieve 10 readings from A/D converter
- create sample from average
Time 7.3 ms
- set ms counter
- create response packet & send back
Time 7.5 ms
- done on AVR (ammeter)
Time 7.5 ms + (r)
- received data on PC
On my machine, (q) and (r) combined are ~0.25 ms.
So this implies that the ammeter is only responsible for at most 3-4 ms of the time difference.
Assignee | ||
Updated•12 years ago
|
Whiteboard: [c=power p=2 s= u=] → [c=power p= s= u=]
Updated•12 years ago
|
Priority: -- → P2
Assignee | ||
Comment 3•11 years ago
|
||
So, it turns out the time difference was 50ms because the clocks for the phone and the desktop were more or less in sync (part of the normal flash process syncs the clocks). Today my phone clock is about 5 hours off, and the timestamps do not line up at all.
I talked to Benoit, and it looks like it was more or less depending on the two clocks being in sync. I'm going to add a piece to the profiler script that gets the timestamp from the phone, and calculates the offset properly to make sure the profiler timestamps are in sync with the ammeter timestamps.
Assignee | ||
Updated•11 years ago
|
Whiteboard: [c=power p= s= u=] → [c=power p=3 s= u=]
Assignee | ||
Comment 4•11 years ago
|
||
The code for this has been attached to bug 928475
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•