Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / trace-viewer / src / tracing / trace_model / timed_event.js
index 3d20a60..1253880 100644 (file)
@@ -4,13 +4,13 @@
 
 'use strict';
 
-base.require('base.guid');
-base.require('tracing.trace_model.event');
+tvcm.require('tvcm.guid');
+tvcm.require('tracing.trace_model.event');
 
 /**
  * @fileoverview Provides the TimedEvent class.
  */
-base.exportTo('tracing.trace_model', function() {
+tvcm.exportTo('tracing.trace_model', function() {
   /**
    * A TimedEvent is the base type for any piece of data in the trace model with
    * a specific start and duration.
@@ -39,8 +39,11 @@ base.exportTo('tracing.trace_model', function() {
       // Due to inaccuracy of floating-point calculation, the end times of
       // slices from a B/E pair (whose end = start + original_end - start)
       // and an X event (whose end = start + duration) at the same time may
-      // become not equal. Tolerate 1us error.
-      return this.start <= that.start && this.end - that.end > -1e-6;
+      // become not equal. Round back to micros (which is the source data
+      // precision) to ensure equality below.
+      var this_end_micros = Math.round(this.end * 1000);
+      var that_end_micros = Math.round(that.end * 1000);
+      return this.start <= that.start && this_end_micros >= that_end_micros;
     }
   };