| |
- __builtin__.object
-
- TimelineInteractionRecord
- exceptions.Exception(exceptions.BaseException)
-
- ThreadTimeRangeOverlappedException
-
- NoThreadTimeDataException
class TimelineInteractionRecord(__builtin__.object) |
|
Represents an interaction that took place during a timeline recording.
As a page runs, typically a number of different (simulated) user interactions
take place. For instance, a user might click a button in a mail app causing a
popup to animate in. Then they might press another button that sends data to a
server and simultaneously closes the popup without an animation. These are two
interactions.
From the point of view of the page, each interaction might have a different
label: ClickComposeButton and SendEmail, for instance. From the point
of view of the benchmarking harness, the labels aren't so interesting as what
the performance expectations are for that interaction: was it loading
resources from the network? was there an animation?
Determining these things is hard to do, simply by observing the state given to
a page from javascript. There are hints, for instance if network requests are
sent, or if a CSS animation is pending. But this is by no means a complete
story.
Instead, we expect pages to mark up the timeline what they are doing, with
label and flags indicating the semantics of that interaction. This
is currently done by pushing markers into the console.time/timeEnd API: this
for instance can be issued in JS:
var str = 'Interaction.SendEmail';
console.time(str);
setTimeout(function() {
console.timeEnd(str);
}, 1000);
When run with perf.measurements.timeline_based_measurement running, this will
then cause a TimelineInteractionRecord to be created for this range with
all metrics reported for the marked up 1000ms time-range.
The valid interaction flags are:
* repeatable: Allows other interactions to use the same label |
|
Methods defined here:
- GetBounds(*args, **kwargs)
- GetOverlappedThreadTimeForSlice(self, timeline_slice)
- Get the thread duration of timeline_slice that overlaps with this record.
There are two cases :
Case 1: timeline_slice runs in the same thread as the record.
| [ timeline_slice ]
THREAD 1 | | |
| record starts record ends
(relative order in thread time)
As the thread timestamps in timeline_slice and record are consistent, we
simply use them to compute the overlap.
Case 2: timeline_slice runs in a different thread from the record's.
|
THREAD 2 | [ timeline_slice ]
|
|
THREAD 1 | | |
| record starts record ends
(relative order in wall-time)
Unlike case 1, thread timestamps of a thread are measured by its
thread-specific clock, which is inconsistent with that of the other
thread, and thus can't be used to compute the overlapped thread duration.
Hence, we use a heuristic to compute the overlap (see
_GetOverlappedThreadTimeForSliceInDifferentThread for more details)
Args:
timeline_slice: An instance of telemetry.timeline.slice.Slice
- __init__(self, label, start, end, async_event=None, flags=None)
- __repr__(self)
Class methods defined here:
- FromAsyncEvent(cls, async_event) from __builtin__.type
- Construct an timeline_interaction_record from an async event.
Args:
async_event: An instance of
telemetry.timeline.async_slices.AsyncSlice
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- end
- label
- repeatable
- start
| |