From: yurys@chromium.org Date: Thu, 8 Aug 2013 13:39:57 +0000 (+0000) Subject: Deprecate self and total time getters and total sample count getter on CpuProfileNode X-Git-Tag: upstream/4.7.83~12997 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=122327d1c676ec1c6be38b8a9553f551448db0aa;p=platform%2Fupstream%2Fv8.git Deprecate self and total time getters and total sample count getter on CpuProfileNode All of these values are derived from the self samples count and there is no need to evaluate them in v8 when clients can do that when needed on their side. Also added unsigned GetHitCount() which should be used instead of double GetSelfSamplesCount(). I'm going to deprecate the latter one once Blink has switched to GetHitCount. BUG=267595 R=loislo@chromium.org, svenpanne@chromium.org Review URL: https://codereview.chromium.org/22347003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16116 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8-profiler.h b/include/v8-profiler.h index f2128ce..e538f4a 100644 --- a/include/v8-profiler.h +++ b/include/v8-profiler.h @@ -61,20 +61,27 @@ class V8_EXPORT CpuProfileNode { * Returns total (self + children) execution time of the function, * in milliseconds, estimated by samples count. */ - double GetTotalTime() const; + V8_DEPRECATED(double GetTotalTime() const); /** * Returns self execution time of the function, in milliseconds, * estimated by samples count. */ - double GetSelfTime() const; + V8_DEPRECATED(double GetSelfTime() const); /** Returns the count of samples where function exists. */ - double GetTotalSamplesCount() const; + V8_DEPRECATED(double GetTotalSamplesCount() const); - /** Returns the count of samples where function was currently executing. */ + /** DEPRECATED. Please use GetHitCount instead. + * Returns the count of samples where function was currently executing. + */ double GetSelfSamplesCount() const; + /** + * Returns the count of samples where the function was currently executing. + */ + unsigned GetHitCount() const; + /** Returns function entry UID. */ unsigned GetCallUid() const; diff --git a/src/api.cc b/src/api.cc index c80162a..eb2ffcf 100644 --- a/src/api.cc +++ b/src/api.cc @@ -7477,8 +7477,6 @@ Handle CpuProfileNode::GetFunctionName() const { int CpuProfileNode::GetScriptId() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptId"); const i::ProfileNode* node = reinterpret_cast(this); const i::CodeEntry* entry = node->entry(); return entry->script_id(); @@ -7495,8 +7493,6 @@ Handle CpuProfileNode::GetScriptResourceName() const { int CpuProfileNode::GetLineNumber() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); return reinterpret_cast(this)->entry()->line_number(); } @@ -7529,9 +7525,12 @@ double CpuProfileNode::GetSelfSamplesCount() const { } +unsigned CpuProfileNode::GetHitCount() const { + return reinterpret_cast(this)->self_ticks(); +} + + unsigned CpuProfileNode::GetCallUid() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); return reinterpret_cast(this)->entry()->GetCallUid(); } @@ -7542,15 +7541,11 @@ unsigned CpuProfileNode::GetNodeId() const { int CpuProfileNode::GetChildrenCount() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); return reinterpret_cast(this)->children()->length(); } const CpuProfileNode* CpuProfileNode::GetChild(int index) const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); const i::ProfileNode* child = reinterpret_cast(this)->children()->at(index); return reinterpret_cast(child); @@ -7571,8 +7566,6 @@ void CpuProfile::Delete() { unsigned CpuProfile::GetUid() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); return reinterpret_cast(this)->uid(); } @@ -7587,8 +7580,6 @@ Handle CpuProfile::GetTitle() const { const CpuProfileNode* CpuProfile::GetTopDownRoot() const { - i::Isolate* isolate = i::Isolate::Current(); - IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); const i::CpuProfile* profile = reinterpret_cast(this); return reinterpret_cast(profile->top_down()->root()); } diff --git a/src/profile-generator.cc b/src/profile-generator.cc index 018973b..86bd17b 100644 --- a/src/profile-generator.cc +++ b/src/profile-generator.cc @@ -220,7 +220,7 @@ double ProfileNode::GetTotalMillis() const { void ProfileNode::Print(int indent) { - OS::Print("%5u %5u %*c %s%s #%d %d", + OS::Print("%5u %5u %*c %s%s %d #%d", total_ticks_, self_ticks_, indent, ' ', entry_->name_prefix(), diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 2c3f3ed..7b5fc2b 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -1369,11 +1369,13 @@ TEST(IdleTime) { GetChild(root, ProfileGenerator::kProgramEntryName); CHECK_EQ(0, programNode->GetChildrenCount()); CHECK_GE(programNode->GetSelfSamplesCount(), 3); + CHECK_GE(programNode->GetHitCount(), 3); const v8::CpuProfileNode* idleNode = GetChild(root, ProfileGenerator::kIdleEntryName); CHECK_EQ(0, idleNode->GetChildrenCount()); CHECK_GE(idleNode->GetSelfSamplesCount(), 3); + CHECK_GE(idleNode->GetHitCount(), 3); cpu_profiler->DeleteAllCpuProfiles(); }