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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 void AfterAllChildrenTraversed(ProfileNode* node) { | 292 void AfterAllChildrenTraversed(ProfileNode* node) { |
293 delete node; | 293 delete node; |
294 } | 294 } |
295 | 295 |
296 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } | 296 void AfterChildTraversed(ProfileNode*, ProfileNode*) { } |
297 }; | 297 }; |
298 | 298 |
299 | 299 |
300 ProfileTree::ProfileTree() | 300 ProfileTree::ProfileTree() |
301 : root_entry_(Logger::FUNCTION_TAG, "(root)"), | 301 : root_entry_(Logger::FUNCTION_TAG, "", "(root)"), |
302 next_node_id_(1), | 302 next_node_id_(1), |
303 root_(new ProfileNode(this, &root_entry_)) { | 303 root_(new ProfileNode(this, &root_entry_)) { |
304 } | 304 } |
305 | 305 |
306 | 306 |
307 ProfileTree::~ProfileTree() { | 307 ProfileTree::~ProfileTree() { |
308 DeleteNodesCallback cb; | 308 DeleteNodesCallback cb; |
309 TraverseDepthFirst(&cb); | 309 TraverseDepthFirst(&cb); |
310 } | 310 } |
311 | 311 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 const int current_count = unabridged_list->length(); | 780 const int current_count = unabridged_list->length(); |
781 for (int i = 0; i < current_count; ++i) { | 781 for (int i = 0; i < current_count; ++i) { |
782 if (list->at(i) == NULL) { | 782 if (list->at(i) == NULL) { |
783 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); | 783 (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); |
784 } | 784 } |
785 } | 785 } |
786 return list; | 786 return list; |
787 } | 787 } |
788 | 788 |
789 | 789 |
| 790 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
| 791 Name* name, |
| 792 String* resource_name, |
| 793 int line_number) { |
| 794 CodeEntry* entry = new CodeEntry(tag, |
| 795 CodeEntry::kEmptyNamePrefix, |
| 796 GetFunctionName(name), |
| 797 TokenEnumerator::kNoSecurityToken, |
| 798 GetName(resource_name), |
| 799 line_number); |
| 800 code_entries_.Add(entry); |
| 801 return entry; |
| 802 } |
| 803 |
| 804 |
| 805 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
| 806 const char* name) { |
| 807 CodeEntry* entry = new CodeEntry(tag, |
| 808 CodeEntry::kEmptyNamePrefix, |
| 809 GetFunctionName(name)); |
| 810 code_entries_.Add(entry); |
| 811 return entry; |
| 812 } |
| 813 |
| 814 |
| 815 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
| 816 const char* name_prefix, |
| 817 Name* name) { |
| 818 CodeEntry* entry = new CodeEntry(tag, |
| 819 name_prefix, |
| 820 GetName(name), |
| 821 TokenEnumerator::kInheritsSecurityToken); |
| 822 code_entries_.Add(entry); |
| 823 return entry; |
| 824 } |
| 825 |
| 826 |
| 827 CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag, |
| 828 int args_count) { |
| 829 CodeEntry* entry = new CodeEntry(tag, |
| 830 "args_count: ", |
| 831 GetName(args_count), |
| 832 TokenEnumerator::kInheritsSecurityToken); |
| 833 code_entries_.Add(entry); |
| 834 return entry; |
| 835 } |
| 836 |
| 837 |
790 void CpuProfilesCollection::AddPathToCurrentProfiles( | 838 void CpuProfilesCollection::AddPathToCurrentProfiles( |
791 const Vector<CodeEntry*>& path) { | 839 const Vector<CodeEntry*>& path) { |
792 // As starting / stopping profiles is rare relatively to this | 840 // As starting / stopping profiles is rare relatively to this |
793 // method, we don't bother minimizing the duration of lock holding, | 841 // method, we don't bother minimizing the duration of lock holding, |
794 // e.g. copying contents of the list to a local vector. | 842 // e.g. copying contents of the list to a local vector. |
795 current_profiles_semaphore_->Wait(); | 843 current_profiles_semaphore_->Wait(); |
796 for (int i = 0; i < current_profiles_.length(); ++i) { | 844 for (int i = 0; i < current_profiles_.length(); ++i) { |
797 current_profiles_[i]->AddPath(path); | 845 current_profiles_[i]->AddPath(path); |
798 } | 846 } |
799 current_profiles_semaphore_->Signal(); | 847 current_profiles_semaphore_->Signal(); |
800 } | 848 } |
801 | 849 |
802 | 850 |
803 CodeEntry* CpuProfilesCollection::NewCodeEntry( | |
804 Logger::LogEventsAndTags tag, | |
805 const char* name, | |
806 int security_token_id, | |
807 const char* name_prefix, | |
808 const char* resource_name, | |
809 int line_number) { | |
810 CodeEntry* code_entry = new CodeEntry(tag, | |
811 name, | |
812 security_token_id, | |
813 name_prefix, | |
814 resource_name, | |
815 line_number); | |
816 code_entries_.Add(code_entry); | |
817 return code_entry; | |
818 } | |
819 | |
820 | |
821 void SampleRateCalculator::Tick() { | 851 void SampleRateCalculator::Tick() { |
822 if (--wall_time_query_countdown_ == 0) | 852 if (--wall_time_query_countdown_ == 0) |
823 UpdateMeasurements(OS::TimeCurrentMillis()); | 853 UpdateMeasurements(OS::TimeCurrentMillis()); |
824 } | 854 } |
825 | 855 |
826 | 856 |
827 void SampleRateCalculator::UpdateMeasurements(double current_time) { | 857 void SampleRateCalculator::UpdateMeasurements(double current_time) { |
828 if (measurements_count_++ != 0) { | 858 if (measurements_count_++ != 0) { |
829 const double measured_ticks_per_ms = | 859 const double measured_ticks_per_ms = |
830 (kWallTimeQueryIntervalMs * ticks_per_ms_) / | 860 (kWallTimeQueryIntervalMs * ticks_per_ms_) / |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 if (no_symbolized_entries) { | 946 if (no_symbolized_entries) { |
917 *entry++ = EntryForVMState(sample.state); | 947 *entry++ = EntryForVMState(sample.state); |
918 } | 948 } |
919 } | 949 } |
920 | 950 |
921 profiles_->AddPathToCurrentProfiles(entries); | 951 profiles_->AddPathToCurrentProfiles(entries); |
922 } | 952 } |
923 | 953 |
924 | 954 |
925 } } // namespace v8::internal | 955 } } // namespace v8::internal |
OLD | NEW |