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

Side by Side Diff: tools/tickprocessor.js

Issue 119304: Add log compression ability. (Closed)
Patch Set: Created 11 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
« src/stub-cache.cc ('K') | « src/x64/assembler-x64.cc ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 break; 80 break;
81 } 81 }
82 }; 82 };
83 83
84 this.profile_ = new Profile(separateIc); 84 this.profile_ = new Profile(separateIc);
85 this.codeTypes_ = {}; 85 this.codeTypes_ = {};
86 // Count each tick as a time unit. 86 // Count each tick as a time unit.
87 this.viewBuilder_ = new devtools.profiler.ViewBuilder(1); 87 this.viewBuilder_ = new devtools.profiler.ViewBuilder(1);
88 this.lastLogFileName_ = null; 88 this.lastLogFileName_ = null;
89 this.aliases_ = {};
89 }; 90 };
90 91
91 92
92 TickProcessor.VmStates = { 93 TickProcessor.VmStates = {
93 JS: 0, 94 JS: 0,
94 GC: 1, 95 GC: 1,
95 COMPILER: 2, 96 COMPILER: 2,
96 OTHER: 3, 97 OTHER: 3,
97 EXTERNAL: 4 98 EXTERNAL: 4
98 }; 99 };
(...skipping 10 matching lines...) Expand all
109 TickProcessor.RecordsDispatch = { 110 TickProcessor.RecordsDispatch = {
110 'shared-library': { parsers: [null, parseInt, parseInt], 111 'shared-library': { parsers: [null, parseInt, parseInt],
111 processor: 'processSharedLibrary' }, 112 processor: 'processSharedLibrary' },
112 'code-creation': { parsers: [null, parseInt, parseInt, null], 113 'code-creation': { parsers: [null, parseInt, parseInt, null],
113 processor: 'processCodeCreation' }, 114 processor: 'processCodeCreation' },
114 'code-move': { parsers: [parseInt, parseInt], 115 'code-move': { parsers: [parseInt, parseInt],
115 processor: 'processCodeMove' }, 116 processor: 'processCodeMove' },
116 'code-delete': { parsers: [parseInt], processor: 'processCodeDelete' }, 117 'code-delete': { parsers: [parseInt], processor: 'processCodeDelete' },
117 'tick': { parsers: [parseInt, parseInt, parseInt, 'var-args'], 118 'tick': { parsers: [parseInt, parseInt, parseInt, 'var-args'],
118 processor: 'processTick' }, 119 processor: 'processTick' },
120 'alias': { parsers: [null, null], processor: 'processAlias' },
119 'profiler': null, 121 'profiler': null,
120 // Obsolete row types. 122 // Obsolete row types.
121 'code-allocate': null, 123 'code-allocate': null,
122 'begin-code-region': null, 124 'begin-code-region': null,
123 'end-code-region': null 125 'end-code-region': null
124 }; 126 };
125 127
126
127 TickProcessor.CALL_PROFILE_CUTOFF_PCT = 2.0; 128 TickProcessor.CALL_PROFILE_CUTOFF_PCT = 2.0;
128 129
129 130
130 TickProcessor.prototype.setCodeType = function(name, type) { 131 TickProcessor.prototype.setCodeType = function(name, type) {
131 this.codeTypes_[name] = TickProcessor.CodeTypes[type]; 132 this.codeTypes_[name] = TickProcessor.CodeTypes[type];
132 }; 133 };
133 134
134 135
135 TickProcessor.prototype.isSharedLibrary = function(name) { 136 TickProcessor.prototype.isSharedLibrary = function(name) {
136 return this.codeTypes_[name] == TickProcessor.CodeTypes.SHARED_LIB; 137 return this.codeTypes_[name] == TickProcessor.CodeTypes.SHARED_LIB;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 212
212 var self = this; 213 var self = this;
213 var libFuncs = this.cppEntriesProvider_.parseVmSymbols( 214 var libFuncs = this.cppEntriesProvider_.parseVmSymbols(
214 name, startAddr, endAddr, function(fName, fStart, fEnd) { 215 name, startAddr, endAddr, function(fName, fStart, fEnd) {
215 self.profile_.addStaticCode(fName, fStart, fEnd); 216 self.profile_.addStaticCode(fName, fStart, fEnd);
216 self.setCodeType(fName, 'CPP'); 217 self.setCodeType(fName, 'CPP');
217 }); 218 });
218 }; 219 };
219 220
220 221
222 TickProcessor.prototype.processAlias = function(symbol, expansion) {
223 if (expansion in TickProcessor.RecordsDispatch) {
224 TickProcessor.RecordsDispatch[symbol] =
225 TickProcessor.RecordsDispatch[expansion];
226 } else {
227 this.aliases_[symbol] = expansion;
228 }
229 };
230
231
221 TickProcessor.prototype.processCodeCreation = function( 232 TickProcessor.prototype.processCodeCreation = function(
222 type, start, size, name) { 233 type, start, size, name) {
234 if (type in this.aliases_) {
235 type = this.aliases_[type];
236 }
223 var entry = this.profile_.addCode(type, name, start, size); 237 var entry = this.profile_.addCode(type, name, start, size);
224 }; 238 };
225 239
226 240
227 TickProcessor.prototype.processCodeMove = function(from, to) { 241 TickProcessor.prototype.processCodeMove = function(from, to) {
228 this.profile_.moveCode(from, to); 242 this.profile_.moveCode(from, to);
229 }; 243 };
230 244
231 245
232 TickProcessor.prototype.processCodeDelete = function(start) { 246 TickProcessor.prototype.processCodeDelete = function(start) {
233 this.profile_.deleteCode(start); 247 this.profile_.deleteCode(start);
234 }; 248 };
235 249
236 250
237 TickProcessor.prototype.includeTick = function(vmState) { 251 TickProcessor.prototype.includeTick = function(vmState) {
238 return this.stateFilter_ == null || this.stateFilter_ == vmState; 252 return this.stateFilter_ == null || this.stateFilter_ == vmState;
239 }; 253 };
240 254
241 255
242 TickProcessor.prototype.processTick = function(pc, sp, vmState, stack) { 256 TickProcessor.prototype.processTick = function(pc, sp, vmState, stack) {
243 this.ticks_.total++; 257 this.ticks_.total++;
244 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++; 258 if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
245 if (!this.includeTick(vmState)) { 259 if (!this.includeTick(vmState)) {
246 this.ticks_.excluded++; 260 this.ticks_.excluded++;
247 return; 261 return;
248 } 262 }
249 263
250 var fullStack = [pc]; 264 var fullStack = [pc];
265 var prevFrame = pc;
251 for (var i = 0, n = stack.length; i < n; ++i) { 266 for (var i = 0, n = stack.length; i < n; ++i) {
252 var frame = stack[i]; 267 var frame = stack[i];
268 var firstChar = frame.charAt(0);
253 // Leave only numbers starting with 0x. Filter possible 'overflow' string. 269 // Leave only numbers starting with 0x. Filter possible 'overflow' string.
254 if (frame.charAt(0) == '0') { 270 if (firstChar == '0') {
255 fullStack.push(parseInt(frame, 16)); 271 fullStack.push(parseInt(frame, 16));
272 } else if (firstChar == '+' || firstChar == '-') {
273 // An offset from the previous frame.
274 prevFrame += parseInt(frame, 16);
275 fullStack.push(prevFrame);
256 } 276 }
257 } 277 }
258 this.profile_.recordTick(fullStack); 278 this.profile_.recordTick(fullStack);
259 }; 279 };
260 280
261 281
262 TickProcessor.prototype.printStatistics = function() { 282 TickProcessor.prototype.printStatistics = function() {
263 print('Statistical profiling result from ' + this.lastLogFileName_ + 283 print('Statistical profiling result from ' + this.lastLogFileName_ +
264 ', (' + this.ticks_.total + 284 ', (' + this.ticks_.total +
265 ' ticks, ' + this.ticks_.unaccounted + ' unaccounted, ' + 285 ' ticks, ' + this.ticks_.unaccounted + ' unaccounted, ' +
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 653
634 var params = processArguments(arguments); 654 var params = processArguments(arguments);
635 var tickProcessor = new TickProcessor( 655 var tickProcessor = new TickProcessor(
636 params.platform == 'unix' ? new UnixCppEntriesProvider() : 656 params.platform == 'unix' ? new UnixCppEntriesProvider() :
637 new WindowsCppEntriesProvider(), 657 new WindowsCppEntriesProvider(),
638 params.separateIc, 658 params.separateIc,
639 params.ignoreUnknown, 659 params.ignoreUnknown,
640 params.stateFilter); 660 params.stateFilter);
641 tickProcessor.processLogFile(params.logFileName); 661 tickProcessor.processLogFile(params.logFileName);
642 tickProcessor.printStatistics(); 662 tickProcessor.printStatistics();
OLDNEW
« src/stub-cache.cc ('K') | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698