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

Side by Side Diff: tracing/tracing/extras/android/android_auditor.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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/iteration_helpers.html"> 8 <link rel="import" href="/tracing/base/iteration_helpers.html">
9 <link rel="import" href="/tracing/base/range_utils.html"> 9 <link rel="import" href="/tracing/base/math/range_utils.html">
10 <link rel="import" href="/tracing/base/math/statistics.html">
10 <link rel="import" href="/tracing/base/scalar.html"> 11 <link rel="import" href="/tracing/base/scalar.html">
11 <link rel="import" href="/tracing/base/statistics.html">
12 <link rel="import" href="/tracing/base/unit.html"> 12 <link rel="import" href="/tracing/base/unit.html">
13 <link rel="import" href="/tracing/core/auditor.html"> 13 <link rel="import" href="/tracing/core/auditor.html">
14 <link rel="import" href="/tracing/model/alert.html"> 14 <link rel="import" href="/tracing/model/alert.html">
15 <link rel="import" href="/tracing/model/frame.html"> 15 <link rel="import" href="/tracing/model/frame.html">
16 <link rel="import" href="/tracing/model/helpers/android_model_helper.html"> 16 <link rel="import" href="/tracing/model/helpers/android_model_helper.html">
17 <link rel="import" href="/tracing/model/thread_time_slice.html"> 17 <link rel="import" href="/tracing/model/thread_time_slice.html">
18 <link rel="import" href="/tracing/model/user_model/response_expectation.html"> 18 <link rel="import" href="/tracing/model/user_model/response_expectation.html">
19 19
20 <script> 20 <script>
21 'use strict'; 21 'use strict';
22 22
23 /** 23 /**
24 * @fileoverview Class for Android-specific Auditing. 24 * @fileoverview Class for Android-specific Auditing.
25 */ 25 */
26 tr.exportTo('tr.e.audits', function() { 26 tr.exportTo('tr.e.audits', function() {
27 var SCHEDULING_STATE = tr.model.SCHEDULING_STATE; 27 var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
28 var Auditor = tr.c.Auditor; 28 var Auditor = tr.c.Auditor;
29 var AndroidModelHelper = tr.model.helpers.AndroidModelHelper; 29 var AndroidModelHelper = tr.model.helpers.AndroidModelHelper;
30 var ColorScheme = tr.b.ColorScheme; 30 var ColorScheme = tr.b.ColorScheme;
31 var Statistics = tr.b.Statistics; 31 var Statistics = tr.b.math.Statistics;
32 var FRAME_PERF_CLASS = tr.model.FRAME_PERF_CLASS; 32 var FRAME_PERF_CLASS = tr.model.FRAME_PERF_CLASS;
33 var Alert = tr.model.Alert; 33 var Alert = tr.model.Alert;
34 var EventInfo = tr.model.EventInfo; 34 var EventInfo = tr.model.EventInfo;
35 var Scalar = tr.b.Scalar; 35 var Scalar = tr.b.Scalar;
36 var timeDurationInMs = tr.b.Unit.byName.timeDurationInMs; 36 var timeDurationInMs = tr.b.Unit.byName.timeDurationInMs;
37 37
38 // TODO: extract from VSYNC, since not all devices have vsync near 60fps 38 // TODO: extract from VSYNC, since not all devices have vsync near 60fps
39 var EXPECTED_FRAME_TIME_MS = 16.67; 39 var EXPECTED_FRAME_TIME_MS = 16.67;
40 40
41 function getStart(e) { return e.start; } 41 function getStart(e) { return e.start; }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 events.push.apply(events, app.getFrames()); 526 events.push.apply(events, app.getFrames());
527 }); 527 });
528 528
529 var mergerFunction = function(events) { 529 var mergerFunction = function(events) {
530 var ir = new tr.model.um.ResponseExpectation( 530 var ir = new tr.model.um.ResponseExpectation(
531 this.model, 'Rendering', 531 this.model, 'Rendering',
532 events[0].min, 532 events[0].min,
533 events[events.length - 1].max - events[0].min); 533 events[events.length - 1].max - events[0].min);
534 this.model.userModel.expectations.push(ir); 534 this.model.userModel.expectations.push(ir);
535 }.bind(this); 535 }.bind(this);
536 tr.b.mergeRanges(tr.b.convertEventsToRanges(events), 30, mergerFunction); 536 tr.b.math.mergeRanges(
537 tr.b.math.convertEventsToRanges(events), 30, mergerFunction);
537 }, 538 },
538 539
539 addInputInteractionRecords: function() { 540 addInputInteractionRecords: function() {
540 var inputSamples = []; 541 var inputSamples = [];
541 this.helper.apps.forEach(function(app) { 542 this.helper.apps.forEach(function(app) {
542 inputSamples.push.apply(inputSamples, app.getInputSamples()); 543 inputSamples.push.apply(inputSamples, app.getInputSamples());
543 }); 544 });
544 545
545 var mergerFunction = function(events) { 546 var mergerFunction = function(events) {
546 var ir = new tr.model.um.ResponseExpectation( 547 var ir = new tr.model.um.ResponseExpectation(
547 this.model, 'Input', 548 this.model, 'Input',
548 events[0].min, 549 events[0].min,
549 events[events.length - 1].max - events[0].min); 550 events[events.length - 1].max - events[0].min);
550 this.model.userModel.expectations.push(ir); 551 this.model.userModel.expectations.push(ir);
551 }.bind(this); 552 }.bind(this);
552 var inputRanges = inputSamples.map(function(sample) { 553 var inputRanges = inputSamples.map(function(sample) {
553 return tr.b.Range.fromExplicitRange(sample.timestamp, sample.timestamp); 554 return tr.b.math.Range.fromExplicitRange(
555 sample.timestamp, sample.timestamp);
554 }); 556 });
555 tr.b.mergeRanges(inputRanges, 30, mergerFunction); 557 tr.b.math.mergeRanges(inputRanges, 30, mergerFunction);
556 } 558 }
557 }; 559 };
558 560
559 Auditor.register(AndroidAuditor); 561 Auditor.register(AndroidAuditor);
560 562
561 function AppAnnotator() { 563 function AppAnnotator() {
562 this.titleInfoLookup = new Map(); 564 this.titleInfoLookup = new Map();
563 this.titleParentLookup = new Map(); 565 this.titleParentLookup = new Map();
564 this.build_(); 566 this.build_();
565 } 567 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 this.applyEventInfosRecursive_(new Map(), slice); 748 this.applyEventInfosRecursive_(new Map(), slice);
747 }, this); 749 }, this);
748 } 750 }
749 }; 751 };
750 752
751 return { 753 return {
752 AndroidAuditor, 754 AndroidAuditor,
753 }; 755 };
754 }); 756 });
755 </script> 757 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/unittest/test_suite.html ('k') | tracing/tracing/extras/chrome/cc/layer_impl.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698