OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 return tree_->TicksToMillis(self_ticks_); | 258 return tree_->TicksToMillis(self_ticks_); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 double ProfileNode::GetTotalMillis() const { | 262 double ProfileNode::GetTotalMillis() const { |
263 return tree_->TicksToMillis(total_ticks_); | 263 return tree_->TicksToMillis(total_ticks_); |
264 } | 264 } |
265 | 265 |
266 | 266 |
267 void ProfileNode::Print(int indent) { | 267 void ProfileNode::Print(int indent) { |
268 OS::Print("%5u %5u %*c %s%s [%d] #%d", | 268 OS::Print("%5u %5u %*c %s%s [%d] #%d %d", |
269 total_ticks_, self_ticks_, | 269 total_ticks_, self_ticks_, |
270 indent, ' ', | 270 indent, ' ', |
271 entry_->name_prefix(), | 271 entry_->name_prefix(), |
272 entry_->name(), | 272 entry_->name(), |
273 entry_->security_token_id(), | 273 entry_->security_token_id(), |
274 id()); | 274 id(), |
275 entry_->script_id()); | |
yurys
2013/06/25 09:16:55
I'd move this before the node id in the output.
| |
275 if (entry_->resource_name()[0] != '\0') | 276 if (entry_->resource_name()[0] != '\0') |
276 OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); | 277 OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); |
277 OS::Print("\n"); | 278 OS::Print("\n"); |
278 for (HashMap::Entry* p = children_.Start(); | 279 for (HashMap::Entry* p = children_.Start(); |
279 p != NULL; | 280 p != NULL; |
280 p = children_.Next(p)) { | 281 p = children_.Next(p)) { |
281 reinterpret_cast<ProfileNode*>(p->value)->Print(indent + 2); | 282 reinterpret_cast<ProfileNode*>(p->value)->Print(indent + 2); |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 | 286 |
286 class DeleteNodesCallback { | 287 class DeleteNodesCallback { |
287 public: | 288 public: |
288 void BeforeTraversingChild(ProfileNode*, ProfileNode*) { } | 289 void BeforeTraversingChild(ProfileNode*, ProfileNode*) { } |
289 | 290 |
290 void AfterAllChildrenTraversed(ProfileNode* node) { | 291 void AfterAllChildrenTraversed(ProfileNode* node) { |
291 delete node; | 292 delete node; |
292 } | 293 } |
293 | 294 |
294 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } | 295 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } |
295 }; | 296 }; |
296 | 297 |
297 | 298 |
298 ProfileTree::ProfileTree() | 299 ProfileTree::ProfileTree() |
299 : root_entry_(Logger::FUNCTION_TAG, | 300 : root_entry_(Logger::FUNCTION_TAG, |
300 "", | 301 "", |
301 "(root)", | 302 "(root)", |
303 v8::CpuProfileNode::kNoScriptId, | |
302 "", | 304 "", |
303 0, | 305 0, |
304 TokenEnumerator::kNoSecurityToken), | 306 TokenEnumerator::kNoSecurityToken), |
305 next_node_id_(1), | 307 next_node_id_(1), |
306 root_(new ProfileNode(this, &root_entry_)) { | 308 root_(new ProfileNode(this, &root_entry_)) { |
307 } | 309 } |
308 | 310 |
309 | 311 |
310 ProfileTree::~ProfileTree() { | 312 ProfileTree::~ProfileTree() { |
311 DeleteNodesCallback cb; | 313 DeleteNodesCallback cb; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
785 if (list->at(i) == NULL) { | 787 if (list->at(i) == NULL) { |
786 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); | 788 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); |
787 } | 789 } |
788 } | 790 } |
789 return list; | 791 return list; |
790 } | 792 } |
791 | 793 |
792 | 794 |
793 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, | 795 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
794 Name* name, | 796 Name* name, |
797 int script_id, | |
795 String* resource_name, | 798 String* resource_name, |
796 int line_number) { | 799 int line_number) { |
797 CodeEntry* entry = new CodeEntry(tag, | 800 CodeEntry* entry = new CodeEntry(tag, |
798 CodeEntry::kEmptyNamePrefix, | 801 CodeEntry::kEmptyNamePrefix, |
799 GetFunctionName(name), | 802 GetFunctionName(name), |
803 script_id, | |
800 GetName(resource_name), | 804 GetName(resource_name), |
801 line_number, | 805 line_number, |
802 TokenEnumerator::kNoSecurityToken); | 806 TokenEnumerator::kNoSecurityToken); |
803 code_entries_.Add(entry); | 807 code_entries_.Add(entry); |
804 return entry; | 808 return entry; |
805 } | 809 } |
806 | 810 |
807 | 811 |
808 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, | 812 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
809 const char* name) { | 813 const char* name) { |
810 CodeEntry* entry = new CodeEntry(tag, | 814 CodeEntry* entry = new CodeEntry(tag, |
811 CodeEntry::kEmptyNamePrefix, | 815 CodeEntry::kEmptyNamePrefix, |
812 GetFunctionName(name), | 816 GetFunctionName(name), |
817 v8::CpuProfileNode::kNoScriptId, | |
813 "", | 818 "", |
814 v8::CpuProfileNode::kNoLineNumberInfo, | 819 v8::CpuProfileNode::kNoLineNumberInfo, |
815 TokenEnumerator::kNoSecurityToken); | 820 TokenEnumerator::kNoSecurityToken); |
816 code_entries_.Add(entry); | 821 code_entries_.Add(entry); |
817 return entry; | 822 return entry; |
818 } | 823 } |
819 | 824 |
820 | 825 |
821 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, | 826 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
822 const char* name_prefix, | 827 const char* name_prefix, |
823 Name* name) { | 828 Name* name) { |
824 CodeEntry* entry = new CodeEntry(tag, | 829 CodeEntry* entry = new CodeEntry(tag, |
825 name_prefix, | 830 name_prefix, |
826 GetName(name), | 831 GetName(name), |
832 v8::CpuProfileNode::kNoScriptId, | |
827 "", | 833 "", |
828 v8::CpuProfileNode::kNoLineNumberInfo, | 834 v8::CpuProfileNode::kNoLineNumberInfo, |
829 TokenEnumerator::kInheritsSecurityToken); | 835 TokenEnumerator::kInheritsSecurityToken); |
830 code_entries_.Add(entry); | 836 code_entries_.Add(entry); |
831 return entry; | 837 return entry; |
832 } | 838 } |
833 | 839 |
834 | 840 |
835 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, | 841 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
836 int args_count) { | 842 int args_count) { |
837 CodeEntry* entry = new CodeEntry(tag, | 843 CodeEntry* entry = new CodeEntry(tag, |
838 "args_count: ", | 844 "args_count: ", |
839 GetName(args_count), | 845 GetName(args_count), |
846 v8::CpuProfileNode::kNoScriptId, | |
840 "", | 847 "", |
841 v8::CpuProfileNode::kNoLineNumberInfo, | 848 v8::CpuProfileNode::kNoLineNumberInfo, |
842 TokenEnumerator::kInheritsSecurityToken); | 849 TokenEnumerator::kInheritsSecurityToken); |
843 code_entries_.Add(entry); | 850 code_entries_.Add(entry); |
844 return entry; | 851 return entry; |
845 } | 852 } |
846 | 853 |
847 | 854 |
848 void CpuProfilesCollection::AddPathToCurrentProfiles( | 855 void CpuProfilesCollection::AddPathToCurrentProfiles( |
849 const Vector<CodeEntry*>& path) { | 856 const Vector<CodeEntry*>& path) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 if (no_symbolized_entries) { | 963 if (no_symbolized_entries) { |
957 *entry++ = EntryForVMState(sample.state); | 964 *entry++ = EntryForVMState(sample.state); |
958 } | 965 } |
959 } | 966 } |
960 | 967 |
961 profiles_->AddPathToCurrentProfiles(entries); | 968 profiles_->AddPathToCurrentProfiles(entries); |
962 } | 969 } |
963 | 970 |
964 | 971 |
965 } } // namespace v8::internal | 972 } } // namespace v8::internal |
OLD | NEW |