~yolanda.robla/ubuntu/trusty/nodejs/add_distribution

« back to all changes in this revision

Viewing changes to deps/v8/tools/tickprocessor.js

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2009 the V8 project authors. All rights reserved.
 
1
// Copyright 2012 the V8 project authors. All rights reserved.
2
2
// Redistribution and use in source and binary forms, with or without
3
3
// modification, are permitted provided that the following conditions are
4
4
// met:
146
146
 
147
147
 
148
148
function TickProcessor(
149
 
    cppEntriesProvider, separateIc, ignoreUnknown, stateFilter, snapshotLogProcessor) {
 
149
    cppEntriesProvider,
 
150
    separateIc,
 
151
    callGraphSize,
 
152
    ignoreUnknown,
 
153
    stateFilter,
 
154
    snapshotLogProcessor) {
150
155
  LogReader.call(this, {
151
156
      'shared-library': { parsers: [null, parseInt, parseInt],
152
157
          processor: this.processSharedLibrary },
181
186
      'end-code-region': null });
182
187
 
183
188
  this.cppEntriesProvider_ = cppEntriesProvider;
 
189
  this.callGraphSize_ = callGraphSize;
184
190
  this.ignoreUnknown_ = ignoreUnknown;
185
191
  this.stateFilter_ = stateFilter;
186
192
  this.snapshotLogProcessor_ = snapshotLogProcessor;
240
246
 
241
247
TickProcessor.CALL_PROFILE_CUTOFF_PCT = 2.0;
242
248
 
 
249
TickProcessor.CALL_GRAPH_SIZE = 5;
243
250
 
244
251
/**
245
252
 * @override
535
542
          padLeft(rec.parentTotalPercent.toFixed(1), 5) + '%  ' +
536
543
          indentStr + rec.internalFuncName);
537
544
    // Limit backtrace depth.
538
 
    if (indent < 10) {
 
545
    if (indent < 2 * self.callGraphSize_) {
539
546
      self.printHeavyProfile(rec.children, indent + 2);
540
547
    }
541
548
    // Delimit top-level functions.
601
608
};
602
609
 
603
610
 
604
 
function UnixCppEntriesProvider(nmExec) {
 
611
function UnixCppEntriesProvider(nmExec, targetRootFS) {
605
612
  this.symbols = [];
606
613
  this.parsePos = 0;
607
614
  this.nmExec = nmExec;
 
615
  this.targetRootFS = targetRootFS;
608
616
  this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ([0-9a-fA-F]{8,16} )?[tTwW] (.*)$/;
609
617
};
610
618
inherits(UnixCppEntriesProvider, CppEntriesProvider);
612
620
 
613
621
UnixCppEntriesProvider.prototype.loadSymbols = function(libName) {
614
622
  this.parsePos = 0;
 
623
  libName = this.targetRootFS + libName;
615
624
  try {
616
625
    this.symbols = [
617
626
      os.system(this.nmExec, ['-C', '-n', '-S', libName], -1, -1),
649
658
};
650
659
 
651
660
 
652
 
function MacCppEntriesProvider(nmExec) {
653
 
  UnixCppEntriesProvider.call(this, nmExec);
 
661
function MacCppEntriesProvider(nmExec, targetRootFS) {
 
662
  UnixCppEntriesProvider.call(this, nmExec, targetRootFS);
654
663
  // Note an empty group. It is required, as UnixCppEntriesProvider expects 3 groups.
655
664
  this.FUNC_RE = /^([0-9a-fA-F]{8,16}) ()[iItT] (.*)$/;
656
665
};
659
668
 
660
669
MacCppEntriesProvider.prototype.loadSymbols = function(libName) {
661
670
  this.parsePos = 0;
 
671
  libName = this.targetRootFS + libName;
662
672
  try {
663
673
    this.symbols = [os.system(this.nmExec, ['-n', '-f', libName], -1, -1), ''];
664
674
  } catch (e) {
668
678
};
669
679
 
670
680
 
671
 
function WindowsCppEntriesProvider() {
 
681
function WindowsCppEntriesProvider(_ignored_nmExec, targetRootFS) {
 
682
  this.targetRootFS = targetRootFS;
672
683
  this.symbols = '';
673
684
  this.parsePos = 0;
674
685
};
691
702
 
692
703
 
693
704
WindowsCppEntriesProvider.prototype.loadSymbols = function(libName) {
 
705
  libName = this.targetRootFS + libName;
694
706
  var fileNameFields = libName.match(WindowsCppEntriesProvider.FILENAME_RE);
695
707
  if (!fileNameFields) return;
696
708
  var mapFileName = fileNameFields[1] + '.map';
764
776
        'Show only ticks from OTHER VM state'],
765
777
    '-e': ['stateFilter', TickProcessor.VmStates.EXTERNAL,
766
778
        'Show only ticks from EXTERNAL VM state'],
 
779
    '--call-graph-size': ['callGraphSize', TickProcessor.CALL_GRAPH_SIZE,
 
780
        'Set the call graph size'],
767
781
    '--ignore-unknown': ['ignoreUnknown', true,
768
782
        'Exclude ticks of unknown code entries from processing'],
769
783
    '--separate-ic': ['separateIc', true,
776
790
        'Specify that we are running on Mac OS X platform'],
777
791
    '--nm': ['nm', 'nm',
778
792
        'Specify the \'nm\' executable to use (e.g. --nm=/my_dir/nm)'],
 
793
    '--target': ['targetRootFS', '',
 
794
        'Specify the target root directory for cross environment'],
779
795
    '--snapshot-log': ['snapshotLogFileName', 'snapshot.log',
780
796
        'Specify snapshot log file to use (e.g. --snapshot-log=snapshot.log)']
781
797
  };
792
808
  snapshotLogFileName: null,
793
809
  platform: 'unix',
794
810
  stateFilter: null,
 
811
  callGraphSize: 5,
795
812
  ignoreUnknown: false,
796
813
  separateIc: false,
 
814
  targetRootFS: '',
797
815
  nm: 'nm'
798
816
};
799
817