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

Side by Side Diff: chrome/test/media_router/telemetry/benchmarks/pagesets/cpu_memory_script.js

Issue 1907073002: Update cpu and memory metric calculation and several small improvements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Jennifer's comment Created 4 years, 8 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 /** 1 /**
2 * Copyright 2016 The Chromium Authors. All rights reserved. 2 * Copyright 2016 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 * 5 *
6 * @fileoverview Script to interact with test extension to get CPU/memory usage. 6 * @fileoverview Script to interact with test extension to get CPU/memory usage.
7 * 7 *
8 */ 8 */
9 9
10 10
11 // MR test extension ID. 11 // MR test extension ID.
12 var extensionId = 'ocihafebdemjoofhbdnamghkfobfgbal'; 12 var extensionId = 'ocihafebdemjoofhbdnamghkfobfgbal';
13 13
14 /** 14 /**
15 * The dictionary to store the performance results with the following format: 15 * The dictionary to store the performance results with the following format:
16 * key: the metric, e.g. CPU, private memory 16 * key: the metric, e.g. CPU, private memory
17 * value: map of the performance results for different processes. 17 * value: map of the performance results for different processes.
18 * key: process type, e.g. tab, browser, gpu, extension. 18 * key: process type, e.g. tab, browser, gpu, extension.
19 * value: list of the performance results. 19 * value: list of the performance results per second. Task Manager notifies
20 * the event listener nearly every second for the latest status of
21 * each process.
20 */ 22 */
21 window.perfResults = {}; 23 window.perfResults = {};
22 24
23 /** 25 /**
24 * Connects to the test extension and starts to collect CPU/memory usage data. 26 * Connects to the test extension and starts to collect CPU/memory usage data.
25 */ 27 */
26 function collectPerfData() { 28 function collectPerfData() {
27 processCpuPort_ = openPort_('collectData'); 29 processCpuPort_ = openPort_('collectData');
28 if (processCpuPort_) { 30 if (processCpuPort_) {
29 processCpuPort_.onMessage.addListener(function(message) { 31 processCpuPort_.onMessage.addListener(function(message) {
(...skipping 16 matching lines...) Expand all
46 } 48 }
47 49
48 function openPort_(name) { 50 function openPort_(name) {
49 var rt = window.chrome.runtime; 51 var rt = window.chrome.runtime;
50 if (rt && rt.connect) { 52 if (rt && rt.connect) {
51 console.info('Opening port named ' + name); 53 console.info('Opening port named ' + name);
52 return rt.connect(extensionId, {'name': name}); 54 return rt.connect(extensionId, {'name': name});
53 } 55 }
54 return null; 56 return null;
55 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698