Index: runtime/vm/timeline_analysis.cc |
diff --git a/runtime/vm/timeline_analysis.cc b/runtime/vm/timeline_analysis.cc |
index 57738ca177f45baf760f0c335dfc41f961fd119b..b0b0e3f325b30656af1ee8eee24e6a3bb0e76914 100644 |
--- a/runtime/vm/timeline_analysis.cc |
+++ b/runtime/vm/timeline_analysis.cc |
@@ -18,15 +18,12 @@ DECLARE_FLAG(bool, timing); |
TimelineAnalysisThread::TimelineAnalysisThread(ThreadId id) : id_(id) {} |
- |
TimelineAnalysisThread::~TimelineAnalysisThread() {} |
- |
void TimelineAnalysisThread::AddBlock(TimelineEventBlock* block) { |
blocks_.Add(block); |
} |
- |
static int CompareBlocksLowerTimeBound(TimelineEventBlock* const* a, |
TimelineEventBlock* const* b) { |
ASSERT(a != NULL); |
@@ -36,7 +33,6 @@ static int CompareBlocksLowerTimeBound(TimelineEventBlock* const* a, |
return (*a)->LowerTimeBound() - (*b)->LowerTimeBound(); |
} |
- |
void TimelineAnalysisThread::Finalize() { |
blocks_.Sort(CompareBlocksLowerTimeBound); |
if (FLAG_trace_timeline_analysis) { |
@@ -45,18 +41,15 @@ void TimelineAnalysisThread::Finalize() { |
} |
} |
- |
TimelineAnalysisThreadEventIterator::TimelineAnalysisThreadEventIterator( |
TimelineAnalysisThread* thread) { |
Reset(thread); |
} |
- |
TimelineAnalysisThreadEventIterator::~TimelineAnalysisThreadEventIterator() { |
Reset(NULL); |
} |
- |
void TimelineAnalysisThreadEventIterator::Reset( |
TimelineAnalysisThread* thread) { |
current_ = NULL; |
@@ -74,12 +67,10 @@ void TimelineAnalysisThreadEventIterator::Reset( |
current_ = block->At(event_cursor_++); |
} |
- |
bool TimelineAnalysisThreadEventIterator::HasNext() const { |
return current_ != NULL; |
} |
- |
TimelineEvent* TimelineAnalysisThreadEventIterator::Next() { |
ASSERT(current_ != NULL); |
TimelineEvent* r = current_; |
@@ -102,7 +93,6 @@ TimelineEvent* TimelineAnalysisThreadEventIterator::Next() { |
return r; |
} |
- |
TimelineAnalysis::TimelineAnalysis(Zone* zone, |
Isolate* isolate, |
TimelineEventRecorder* recorder) |
@@ -116,16 +106,13 @@ TimelineAnalysis::TimelineAnalysis(Zone* zone, |
ASSERT(recorder_ != NULL); |
} |
- |
TimelineAnalysis::~TimelineAnalysis() {} |
- |
void TimelineAnalysis::BuildThreads() { |
DiscoverThreads(); |
FinalizeThreads(); |
} |
- |
TimelineAnalysisThread* TimelineAnalysis::GetThread(ThreadId tid) { |
// Linear lookup because we expect N (# of threads in an isolate) to be small. |
for (intptr_t i = 0; i < threads_.length(); i++) { |
@@ -138,7 +125,6 @@ TimelineAnalysisThread* TimelineAnalysis::GetThread(ThreadId tid) { |
return NULL; |
} |
- |
TimelineAnalysisThread* TimelineAnalysis::GetOrAddThread(ThreadId tid) { |
TimelineAnalysisThread* thread = GetThread(tid); |
if (thread != NULL) { |
@@ -150,7 +136,6 @@ TimelineAnalysisThread* TimelineAnalysis::GetOrAddThread(ThreadId tid) { |
return thread; |
} |
- |
void TimelineAnalysis::DiscoverThreads() { |
TimelineEventBlockIterator it(recorder_); |
while (it.HasNext()) { |
@@ -179,7 +164,6 @@ void TimelineAnalysis::DiscoverThreads() { |
} |
} |
- |
void TimelineAnalysis::FinalizeThreads() { |
for (intptr_t i = 0; i < threads_.length(); i++) { |
TimelineAnalysisThread* thread = threads_.At(i); |
@@ -188,7 +172,6 @@ void TimelineAnalysis::FinalizeThreads() { |
} |
} |
- |
void TimelineAnalysis::SetError(const char* format, ...) { |
ASSERT(!has_error_); |
ASSERT(error_msg_ == NULL); |
@@ -202,7 +185,6 @@ void TimelineAnalysis::SetError(const char* format, ...) { |
} |
} |
- |
TimelineLabelPauseInfo::TimelineLabelPauseInfo(const char* name) |
: name_(name), |
inclusive_micros_(0), |
@@ -212,17 +194,14 @@ TimelineLabelPauseInfo::TimelineLabelPauseInfo(const char* name) |
ASSERT(name_ != NULL); |
} |
- |
void TimelineLabelPauseInfo::OnPush(int64_t micros, bool already_on_stack) { |
UpdateInclusiveMicros(micros, already_on_stack); |
} |
- |
void TimelineLabelPauseInfo::OnPop(int64_t exclusive_micros) { |
UpdateExclusiveMicros(exclusive_micros); |
} |
- |
void TimelineLabelPauseInfo::OnBeginPop(int64_t inclusive_micros, |
int64_t exclusive_micros, |
bool already_on_stack) { |
@@ -230,7 +209,6 @@ void TimelineLabelPauseInfo::OnBeginPop(int64_t inclusive_micros, |
UpdateExclusiveMicros(exclusive_micros); |
} |
- |
void TimelineLabelPauseInfo::UpdateInclusiveMicros(int64_t inclusive_micros, |
bool already_on_stack) { |
if (!already_on_stack) { |
@@ -242,7 +220,6 @@ void TimelineLabelPauseInfo::UpdateInclusiveMicros(int64_t inclusive_micros, |
} |
} |
- |
void TimelineLabelPauseInfo::UpdateExclusiveMicros(int64_t exclusive_micros) { |
add_exclusive_micros(exclusive_micros); |
if (exclusive_micros > max_exclusive_micros_) { |
@@ -250,7 +227,6 @@ void TimelineLabelPauseInfo::UpdateExclusiveMicros(int64_t exclusive_micros) { |
} |
} |
- |
void TimelineLabelPauseInfo::Aggregate( |
const TimelineLabelPauseInfo* thread_pause_info) { |
ASSERT(thread_pause_info != NULL); |
@@ -264,18 +240,15 @@ void TimelineLabelPauseInfo::Aggregate( |
} |
} |
- |
TimelinePauses::TimelinePauses(Zone* zone, |
Isolate* isolate, |
TimelineEventRecorder* recorder) |
: TimelineAnalysis(zone, isolate, recorder) {} |
- |
void TimelinePauses::Setup() { |
BuildThreads(); |
} |
- |
void TimelinePauses::CalculatePauseTimesForThread(ThreadId tid) { |
if (has_error()) { |
return; |
@@ -288,7 +261,6 @@ void TimelinePauses::CalculatePauseTimesForThread(ThreadId tid) { |
ProcessThread(thread); |
} |
- |
TimelineLabelPauseInfo* TimelinePauses::GetLabelPauseInfo( |
const char* name) const { |
ASSERT(name != NULL); |
@@ -302,35 +274,30 @@ TimelineLabelPauseInfo* TimelinePauses::GetLabelPauseInfo( |
return NULL; |
} |
- |
int64_t TimelinePauses::InclusiveTime(const char* name) const { |
TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); |
ASSERT(pause_info != NULL); |
return pause_info->inclusive_micros(); |
} |
- |
int64_t TimelinePauses::ExclusiveTime(const char* name) const { |
TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); |
ASSERT(pause_info != NULL); |
return pause_info->exclusive_micros(); |
} |
- |
int64_t TimelinePauses::MaxInclusiveTime(const char* name) const { |
TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); |
ASSERT(pause_info != NULL); |
return pause_info->max_inclusive_micros(); |
} |
- |
int64_t TimelinePauses::MaxExclusiveTime(const char* name) const { |
TimelineLabelPauseInfo* pause_info = GetLabelPauseInfo(name); |
ASSERT(pause_info != NULL); |
return pause_info->max_exclusive_micros(); |
} |
- |
void TimelinePauses::ProcessThread(TimelineAnalysisThread* thread) { |
ASSERT(thread != NULL); |
stack_.Clear(); |
@@ -379,7 +346,6 @@ void TimelinePauses::ProcessThread(TimelineAnalysisThread* thread) { |
} |
} |
- |
// Verify that |event| is contained within all parent events on the stack. |
bool TimelinePauses::CheckStack(TimelineEvent* event) { |
ASSERT(event != NULL); |
@@ -399,7 +365,6 @@ bool TimelinePauses::CheckStack(TimelineEvent* event) { |
return true; |
} |
- |
void TimelinePauses::PopFinishedDurations(int64_t start) { |
while (stack_.length() > 0) { |
const StackItem& top = stack_.Last(); |
@@ -417,7 +382,6 @@ void TimelinePauses::PopFinishedDurations(int64_t start) { |
} |
} |
- |
void TimelinePauses::PopBegin(const char* label, int64_t end) { |
if (stack_.length() == 0) { |
SetError("PopBegin(%s, ...) called with empty stack.", label); |
@@ -460,7 +424,6 @@ void TimelinePauses::PopBegin(const char* label, int64_t end) { |
} |
} |
- |
void TimelinePauses::Push(TimelineEvent* event) { |
TimelineLabelPauseInfo* pause_info = GetOrAddLabelPauseInfo(event->label()); |
ASSERT(pause_info != NULL); |
@@ -494,7 +457,6 @@ void TimelinePauses::Push(TimelineEvent* event) { |
} |
} |
- |
bool TimelinePauses::IsLabelOnStack(const char* label) const { |
ASSERT(label != NULL); |
for (intptr_t i = 0; i < stack_.length(); i++) { |
@@ -506,18 +468,15 @@ bool TimelinePauses::IsLabelOnStack(const char* label) const { |
return false; |
} |
- |
intptr_t TimelinePauses::StackDepth() const { |
return stack_.length(); |
} |
- |
TimelinePauses::StackItem& TimelinePauses::GetStackTop() { |
ASSERT(stack_.length() > 0); |
return stack_.Last(); |
} |
- |
TimelineLabelPauseInfo* TimelinePauses::GetOrAddLabelPauseInfo( |
const char* name) { |
ASSERT(name != NULL); |
@@ -531,13 +490,10 @@ TimelineLabelPauseInfo* TimelinePauses::GetOrAddLabelPauseInfo( |
return pause_info; |
} |
- |
TimelinePauseTrace::TimelinePauseTrace() {} |
- |
TimelinePauseTrace::~TimelinePauseTrace() {} |
- |
void TimelinePauseTrace::Print() { |
Thread* thread = Thread::Current(); |
ASSERT(thread != NULL); |
@@ -576,7 +532,6 @@ void TimelinePauseTrace::Print() { |
THR_Print("\n"); |
} |
- |
TimelineLabelPauseInfo* TimelinePauseTrace::GetOrAddLabelPauseInfo( |
const char* name) { |
ASSERT(name != NULL); |
@@ -593,7 +548,6 @@ TimelineLabelPauseInfo* TimelinePauseTrace::GetOrAddLabelPauseInfo( |
return pause_info; |
} |
- |
void TimelinePauseTrace::Aggregate( |
const TimelineLabelPauseInfo* thread_pause_info) { |
ASSERT(thread_pause_info != NULL); |
@@ -603,7 +557,6 @@ void TimelinePauseTrace::Aggregate( |
isolate_pause_info->Aggregate(thread_pause_info); |
} |
- |
void TimelinePauseTrace::PrintPauseInfo( |
const TimelineLabelPauseInfo* pause_info) { |
ASSERT(pause_info != NULL); |