3 Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
8 <link rel="import" href="/tracing/trace_model/event.html">
9 <link rel="import" href="/tvcm/guid.html">
15 * @fileoverview Provides the TimedEvent class.
17 tvcm.exportTo('tracing.trace_model', function() {
19 * A TimedEvent is the base type for any piece of data in the trace model with
20 * a specific start and duration.
24 function TimedEvent(start) {
25 tracing.trace_model.Event.call(this);
30 TimedEvent.prototype = {
31 __proto__: tracing.trace_model.Event.prototype,
34 return this.start + this.duration;
37 addBoundsToRange: function(range) {
38 range.addValue(this.start);
39 range.addValue(this.end);
42 bounds: function(that) {
43 // Due to inaccuracy of floating-point calculation, the end times of
44 // slices from a B/E pair (whose end = start + original_end - start)
45 // and an X event (whose end = start + duration) at the same time may
46 // become not equal. Round back to micros (which is the source data
47 // precision) to ensure equality below.
48 var this_end_micros = Math.round(this.end * 1000);
49 var that_end_micros = Math.round(that.end * 1000);
50 return this.start <= that.start && this_end_micros >= that_end_micros;
55 TimedEvent: TimedEvent