Revision: 13541
Author: [email protected]
Date: Tue Jan 29 06:41:02 2013
Log: Add option to limit tick processor to a time range.
[email protected]
BUG=
Review URL: https://chromiumcodereview.appspot.com/12077043
http://code.google.com/p/v8/source/detail?r=13541
Modified:
/branches/bleeding_edge/test/mjsunit/tools/tickprocessor.js
/branches/bleeding_edge/tools/plot-timer-events
/branches/bleeding_edge/tools/plot-timer-events.js
/branches/bleeding_edge/tools/tickprocessor-driver.js
/branches/bleeding_edge/tools/tickprocessor.js
=======================================
--- /branches/bleeding_edge/test/mjsunit/tools/tickprocessor.js Mon Feb 13
02:24:55 2012
+++ /branches/bleeding_edge/test/mjsunit/tools/tickprocessor.js Tue Jan 29
06:41:02 2013
@@ -380,7 +380,10 @@
separateIc,
TickProcessor.CALL_GRAPH_SIZE,
ignoreUnknown,
- stateFilter);
+ stateFilter,
+ undefined,
+ "0",
+ "auto,auto");
var pm = new PrintMonitor(testsPath + refOutput);
tp.processLogFileInTest(testsPath + logInput);
tp.printStatistics();
=======================================
--- /branches/bleeding_edge/tools/plot-timer-events Mon Jan 28 05:55:40 2013
+++ /branches/bleeding_edge/tools/plot-timer-events Tue Jan 29 06:41:02 2013
@@ -32,9 +32,7 @@
exit 1
fi
-if [ -n "$DISTORTION" ]; then
- distortion=$DISTORTION
-else
+if [[ "$@" != *--distortion* ]]; then
# Try to find out how much the instrumentation overhead is.
calibration_log=calibration.log
calibration_script="for (var i = 0; i < 1000000; i++) print();"
@@ -58,21 +56,15 @@
rm $calibration_log
# Overhead in picoseconds.
- distortion=`echo "1000*(($t_1_end - $t_1_start) - ($t_2_end -
$t_2_start)) \
- / ($n_1 - $n_2)" | bc`
-fi
-
-if [ -n "$PLOT_RANGE" ]; then
- plot_range=$PLOT_RANGE
-else
- plot_range=auto,auto
+ options=--distortion=
+ options+=`echo "1000*(($t_1_end - $t_1_start) - ($t_2_end - $t_2_start))
\
+ / ($n_1 - $n_2)" | bc`
+ echo $options
fi
-echo "DISTORTION=$distortion"
-echo "PLOT_RANGE=$plot_range"
-
echo -e "plot-range,$plot_range\ndistortion,$distortion" | cat - $log_file
|
- $d8_exec $tools_path/csvparser.js \
- $tools_path/splaytree.js $tools_path/codemap.js \
- $tools_path/logreader.js $tools_path/plot-timer-events.js \
+ $d8_exec $tools_path/csvparser.js $tools_path/splaytree.js \
+ $tools_path/codemap.js $tools_path/profile.js
$tools_path/profile_view.js \
+ $tools_path/logreader.js $tools_path/tickprocessor.js \
+ $tools_path/plot-timer-events.js -- $options $@ | less \
2>/dev/null | gnuplot > timer-events.png
=======================================
--- /branches/bleeding_edge/tools/plot-timer-events.js Mon Jan 28 05:55:40
2013
+++ /branches/bleeding_edge/tools/plot-timer-events.js Tue Jan 29 06:41:02
2013
@@ -230,17 +230,6 @@
if (entry) FindCodeKind(entry.kind).stack_frames[i].push(tick);
}
}
-
-
-function ProcessDistortion(distortion_in_picoseconds) {
- distortion_per_entry = distortion_in_picoseconds / 1000000;
-}
-
-
-function ProcessPlotRange(start, end) {
- xrange_start_override = start;
- xrange_end_override = end;
-}
function FindPlotRange() {
@@ -285,6 +274,26 @@
distortion += distortion_per_entry;
return parseInt(timestamp) / 1000 - distortion;
}
+
+
+function ParseArguments(args) {
+ var processor = new ArgumentsProcessor(args);
+ do {
+ if (!processor.parse()) break;
+ var result = processor.result();
+ var distortion = parseInt(result.distortion);
+ if (isNaN(distortion)) break;
+ // Convert picoseconds to milliseconds.
+ distortion_per_entry = distortion / 1000000;
+ var rangelimits = result.range.split(",");
+ var range_start = parseInt(rangelimits[0]);
+ var range_end = parseInt(rangelimits[1]);
+ xrange_start_override = isNaN(range_start) ? undefined : range_start;
+ xrange_end_override = isNaN(range_end) ? undefined : range_end;
+ return;
+ } while (false);
+ processor.printUsageAndExit();
+}
function CollectData() {
@@ -304,11 +313,7 @@
processor: ProcessCodeDeleteEvent },
'tick': { parsers: [parseInt, parseInt, parseTimeStamp,
null, null, parseInt, 'var-args'],
- processor: ProcessTickEvent },
- 'distortion': { parsers: [parseInt],
- processor: ProcessDistortion },
- 'plot-range': { parsers: [parseInt, parseInt],
- processor: ProcessPlotRange },
+ processor: ProcessTickEvent }
});
var line;
@@ -385,8 +390,6 @@
function GnuplotOutput() {
- FindPlotRange();
-
print("set terminal pngcairo size " + kResX + "," + kResY +
" enhanced font 'Helvetica,10'");
print("set yrange [0:" + (num_timer_event + 1) + "]");
@@ -501,5 +504,7 @@
}
+ParseArguments(arguments);
CollectData();
+FindPlotRange();
GnuplotOutput();
=======================================
--- /branches/bleeding_edge/tools/tickprocessor-driver.js Mon Jul 16
04:00:44 2012
+++ /branches/bleeding_edge/tools/tickprocessor-driver.js Tue Jan 29
06:41:02 2013
@@ -55,6 +55,8 @@
params.callGraphSize,
params.ignoreUnknown,
params.stateFilter,
- snapshotLogProcessor);
+ snapshotLogProcessor,
+ params.distortion,
+ params.range);
tickProcessor.processLogFile(params.logFileName);
tickProcessor.printStatistics();
=======================================
--- /branches/bleeding_edge/tools/tickprocessor.js Wed Nov 28 03:01:10 2012
+++ /branches/bleeding_edge/tools/tickprocessor.js Tue Jan 29 06:41:02 2013
@@ -151,7 +151,9 @@
callGraphSize,
ignoreUnknown,
stateFilter,
- snapshotLogProcessor) {
+ snapshotLogProcessor,
+ distortion,
+ range) {
LogReader.call(this, {
'shared-library': { parsers: [null, parseInt, parseInt],
processor: this.processSharedLibrary },
@@ -174,6 +176,10 @@
processor: this.processHeapSampleBegin },
'heap-sample-end': { parsers: [null, null],
processor: this.processHeapSampleEnd },
+ 'timer-event-start' : { parsers: [null, null, null],
+ processor: this.advanceDistortion },
+ 'timer-event-end' : { parsers: [null, null, null],
+ processor: this.advanceDistortion },
// Ignored events.
'profiler': null,
'function-creation': null,
@@ -194,6 +200,17 @@
var ticks = this.ticks_ =
{ total: 0, unaccounted: 0, excluded: 0, gc: 0 };
+ distortion = parseInt(distortion);
+ // Convert picoseconds to nanoseconds.
+ this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000);
+ this.distortion = 0;
+ var rangelimits = range.split(",");
+ var range_start = parseInt(rangelimits[0]);
+ var range_end = parseInt(rangelimits[1]);
+ // Convert milliseconds to nanoseconds.
+ this.range_start = isNaN(range_start) ? -Infinity : (range_start * 1000);
+ this.range_end = isNaN(range_end) ? Infinity : (range_end * 1000)
+
V8Profile.prototype.handleUnknownCode = function(
operation, addr, opt_stackPos) {
var op = Profile.Operation;
@@ -355,6 +372,11 @@
tos_or_external_callback,
vmState,
stack) {
+ this.distortion += this.distortion_per_entry;
+ ns_since_start -= this.distortion;
+ if (ns_since_start < this.range_start || ns_since_start >
this.range_end) {
+ return;
+ }
this.ticks_.total++;
if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
if (!this.includeTick(vmState)) {
@@ -381,6 +403,11 @@
};
+TickProcessor.prototype.advanceDistortion = function() {
+ this.distortion += this.distortion_per_entry;
+}
+
+
TickProcessor.prototype.processHeapSampleBegin = function(space, state,
ticks) {
if (space != 'Heap') return;
this.currentProducerProfile_ = new CallTree();
@@ -795,7 +822,11 @@
'--target': ['targetRootFS', '',
'Specify the target root directory for cross environment'],
'--snapshot-log': ['snapshotLogFileName', 'snapshot.log',
- 'Specify snapshot log file to use (e.g.
--snapshot-log=snapshot.log)']
+ 'Specify snapshot log file to use (e.g.
--snapshot-log=snapshot.log)'],
+ '--range': ['range', 'auto,auto',
+ 'Specify the range limit as [start],[end]'],
+ '--distortion': ['distortion', 0,
+ 'Specify the logging overhead in picoseconds']
};
this.argsDispatch_['--js'] = this.argsDispatch_['-j'];
this.argsDispatch_['--gc'] = this.argsDispatch_['-g'];
@@ -814,7 +845,9 @@
ignoreUnknown: false,
separateIc: false,
targetRootFS: '',
- nm: 'nm'
+ nm: 'nm',
+ range: 'auto,auto',
+ distortion: 0
};
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.