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

Side by Side Diff: tools/tickprocessor.js

Issue 11359048: Extend tick-processor utility to generate an execution timeline based on the reported VM states Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.separate-ic ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 'profiler': null, 178 'profiler': null,
179 'function-creation': null, 179 'function-creation': null,
180 'function-move': null, 180 'function-move': null,
181 'function-delete': null, 181 'function-delete': null,
182 'heap-sample-item': null, 182 'heap-sample-item': null,
183 // Obsolete row types. 183 // Obsolete row types.
184 'code-allocate': null, 184 'code-allocate': null,
185 'begin-code-region': null, 185 'begin-code-region': null,
186 'end-code-region': null }); 186 'end-code-region': null });
187 187
188 this.timeline_ = "";
188 this.cppEntriesProvider_ = cppEntriesProvider; 189 this.cppEntriesProvider_ = cppEntriesProvider;
189 this.callGraphSize_ = callGraphSize; 190 this.callGraphSize_ = callGraphSize;
190 this.ignoreUnknown_ = ignoreUnknown; 191 this.ignoreUnknown_ = ignoreUnknown;
191 this.stateFilter_ = stateFilter; 192 this.stateFilter_ = stateFilter;
192 this.snapshotLogProcessor_ = snapshotLogProcessor; 193 this.snapshotLogProcessor_ = snapshotLogProcessor;
193 this.deserializedEntriesNames_ = []; 194 this.deserializedEntriesNames_ = [];
194 var ticks = this.ticks_ = 195 var ticks = this.ticks_ =
195 { total: 0, unaccounted: 0, excluded: 0, gc: 0 }; 196 { total: 0, unaccounted: 0, excluded: 0, gc: 0 };
196 197
197 V8Profile.prototype.handleUnknownCode = function( 198 V8Profile.prototype.handleUnknownCode = function(
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 this.deserializedEntriesNames_[addr] = 341 this.deserializedEntriesNames_[addr] =
341 this.snapshotLogProcessor_.getSerializedEntryName(pos); 342 this.snapshotLogProcessor_.getSerializedEntryName(pos);
342 } 343 }
343 }; 344 };
344 345
345 346
346 TickProcessor.prototype.includeTick = function(vmState) { 347 TickProcessor.prototype.includeTick = function(vmState) {
347 return this.stateFilter_ == null || this.stateFilter_ == vmState; 348 return this.stateFilter_ == null || this.stateFilter_ == vmState;
348 }; 349 };
349 350
351 TickProcessor.prototype.recordTickTimeline = function(vmState) {
352 if (vmState == TickProcessor.VmStates.JS) this.timeline_ += "J";
353 else if (vmState == TickProcessor.VmStates.GC) this.timeline_ += "G";
354 else if (vmState == TickProcessor.VmStates.COMPILER) this.timeline_ += "C";
355 else if (vmState == TickProcessor.VmStates.PARALLEL_COMPILER_PROLOGUE) this.ti meline_ += "|";
356 else if (vmState == TickProcessor.VmStates.OTHER) this.timeline_ += "O";
357 else if (vmState == TickProcessor.VmStates.EXTERNAL) this.timeline_ += ".";
358 else this.timeline_ += "U";
359 }
360
350 TickProcessor.prototype.processTick = function(pc, 361 TickProcessor.prototype.processTick = function(pc,
351 sp, 362 sp,
352 is_external_callback, 363 is_external_callback,
353 tos_or_external_callback, 364 tos_or_external_callback,
354 vmState, 365 vmState,
355 stack) { 366 stack) {
356 this.ticks_.total++; 367 this.ticks_.total++;
368 this.recordTickTimeline(vmState);
357 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; 369 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
358 if (!this.includeTick(vmState)) { 370 if (!this.includeTick(vmState)) {
359 this.ticks_.excluded++; 371 this.ticks_.excluded++;
360 return; 372 return;
361 } 373 }
362 if (is_external_callback) { 374 if (is_external_callback) {
363 // Don't use PC when in external callback code, as it can point 375 // Don't use PC when in external callback code, as it can point
364 // inside callback's code, and we will erroneously report 376 // inside callback's code, and we will erroneously report
365 // that a callback calls itself. Instead we use tos_or_external_callback, 377 // that a callback calls itself. Instead we use tos_or_external_callback,
366 // as simply resetting PC will produce unaccounted ticks. 378 // as simply resetting PC will produce unaccounted ticks.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 this.printHeavyProfHeader(); 470 this.printHeavyProfHeader();
459 var heavyProfile = this.profile_.getBottomUpProfile(); 471 var heavyProfile = this.profile_.getBottomUpProfile();
460 var heavyView = this.viewBuilder_.buildView(heavyProfile); 472 var heavyView = this.viewBuilder_.buildView(heavyProfile);
461 // To show the same percentages as in the flat profile. 473 // To show the same percentages as in the flat profile.
462 heavyView.head.totalTime = totalTicks; 474 heavyView.head.totalTime = totalTicks;
463 // Sort by total time, desc, then by name, desc. 475 // Sort by total time, desc, then by name, desc.
464 heavyView.sort(function(rec1, rec2) { 476 heavyView.sort(function(rec1, rec2) {
465 return rec2.totalTime - rec1.totalTime || 477 return rec2.totalTime - rec1.totalTime ||
466 (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); }); 478 (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
467 this.printHeavyProfile(heavyView.head.children); 479 this.printHeavyProfile(heavyView.head.children);
480
481 print('Visual Execution Timeline: ');
482 var sliceLength = 80;
483 var sliceStart = 0;
484 while (sliceStart < this.timeline_.length) {
485 print(this.timeline_.slice(sliceStart, sliceStart + sliceLength));
486 sliceStart += sliceLength;
487 }
468 }; 488 };
469 489
470 490
471 function padLeft(s, len) { 491 function padLeft(s, len) {
472 s = s.toString(); 492 s = s.toString();
473 if (s.length < len) { 493 if (s.length < len) {
474 var padLength = len - s.length; 494 var padLength = len - s.length;
475 if (!(padLength in padLeft)) { 495 if (!(padLength in padLeft)) {
476 padLeft[padLength] = new Array(padLength + 1).join(' '); 496 padLeft[padLength] = new Array(padLength + 1).join(' ');
477 } 497 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { 890 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) {
871 synonims.push(synArg); 891 synonims.push(synArg);
872 delete this.argsDispatch_[synArg]; 892 delete this.argsDispatch_[synArg];
873 } 893 }
874 } 894 }
875 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]); 895 print(' ' + padRight(synonims.join(', '), 20) + dispatch[2]);
876 } 896 }
877 quit(2); 897 quit(2);
878 }; 898 };
879 899
OLDNEW
« no previous file with comments | « test/mjsunit/tools/tickprocessor-test.separate-ic ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698