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

Side by Side Diff: tracing/tracing/extras/importer/linux_perf/mali_parser.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (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) 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/extras/importer/linux_perf/parser.html"> 8 <link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
9 9
10 <script> 10 <script>
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 /** 244 /**
245 * Deduce the format of Mali perf events. 245 * Deduce the format of Mali perf events.
246 * 246 *
247 * @return {RegExp} the regular expression for parsing data when the format 247 * @return {RegExp} the regular expression for parsing data when the format
248 * is recognized; otherwise null. 248 * is recognized; otherwise null.
249 */ 249 */
250 autoDetectLineRE: function(line) { 250 autoDetectLineRE: function(line) {
251 // Matches Mali perf events with thread info 251 // Matches Mali perf events with thread info
252 var lineREWithThread = 252 var lineREWithThread =
253 /^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/; 253 /^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;
254 if (lineREWithThread.test(line)) 254 if (lineREWithThread.test(line)) {
255 return lineREWithThread; 255 return lineREWithThread;
256 }
256 257
257 // Matches old-style Mali perf events 258 // Matches old-style Mali perf events
258 var lineRENoThread = /^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/; 259 var lineRENoThread = /^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;
259 if (lineRENoThread.test(line)) 260 if (lineRENoThread.test(line)) {
260 return lineRENoThread; 261 return lineRENoThread;
262 }
261 return null; 263 return null;
262 }, 264 },
263 265
264 lineRE: null, 266 lineRE: null,
265 267
266 /** 268 /**
267 * Parses maliDDK events and sets up state in the importer. 269 * Parses maliDDK events and sets up state in the importer.
268 * events will come in pairs with a cros_trace_print_enter 270 * events will come in pairs with a cros_trace_print_enter
269 * like this (line broken here for formatting): 271 * like this (line broken here for formatting):
270 * 272 *
271 * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_enter: \ 273 * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_enter: \
272 * gles/src/texture/mali_gles_texture_slave.c@1505: gles2_texturep_upload 274 * gles/src/texture/mali_gles_texture_slave.c@1505: gles2_texturep_upload
273 * 275 *
274 * and a cros_trace_print_exit like this: 276 * and a cros_trace_print_exit like this:
275 * 277 *
276 * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_exit: \ 278 * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_exit: \
277 * gles/src/texture/mali_gles_texture_slave.c@1505: 279 * gles/src/texture/mali_gles_texture_slave.c@1505:
278 */ 280 */
279 maliDDKEvent: function(eventName, cpuNumber, pid, ts, eventBase) { 281 maliDDKEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
280 if (this.lineRE === null) { 282 if (this.lineRE === null) {
281 this.lineRE = this.autoDetectLineRE(eventBase.details); 283 this.lineRE = this.autoDetectLineRE(eventBase.details);
282 if (this.lineRE === null) 284 if (this.lineRE === null) return false;
283 return false;
284 } 285 }
285 var maliEvent = this.lineRE.exec(eventBase.details); 286 var maliEvent = this.lineRE.exec(eventBase.details);
286 // Old-style Mali perf events have no thread id, so make one. 287 // Old-style Mali perf events have no thread id, so make one.
287 var tid = (maliEvent[1] === '' ? 'mali' : maliEvent[1]); 288 var tid = (maliEvent[1] === '' ? 'mali' : maliEvent[1]);
288 switch (maliEvent[2]) { 289 switch (maliEvent[2]) {
289 case 'cros_trace_print_enter': 290 case 'cros_trace_print_enter':
290 this.maliDDKOpenSlice(pid, tid, ts, maliEvent[4], 291 this.maliDDKOpenSlice(pid, tid, ts, maliEvent[4],
291 maliEvent[3]); 292 maliEvent[3]);
292 break; 293 break;
293 case 'cros_trace_print_exit': 294 case 'cros_trace_print_exit':
(...skipping 14 matching lines...) Expand all
308 counter.addSeries(new tr.model.CounterSeries(seriesName, 309 counter.addSeries(new tr.model.CounterSeries(seriesName,
309 ColorScheme.getColorIdForGeneralPurposeString(counter.name))); 310 ColorScheme.getColorIdForGeneralPurposeString(counter.name)));
310 } 311 }
311 counter.series.forEach(function(series) { 312 counter.series.forEach(function(series) {
312 series.addCounterSample(ts, value); 313 series.addCounterSample(ts, value);
313 }); 314 });
314 }, 315 },
315 316
316 dvfsEventEvent: function(eventName, cpuNumber, pid, ts, eventBase) { 317 dvfsEventEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
317 var event = /utilization=(\d+)/.exec(eventBase.details); 318 var event = /utilization=(\d+)/.exec(eventBase.details);
318 if (!event) 319 if (!event) return false;
319 return false;
320 320
321 this.dvfsSample('DVFS Utilization', 'utilization', ts, event[1]); 321 this.dvfsSample('DVFS Utilization', 'utilization', ts, event[1]);
322 return true; 322 return true;
323 }, 323 },
324 324
325 dvfsSetClockEvent: function(eventName, cpuNumber, pid, ts, eventBase) { 325 dvfsSetClockEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
326 var event = /frequency=(\d+)/.exec(eventBase.details); 326 var event = /frequency=(\d+)/.exec(eventBase.details);
327 if (!event) 327 if (!event) return false;
328 return false;
329 328
330 this.dvfsSample('DVFS Frequency', 'frequency', ts, event[1]); 329 this.dvfsSample('DVFS Frequency', 'frequency', ts, event[1]);
331 return true; 330 return true;
332 }, 331 },
333 332
334 dvfsSetVoltageEvent: function(eventName, cpuNumber, pid, ts, eventBase) { 333 dvfsSetVoltageEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
335 var event = /voltage=(\d+)/.exec(eventBase.details); 334 var event = /voltage=(\d+)/.exec(eventBase.details);
336 if (!event) 335 if (!event) return false;
337 return false;
338 336
339 this.dvfsSample('DVFS Voltage', 'voltage', ts, event[1]); 337 this.dvfsSample('DVFS Voltage', 'voltage', ts, event[1]);
340 return true; 338 return true;
341 }, 339 },
342 340
343 hwcSample: function(cat, counterName, seriesName, ts, eventBase) { 341 hwcSample: function(cat, counterName, seriesName, ts, eventBase) {
344 var event = /val=(\d+)/.exec(eventBase.details); 342 var event = /val=(\d+)/.exec(eventBase.details);
345 if (!event) 343 if (!event) return false;
346 return false;
347 var value = parseInt(event[1]); 344 var value = parseInt(event[1]);
348 345
349 var counter = this.model_.kernel. 346 var counter = this.model_.kernel.
350 getOrCreateCounter(cat, counterName); 347 getOrCreateCounter(cat, counterName);
351 if (counter.numSeries === 0) { 348 if (counter.numSeries === 0) {
352 counter.addSeries(new tr.model.CounterSeries(seriesName, 349 counter.addSeries(new tr.model.CounterSeries(seriesName,
353 ColorScheme.getColorIdForGeneralPurposeString(counter.name))); 350 ColorScheme.getColorIdForGeneralPurposeString(counter.name)));
354 } 351 }
355 counter.series.forEach(function(series) { 352 counter.series.forEach(function(series) {
356 series.addCounterSample(ts, value); 353 series.addCounterSample(ts, value);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 }; 555 };
559 556
560 Parser.register(MaliParser); 557 Parser.register(MaliParser);
561 558
562 return { 559 return {
563 MaliParser, 560 MaliParser,
564 }; 561 };
565 }); 562 });
566 </script> 563 </script>
567 564
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698