Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: src/profile-generator.cc

Issue 1582004: C++ profiles processor: wire up to VM. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index c6b63262c6d0ba56ec01a69cec7ae995e48768ef..e6607606d119191d01a2cdaa1088878c706c4c9d 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -34,6 +34,11 @@
namespace v8 {
namespace internal {
+
+const char* CodeEntry::kEmptyNamePrefix = "";
+const int CodeEntry::kNoLineNumberInfo = -1;
+
+
ProfileNode* ProfileNode::FindChild(CodeEntry* entry) {
HashMap::Entry* map_entry =
children_.Lookup(entry, CodeEntryHash(entry), false);
@@ -56,9 +61,10 @@ ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) {
void ProfileNode::Print(int indent) {
- OS::Print("%5u %5u %*c %s\n",
+ OS::Print("%5u %5u %*c %s%s\n",
total_ticks_, self_ticks_,
indent, ' ',
+ entry_ != NULL ? entry_->name_prefix() : "",
entry_ != NULL ? entry_->name() : "");
for (HashMap::Entry* p = children_.Start();
p != NULL;
@@ -353,6 +359,7 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
String* resource_name,
int line_number) {
CodeEntry* entry = new CodeEntry(tag,
+ CodeEntry::kEmptyNamePrefix,
GetName(name),
GetName(resource_name),
line_number);
@@ -364,9 +371,23 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
const char* name) {
CodeEntry* entry = new CodeEntry(tag,
+ CodeEntry::kEmptyNamePrefix,
name,
"",
- kNoLineNumberInfo);
+ CodeEntry::kNoLineNumberInfo);
+ code_entries_.Add(entry);
+ return entry;
+}
+
+
+CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
+ const char* name_prefix,
+ String* name) {
+ CodeEntry* entry = new CodeEntry(tag,
+ name_prefix,
+ GetName(name),
+ "",
+ CodeEntry::kNoLineNumberInfo);
code_entries_.Add(entry);
return entry;
}
@@ -375,9 +396,10 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
int args_count) {
CodeEntry* entry = new CodeEntry(tag,
+ "args_count: ",
GetName(args_count),
"",
- kNoLineNumberInfo);
+ CodeEntry::kNoLineNumberInfo);
code_entries_.Add(entry);
return entry;
}
@@ -413,8 +435,7 @@ const char* CpuProfilesCollection::GetName(int args_count) {
if (args_count_names_[args_count] == NULL) {
const int kMaximumNameLength = 32;
char* name = NewArray<char>(kMaximumNameLength);
- OS::SNPrintF(Vector<char>(name, kMaximumNameLength),
- "args_count: %d", args_count);
+ OS::SNPrintF(Vector<char>(name, kMaximumNameLength), "%d", args_count);
args_count_names_[args_count] = name;
}
return args_count_names_[args_count];

Powered by Google App Engine
This is Rietveld 408576698