| OLD | NEW |
| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 this.ticks_.excluded + ' excluded).'); | 266 this.ticks_.excluded + ' excluded).'); |
| 267 | 267 |
| 268 if (this.ticks_.total == 0) return; | 268 if (this.ticks_.total == 0) return; |
| 269 | 269 |
| 270 // Print the unknown ticks percentage if they are not ignored. | 270 // Print the unknown ticks percentage if they are not ignored. |
| 271 if (!this.ignoreUnknown_ && this.ticks_.unaccounted > 0) { | 271 if (!this.ignoreUnknown_ && this.ticks_.unaccounted > 0) { |
| 272 this.printHeader('Unknown'); | 272 this.printHeader('Unknown'); |
| 273 this.printCounter(this.ticks_.unaccounted, this.ticks_.total); | 273 this.printCounter(this.ticks_.unaccounted, this.ticks_.total); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // Disable initialization of 'funcName', 'url', 'lineNumber' as |
| 277 // we don't use it and it just wastes time. |
| 278 devtools.profiler.ProfileView.Node.prototype.initFuncInfo = function() {}; |
| 279 |
| 276 var flatProfile = this.profile_.getFlatProfile(); | 280 var flatProfile = this.profile_.getFlatProfile(); |
| 277 var flatView = this.viewBuilder_.buildView(flatProfile); | 281 var flatView = this.viewBuilder_.buildView(flatProfile); |
| 278 // Sort by self time, desc, then by name, desc. | 282 // Sort by self time, desc, then by name, desc. |
| 279 flatView.sort(function(rec1, rec2) { | 283 flatView.sort(function(rec1, rec2) { |
| 280 return rec2.selfTime - rec1.selfTime || | 284 return rec2.selfTime - rec1.selfTime || |
| 281 (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); }); | 285 (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); }); |
| 282 var totalTicks = this.ticks_.total; | 286 var totalTicks = this.ticks_.total; |
| 283 if (this.ignoreUnknown_) { | 287 if (this.ignoreUnknown_) { |
| 284 totalTicks -= this.ticks_.unaccounted; | 288 totalTicks -= this.ticks_.unaccounted; |
| 285 } | 289 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 TickProcessor.prototype.printCounter = function(ticksCount, totalTicksCount) { | 358 TickProcessor.prototype.printCounter = function(ticksCount, totalTicksCount) { |
| 355 var pct = ticksCount * 100.0 / totalTicksCount; | 359 var pct = ticksCount * 100.0 / totalTicksCount; |
| 356 print(' ' + padLeft(ticksCount, 5) + ' ' + padLeft(pct.toFixed(1), 5) + '%')
; | 360 print(' ' + padLeft(ticksCount, 5) + ' ' + padLeft(pct.toFixed(1), 5) + '%')
; |
| 357 }; | 361 }; |
| 358 | 362 |
| 359 | 363 |
| 360 TickProcessor.prototype.processProfile = function( | 364 TickProcessor.prototype.processProfile = function( |
| 361 profile, filterP, func) { | 365 profile, filterP, func) { |
| 362 for (var i = 0, n = profile.length; i < n; ++i) { | 366 for (var i = 0, n = profile.length; i < n; ++i) { |
| 363 var rec = profile[i]; | 367 var rec = profile[i]; |
| 364 // An empty record corresponds to a tree root. | 368 if (!filterP(rec.internalFuncName)) { |
| 365 if (!rec.internalFuncName || !filterP(rec.internalFuncName)) { | |
| 366 continue; | 369 continue; |
| 367 } | 370 } |
| 368 func(rec); | 371 func(rec); |
| 369 } | 372 } |
| 370 }; | 373 }; |
| 371 | 374 |
| 372 | 375 |
| 373 TickProcessor.prototype.printEntries = function( | 376 TickProcessor.prototype.printEntries = function( |
| 374 profile, nonLibTicks, filterP) { | 377 profile, nonLibTicks, filterP) { |
| 375 this.processProfile(profile, filterP, function (rec) { | 378 this.processProfile(profile, filterP, function (rec) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 614 |
| 612 var params = processArguments(arguments); | 615 var params = processArguments(arguments); |
| 613 var tickProcessor = new TickProcessor( | 616 var tickProcessor = new TickProcessor( |
| 614 params.platform == 'unix' ? new UnixCppEntriesProvider() : | 617 params.platform == 'unix' ? new UnixCppEntriesProvider() : |
| 615 new WindowsCppEntriesProvider(), | 618 new WindowsCppEntriesProvider(), |
| 616 params.separateIc, | 619 params.separateIc, |
| 617 params.ignoreUnknown, | 620 params.ignoreUnknown, |
| 618 params.stateFilter); | 621 params.stateFilter); |
| 619 tickProcessor.processLogFile(params.logFileName); | 622 tickProcessor.processLogFile(params.logFileName); |
| 620 tickProcessor.printStatistics(); | 623 tickProcessor.printStatistics(); |
| OLD | NEW |