Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: tracing/tracing/model/model.html

Issue 2016863004: Removed the isTimeHighResolutionHeuristic_ heuristic. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tracing/tracing/model/model_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/base.html"> 8 <link rel="import" href="/tracing/base/base.html">
9 <link rel="import" href="/tracing/base/event.html"> 9 <link rel="import" href="/tracing/base/event.html">
10 <link rel="import" href="/tracing/base/interval_tree.html"> 10 <link rel="import" href="/tracing/base/interval_tree.html">
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 this.userFriendlyCategoryDrivers_ = []; 97 this.userFriendlyCategoryDrivers_ = [];
98 98
99 this.annotationsByGuid_ = {}; 99 this.annotationsByGuid_ = {};
100 this.modelIndices = undefined; 100 this.modelIndices = undefined;
101 101
102 this.stats = new tr.model.ModelStats(); 102 this.stats = new tr.model.ModelStats();
103 103
104 this.importWarnings_ = []; 104 this.importWarnings_ = [];
105 this.reportedImportWarnings_ = {}; 105 this.reportedImportWarnings_ = {};
106 106
107 this.isTimeHighResolution_ = undefined; 107 this.isTimeHighResolution_ = true;
108 108
109 this.patchupsToApply_ = []; 109 this.patchupsToApply_ = [];
110 110
111 this.doesHelperGUIDSupportThisModel_ = {}; 111 this.doesHelperGUIDSupportThisModel_ = {};
112 this.helpersByConstructorGUID_ = {}; 112 this.helpersByConstructorGUID_ = {};
113 } 113 }
114 114
115 Model.prototype = { 115 Model.prototype = {
116 __proto__: tr.model.EventContainer.prototype, 116 __proto__: tr.model.EventContainer.prototype,
117 117
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 set intrinsicTimeUnit(value) { 387 set intrinsicTimeUnit(value) {
388 if (this.intrinsicTimeUnit_ === value) 388 if (this.intrinsicTimeUnit_ === value)
389 return; 389 return;
390 if (this.intrinsicTimeUnit_ !== undefined) 390 if (this.intrinsicTimeUnit_ !== undefined)
391 throw new Error('Intrinsic time unit already set'); 391 throw new Error('Intrinsic time unit already set');
392 this.intrinsicTimeUnit_ = value; 392 this.intrinsicTimeUnit_ = value;
393 }, 393 },
394 394
395 get isTimeHighResolution() { 395 get isTimeHighResolution() {
396 if (this.isTimeHighResolution_ === undefined)
397 this.isTimeHighResolution_ = this.isTimeHighResolutionHeuristic_();
398 return this.isTimeHighResolution_; 396 return this.isTimeHighResolution_;
399 }, 397 },
400 398
401 set isTimeHighResolution(value) { 399 set isTimeHighResolution(value) {
402 if (this.isTimeHighResolution_ === value)
403 return;
404 if (this.isTimeHighResolution_ !== undefined)
405 throw new Error('isTimeHighResolution already set');
406 this.isTimeHighResolution_ = value; 400 this.isTimeHighResolution_ = value;
407 }, 401 },
408 402
409 /** 403 /**
410 * Returns a link to a trace data file that this model was imported from. 404 * Returns a link to a trace data file that this model was imported from.
411 * This is NOT the URL of a site being traced, but instead an indicator of 405 * This is NOT the URL of a site being traced, but instead an indicator of
412 * where the data is stored. 406 * where the data is stored.
413 */ 407 */
414 get canonicalUrl() { 408 get canonicalUrl() {
415 return this.canonicalUrl_; 409 return this.canonicalUrl_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 this.patchupsToApply_ = unresolved; 560 this.patchupsToApply_ = unresolved;
567 }, 561 },
568 562
569 replacePIDRefsInPatchups: function(old_pid_ref, new_pid_ref) { 563 replacePIDRefsInPatchups: function(old_pid_ref, new_pid_ref) {
570 this.patchupsToApply_.forEach(function(patchup) { 564 this.patchupsToApply_.forEach(function(patchup) {
571 if (patchup.pidRef === old_pid_ref) 565 if (patchup.pidRef === old_pid_ref)
572 patchup.pidRef = new_pid_ref; 566 patchup.pidRef = new_pid_ref;
573 }); 567 });
574 }, 568 },
575 569
576 isTimeHighResolutionHeuristic_: function() {
577 if (this.intrinsicTimeUnit !== tr.v.TimeDisplayModes.ms)
578 return false;
579 // If the timer is only precise to the millisecond, then almost all event
580 // will be precisely X ms apart. We check that by looking at the
581 // decimal part of each event's start time. We create 100 bins for
582 // these fractions. If at least 90% of the events are in the same bin then
583 // the timer is deemed to be low resolution.
584 var nbEvents = 0;
585 var nbPerBin = [];
586 var maxEvents = 0;
587 for (var i = 0; i < 100; ++i)
588 nbPerBin.push(0);
589 this.iterateAllEvents(function(event) {
590 nbEvents++;
591 if (event.start !== undefined) {
592 // Compute
593 var remainder = Math.floor(
594 (event.start - Math.floor(event.start)) * 100);
595 nbPerBin[remainder]++;
596 maxEvents = Math.max(maxEvents, nbPerBin[remainder]);
597 }
598 });
599 // If there are too few events our heuristic is not very good, assume the
600 // timer is high resolution.
601 if (nbEvents < 100)
602 return true;
603 // If more than 90% of the events are snapped precisely on milliseconds
604 // boundary we got a trace with a low resolution timer.
605 return (maxEvents / nbEvents) < 0.9;
606 },
607
608 /** 570 /**
609 * Called by the model to join references between objects, after final model 571 * Called by the model to join references between objects, after final model
610 * bounds have been computed. 572 * bounds have been computed.
611 */ 573 */
612 joinRefs: function() { 574 joinRefs: function() {
613 this.joinObjectRefs_(); 575 this.joinObjectRefs_();
614 this.applyObjectRefPatchups(); 576 this.applyObjectRefPatchups();
615 }, 577 },
616 578
617 joinObjectRefs_: function() { 579 joinObjectRefs_: function() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 649
688 iterObjectFieldsRecursively(item.args); 650 iterObjectFieldsRecursively(item.args);
689 } 651 }
690 }; 652 };
691 653
692 return { 654 return {
693 Model: Model 655 Model: Model
694 }; 656 };
695 }); 657 });
696 </script> 658 </script>
OLDNEW
« no previous file with comments | « no previous file | tracing/tracing/model/model_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698