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

Side by Side Diff: src/profile-generator.cc

Issue 18053004: CpuProfiler: eliminate 2 layers of 4 for CodeCreateEvent calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: win32 compile error was fixed Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | src/profile-generator-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
838 void CpuProfilesCollection::AddPathToCurrentProfiles( 790 void CpuProfilesCollection::AddPathToCurrentProfiles(
839 const Vector<CodeEntry*>& path) { 791 const Vector<CodeEntry*>& path) {
840 // As starting / stopping profiles is rare relatively to this 792 // As starting / stopping profiles is rare relatively to this
841 // method, we don't bother minimizing the duration of lock holding, 793 // method, we don't bother minimizing the duration of lock holding,
842 // e.g. copying contents of the list to a local vector. 794 // e.g. copying contents of the list to a local vector.
843 current_profiles_semaphore_->Wait(); 795 current_profiles_semaphore_->Wait();
844 for (int i = 0; i < current_profiles_.length(); ++i) { 796 for (int i = 0; i < current_profiles_.length(); ++i) {
845 current_profiles_[i]->AddPath(path); 797 current_profiles_[i]->AddPath(path);
846 } 798 }
847 current_profiles_semaphore_->Signal(); 799 current_profiles_semaphore_->Signal();
848 } 800 }
849 801
850 802
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
851 void SampleRateCalculator::Tick() { 821 void SampleRateCalculator::Tick() {
852 if (--wall_time_query_countdown_ == 0) 822 if (--wall_time_query_countdown_ == 0)
853 UpdateMeasurements(OS::TimeCurrentMillis()); 823 UpdateMeasurements(OS::TimeCurrentMillis());
854 } 824 }
855 825
856 826
857 void SampleRateCalculator::UpdateMeasurements(double current_time) { 827 void SampleRateCalculator::UpdateMeasurements(double current_time) {
858 if (measurements_count_++ != 0) { 828 if (measurements_count_++ != 0) {
859 const double measured_ticks_per_ms = 829 const double measured_ticks_per_ms =
860 (kWallTimeQueryIntervalMs * ticks_per_ms_) / 830 (kWallTimeQueryIntervalMs * ticks_per_ms_) /
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 if (no_symbolized_entries) { 916 if (no_symbolized_entries) {
947 *entry++ = EntryForVMState(sample.state); 917 *entry++ = EntryForVMState(sample.state);
948 } 918 }
949 } 919 }
950 920
951 profiles_->AddPathToCurrentProfiles(entries); 921 profiles_->AddPathToCurrentProfiles(entries);
952 } 922 }
953 923
954 924
955 } } // namespace v8::internal 925 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | src/profile-generator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698