Commit 2e8a6f5e authored by yangguo@chromium.org's avatar yangguo@chromium.org

Mark timed range in the profile plot.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/333643006

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21832 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0f69ed32
......@@ -1076,6 +1076,16 @@ void Logger::CodeDeoptEvent(Code* code) {
}
void Logger::CurrentTimeEvent() {
if (!log_->IsEnabled()) return;
ASSERT(FLAG_log_internal_timer_events);
Log::MessageBuilder msg(log_);
int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds());
msg.Append("current-time,%ld\n", since_epoch);
msg.WriteToLogFile();
}
void Logger::TimerEvent(StartEnd se, const char* name) {
if (!log_->IsEnabled()) return;
ASSERT(FLAG_log_internal_timer_events);
......
......@@ -290,6 +290,7 @@ class Logger {
enum StartEnd { START, END };
void CodeDeoptEvent(Code* code);
void CurrentTimeEvent();
void TimerEvent(StartEnd se, const char* name);
......
......@@ -9636,6 +9636,7 @@ RUNTIME_FUNCTION(Runtime_DebugTrace) {
RUNTIME_FUNCTION(Runtime_DateCurrentTime) {
HandleScope scope(isolate);
ASSERT(args.length() == 0);
if (FLAG_log_timer_events) LOG(isolate, CurrentTimeEvent());
// According to ECMA-262, section 15.9.1, page 117, the precision of
// the number in a Date object representing a particular instant in
......
......@@ -43,6 +43,7 @@ function PlotScriptComposer(kResX, kResY, error_output) {
var kY1Offset = 11; // Offset for stack frame vs. event lines.
var kDeoptRow = 7; // Row displaying deopts.
var kGetTimeHeight = 0.5; // Height of marker displaying timed part.
var kMaxDeoptLength = 4; // Draw size of the largest deopt.
var kPauseLabelPadding = 5; // Padding for pause time labels.
var kNumPauseLabels = 7; // Number of biggest pauses to label.
......@@ -136,6 +137,7 @@ function PlotScriptComposer(kResX, kResY, error_output) {
var code_map = new CodeMap();
var execution_pauses = [];
var deopts = [];
var gettime = [];
var event_stack = [];
var last_time_stamp = [];
for (var i = 0; i < kNumThreads; i++) {
......@@ -274,6 +276,10 @@ function PlotScriptComposer(kResX, kResY, error_output) {
deopts.push(new Deopt(time, size));
}
var processCurrentTimeEvent = function(time) {
gettime.push(time);
}
var processSharedLibrary = function(name, start, end) {
var code_entry = new CodeMap.CodeEntry(end - start, name);
code_entry.kind = -3; // External code kind.
......@@ -316,6 +322,8 @@ function PlotScriptComposer(kResX, kResY, error_output) {
processor: processCodeDeleteEvent },
'code-deopt': { parsers: [parseTimeStamp, parseInt],
processor: processCodeDeoptEvent },
'current-time': { parsers: [parseTimeStamp],
processor: processCurrentTimeEvent },
'tick': { parsers: [parseInt, parseTimeStamp,
null, null, parseInt, 'var-args'],
processor: processTickEvent }
......@@ -391,12 +399,15 @@ function PlotScriptComposer(kResX, kResY, error_output) {
output("set xtics out nomirror");
output("unset key");
function DrawBarBase(color, start, end, top, bottom) {
function DrawBarBase(color, start, end, top, bottom, transparency) {
obj_index++;
command = "set object " + obj_index + " rect";
command += " from " + start + ", " + top;
command += " to " + end + ", " + bottom;
command += " fc rgb \"" + color + "\"";
if (transparency) {
command += " fs transparent solid " + transparency;
}
output(command);
}
......@@ -430,6 +441,13 @@ function PlotScriptComposer(kResX, kResY, error_output) {
deopt.size / max_deopt_size * kMaxDeoptLength);
}
// Plot current time polls.
if (gettime.length > 1) {
var start = gettime[0];
var end = gettime.pop();
DrawBarBase("#0000BB", start, end, kGetTimeHeight, 0, 0.2);
}
// Name Y-axis.
var ytics = [];
for (name in TimerEvents) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment