Remove implementation of CpuProfileNode methods deprecated in v8 3.20

GetTotalTime, GetSelfTime and GetTotalSamplesCount were deprecated in 3.20 (https://code.google.com/p/v8/source/browse/branches/3.20/include/v8-profiler.h) and can be safely removed.

BUG=None
R=bmeurer@chromium.org, loislo@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16367 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yurys@chromium.org 2013-08-27 15:12:04 +00:00
parent 5857d951dd
commit dc670f4412
6 changed files with 2 additions and 158 deletions

View File

@ -57,21 +57,6 @@ class V8_EXPORT CpuProfileNode {
*/
int GetLineNumber() const;
/**
* Returns total (self + children) execution time of the function,
* in milliseconds, estimated by samples count.
*/
V8_DEPRECATED(double GetTotalTime() const);
/**
* Returns self execution time of the function, in milliseconds,
* estimated by samples count.
*/
V8_DEPRECATED(double GetSelfTime() const);
/** Returns the count of samples where function exists. */
V8_DEPRECATED(double GetTotalSamplesCount() const);
/** DEPRECATED. Please use GetHitCount instead.
* Returns the count of samples where function was currently executing.
*/

View File

@ -7295,27 +7295,6 @@ int CpuProfileNode::GetLineNumber() const {
}
double CpuProfileNode::GetTotalTime() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime");
return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis();
}
double CpuProfileNode::GetSelfTime() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime");
return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis();
}
double CpuProfileNode::GetTotalSamplesCount() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount");
return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks();
}
double CpuProfileNode::GetSelfSamplesCount() const {
i::Isolate* isolate = i::Isolate::Current();
IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount");

View File

@ -73,7 +73,6 @@ bool CodeEntry::is_js_function_tag(Logger::LogEventsAndTags tag) {
ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry)
: tree_(tree),
entry_(entry),
total_ticks_(0),
self_ticks_(0),
children_(CodeEntriesMatch),
id_(tree->next_node_id()) {

View File

@ -209,19 +209,9 @@ ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) {
}
double ProfileNode::GetSelfMillis() const {
return tree_->TicksToMillis(self_ticks_);
}
double ProfileNode::GetTotalMillis() const {
return tree_->TicksToMillis(total_ticks_);
}
void ProfileNode::Print(int indent) {
OS::Print("%5u %5u %*c %s%s %d #%d",
total_ticks_, self_ticks_,
OS::Print("%5u %*c %s%s %d #%d",
self_ticks_,
indent, ' ',
entry_->name_prefix(),
entry_->name(),
@ -298,11 +288,6 @@ struct NodesPair {
};
void ProfileTree::SetTickRatePerMs(double ticks_per_ms) {
ms_to_ticks_scale_ = ticks_per_ms > 0 ? 1.0 / ticks_per_ms : 1.0;
}
class Position {
public:
explicit Position(ProfileNode* node)
@ -345,33 +330,6 @@ void ProfileTree::TraverseDepthFirst(Callback* callback) {
}
class CalculateTotalTicksCallback {
public:
void BeforeTraversingChild(ProfileNode*, ProfileNode*) { }
void AfterAllChildrenTraversed(ProfileNode* node) {
node->IncreaseTotalTicks(node->self_ticks());
}
void AfterChildTraversed(ProfileNode* parent, ProfileNode* child) {
parent->IncreaseTotalTicks(child->total_ticks());
}
};
void ProfileTree::CalculateTotalTicks() {
CalculateTotalTicksCallback cb;
TraverseDepthFirst(&cb);
}
void ProfileTree::ShortPrint() {
OS::Print("root: %u %u %.2fms %.2fms\n",
root_->total_ticks(), root_->self_ticks(),
root_->GetTotalMillis(), root_->GetSelfMillis());
}
CpuProfile::CpuProfile(const char* title, unsigned uid, bool record_samples)
: title_(title),
uid_(uid),
@ -389,19 +347,6 @@ void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
void CpuProfile::CalculateTotalTicksAndSamplingRate() {
end_time_us_ = OS::Ticks();
top_down_.CalculateTotalTicks();
double duration_ms = (end_time_us_ - start_time_us_) / 1000.;
if (duration_ms < 1) duration_ms = 1;
unsigned ticks = top_down_.root()->total_ticks();
double rate = ticks / duration_ms;
top_down_.SetTickRatePerMs(rate);
}
void CpuProfile::ShortPrint() {
OS::Print("top down ");
top_down_.ShortPrint();
}

View File

@ -131,14 +131,10 @@ class ProfileNode {
ProfileNode* FindOrAddChild(CodeEntry* entry);
INLINE(void IncrementSelfTicks()) { ++self_ticks_; }
INLINE(void IncreaseSelfTicks(unsigned amount)) { self_ticks_ += amount; }
INLINE(void IncreaseTotalTicks(unsigned amount)) { total_ticks_ += amount; }
INLINE(CodeEntry* entry() const) { return entry_; }
INLINE(unsigned self_ticks() const) { return self_ticks_; }
INLINE(unsigned total_ticks() const) { return total_ticks_; }
INLINE(const List<ProfileNode*>* children() const) { return &children_list_; }
double GetSelfMillis() const;
double GetTotalMillis() const;
unsigned id() const { return id_; }
void Print(int indent);
@ -155,7 +151,6 @@ class ProfileNode {
ProfileTree* tree_;
CodeEntry* entry_;
unsigned total_ticks_;
unsigned self_ticks_;
// Mapping from CodeEntry* to ProfileNode*
HashMap children_;
@ -173,17 +168,9 @@ class ProfileTree {
ProfileNode* AddPathFromEnd(const Vector<CodeEntry*>& path);
void AddPathFromStart(const Vector<CodeEntry*>& path);
void CalculateTotalTicks();
double TicksToMillis(unsigned ticks) const {
return ticks * ms_to_ticks_scale_;
}
ProfileNode* root() const { return root_; }
void SetTickRatePerMs(double ticks_per_ms);
unsigned next_node_id() { return next_node_id_++; }
void ShortPrint();
void Print() {
root_->Print(0);
}
@ -195,7 +182,6 @@ class ProfileTree {
CodeEntry root_entry_;
unsigned next_node_id_;
ProfileNode* root_;
double ms_to_ticks_scale_;
DISALLOW_COPY_AND_ASSIGN(ProfileTree);
};
@ -221,7 +207,6 @@ class CpuProfile {
void UpdateTicksScale();
void ShortPrint();
void Print();
private:

View File

@ -132,14 +132,12 @@ TEST(ProfileTreeAddPathFromStart) {
CHECK_EQ(NULL, helper.Walk(&entry3));
ProfileNode* node1 = helper.Walk(&entry1);
CHECK_NE(NULL, node1);
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(0, node1->self_ticks());
CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
ProfileNode* node2 = helper.Walk(&entry1, &entry2);
CHECK_NE(NULL, node2);
CHECK_NE(node1, node2);
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(0, node2->self_ticks());
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
@ -147,18 +145,14 @@ TEST(ProfileTreeAddPathFromStart) {
CHECK_NE(NULL, node3);
CHECK_NE(node1, node3);
CHECK_NE(node2, node3);
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(1, node3->self_ticks());
tree.AddPathFromStart(path_vec);
CHECK_EQ(node1, helper.Walk(&entry1));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(0, node1->self_ticks());
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(0, node2->self_ticks());
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(2, node3->self_ticks());
CodeEntry* path2[] = {&entry1, &entry2, &entry2};
@ -172,12 +166,10 @@ TEST(ProfileTreeAddPathFromStart) {
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(2, node3->self_ticks());
ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
CHECK_NE(NULL, node4);
CHECK_NE(node3, node4);
CHECK_EQ(0, node4->total_ticks());
CHECK_EQ(1, node4->self_ticks());
}
@ -199,14 +191,12 @@ TEST(ProfileTreeAddPathFromEnd) {
CHECK_EQ(NULL, helper.Walk(&entry3));
ProfileNode* node1 = helper.Walk(&entry1);
CHECK_NE(NULL, node1);
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(0, node1->self_ticks());
CHECK_EQ(NULL, helper.Walk(&entry1, &entry1));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry3));
ProfileNode* node2 = helper.Walk(&entry1, &entry2);
CHECK_NE(NULL, node2);
CHECK_NE(node1, node2);
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(0, node2->self_ticks());
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry2));
@ -214,18 +204,14 @@ TEST(ProfileTreeAddPathFromEnd) {
CHECK_NE(NULL, node3);
CHECK_NE(node1, node3);
CHECK_NE(node2, node3);
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(1, node3->self_ticks());
tree.AddPathFromEnd(path_vec);
CHECK_EQ(node1, helper.Walk(&entry1));
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(0, node1->self_ticks());
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(0, node2->self_ticks());
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(2, node3->self_ticks());
CodeEntry* path2[] = {&entry2, &entry2, &entry1};
@ -239,28 +225,18 @@ TEST(ProfileTreeAddPathFromEnd) {
CHECK_EQ(node2, helper.Walk(&entry1, &entry2));
CHECK_EQ(NULL, helper.Walk(&entry1, &entry2, &entry1));
CHECK_EQ(node3, helper.Walk(&entry1, &entry2, &entry3));
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(2, node3->self_ticks());
ProfileNode* node4 = helper.Walk(&entry1, &entry2, &entry2);
CHECK_NE(NULL, node4);
CHECK_NE(node3, node4);
CHECK_EQ(0, node4->total_ticks());
CHECK_EQ(1, node4->self_ticks());
}
TEST(ProfileTreeCalculateTotalTicks) {
ProfileTree empty_tree;
CHECK_EQ(0, empty_tree.root()->total_ticks());
CHECK_EQ(0, empty_tree.root()->self_ticks());
empty_tree.CalculateTotalTicks();
CHECK_EQ(0, empty_tree.root()->total_ticks());
CHECK_EQ(0, empty_tree.root()->self_ticks());
empty_tree.root()->IncrementSelfTicks();
CHECK_EQ(0, empty_tree.root()->total_ticks());
CHECK_EQ(1, empty_tree.root()->self_ticks());
empty_tree.CalculateTotalTicks();
CHECK_EQ(1, empty_tree.root()->total_ticks());
CHECK_EQ(1, empty_tree.root()->self_ticks());
CodeEntry entry1(i::Logger::FUNCTION_TAG, "aaa");
@ -271,17 +247,11 @@ TEST(ProfileTreeCalculateTotalTicks) {
ProfileTree single_child_tree;
single_child_tree.AddPathFromStart(e1_path_vec);
single_child_tree.root()->IncrementSelfTicks();
CHECK_EQ(0, single_child_tree.root()->total_ticks());
CHECK_EQ(1, single_child_tree.root()->self_ticks());
ProfileTreeTestHelper single_child_helper(&single_child_tree);
ProfileNode* node1 = single_child_helper.Walk(&entry1);
CHECK_NE(NULL, node1);
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(1, node1->self_ticks());
single_child_tree.CalculateTotalTicks();
CHECK_EQ(2, single_child_tree.root()->total_ticks());
CHECK_EQ(1, single_child_tree.root()->self_ticks());
CHECK_EQ(1, node1->total_ticks());
CHECK_EQ(1, node1->self_ticks());
CodeEntry entry2(i::Logger::FUNCTION_TAG, "bbb");
@ -297,24 +267,16 @@ TEST(ProfileTreeCalculateTotalTicks) {
flat_tree.AddPathFromStart(e1_e2_path_vec);
flat_tree.AddPathFromStart(e1_e2_path_vec);
// Results in {root,0,0} -> {entry1,0,2} -> {entry2,0,3}
CHECK_EQ(0, flat_tree.root()->total_ticks());
CHECK_EQ(0, flat_tree.root()->self_ticks());
node1 = flat_helper.Walk(&entry1);
CHECK_NE(NULL, node1);
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(2, node1->self_ticks());
ProfileNode* node2 = flat_helper.Walk(&entry1, &entry2);
CHECK_NE(NULL, node2);
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(3, node2->self_ticks());
flat_tree.CalculateTotalTicks();
// Must calculate {root,5,0} -> {entry1,5,2} -> {entry2,3,3}
CHECK_EQ(5, flat_tree.root()->total_ticks());
CHECK_EQ(0, flat_tree.root()->self_ticks());
CHECK_EQ(5, node1->total_ticks());
CHECK_EQ(2, node1->self_ticks());
CHECK_EQ(3, node2->total_ticks());
CHECK_EQ(3, node2->self_ticks());
CodeEntry* e2_path[] = {&entry2};
Vector<CodeEntry*> e2_path_vec(
@ -339,37 +301,26 @@ TEST(ProfileTreeCalculateTotalTicks) {
// Results in -> {entry1,0,2} -> {entry2,0,1}
// {root,0,0} -> {entry2,0,3}
// -> {entry3,0,4}
CHECK_EQ(0, wide_tree.root()->total_ticks());
CHECK_EQ(0, wide_tree.root()->self_ticks());
node1 = wide_helper.Walk(&entry1);
CHECK_NE(NULL, node1);
CHECK_EQ(0, node1->total_ticks());
CHECK_EQ(2, node1->self_ticks());
ProfileNode* node1_2 = wide_helper.Walk(&entry1, &entry2);
CHECK_NE(NULL, node1_2);
CHECK_EQ(0, node1_2->total_ticks());
CHECK_EQ(1, node1_2->self_ticks());
node2 = wide_helper.Walk(&entry2);
CHECK_NE(NULL, node2);
CHECK_EQ(0, node2->total_ticks());
CHECK_EQ(3, node2->self_ticks());
ProfileNode* node3 = wide_helper.Walk(&entry3);
CHECK_NE(NULL, node3);
CHECK_EQ(0, node3->total_ticks());
CHECK_EQ(4, node3->self_ticks());
wide_tree.CalculateTotalTicks();
// Calculates -> {entry1,3,2} -> {entry2,1,1}
// {root,10,0} -> {entry2,3,3}
// -> {entry3,4,4}
CHECK_EQ(10, wide_tree.root()->total_ticks());
CHECK_EQ(0, wide_tree.root()->self_ticks());
CHECK_EQ(3, node1->total_ticks());
CHECK_EQ(2, node1->self_ticks());
CHECK_EQ(1, node1_2->total_ticks());
CHECK_EQ(1, node1_2->self_ticks());
CHECK_EQ(3, node2->total_ticks());
CHECK_EQ(3, node2->self_ticks());
CHECK_EQ(4, node3->total_ticks());
CHECK_EQ(4, node3->self_ticks());
}