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

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

Issue 3287005: CPU profiler: limit the number of simultaneously collected profiles. (Closed)
Patch Set: Created 10 years, 3 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
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-profile-generator.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 current_profiles_.Iterate(DeleteCpuProfile); 485 current_profiles_.Iterate(DeleteCpuProfile);
486 profiles_by_token_.Iterate(DeleteProfilesList); 486 profiles_by_token_.Iterate(DeleteProfilesList);
487 code_entries_.Iterate(DeleteCodeEntry); 487 code_entries_.Iterate(DeleteCodeEntry);
488 args_count_names_.Iterate(DeleteArgsCountName); 488 args_count_names_.Iterate(DeleteArgsCountName);
489 } 489 }
490 490
491 491
492 bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid) { 492 bool CpuProfilesCollection::StartProfiling(const char* title, unsigned uid) {
493 ASSERT(uid > 0); 493 ASSERT(uid > 0);
494 current_profiles_semaphore_->Wait(); 494 current_profiles_semaphore_->Wait();
495 if (current_profiles_.length() >= kMaxSimultaneousProfiles) {
496 current_profiles_semaphore_->Signal();
497 return false;
498 }
495 for (int i = 0; i < current_profiles_.length(); ++i) { 499 for (int i = 0; i < current_profiles_.length(); ++i) {
496 if (strcmp(current_profiles_[i]->title(), title) == 0) { 500 if (strcmp(current_profiles_[i]->title(), title) == 0) {
497 // Ignore attempts to start profile with the same title. 501 // Ignore attempts to start profile with the same title.
498 current_profiles_semaphore_->Signal(); 502 current_profiles_semaphore_->Signal();
499 return false; 503 return false;
500 } 504 }
501 } 505 }
502 current_profiles_.Add(new CpuProfile(title, uid)); 506 current_profiles_.Add(new CpuProfile(title, uid));
503 current_profiles_semaphore_->Signal(); 507 current_profiles_semaphore_->Signal();
504 return true; 508 return true;
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 HeapEntry* entry = added_entries[i]; 2128 HeapEntry* entry = added_entries[i];
2125 if (entry->painted_reachable()) 2129 if (entry->painted_reachable())
2126 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); 2130 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry);
2127 } 2131 }
2128 return diff; 2132 return diff;
2129 } 2133 }
2130 2134
2131 } } // namespace v8::internal 2135 } } // namespace v8::internal
2132 2136
2133 #endif // ENABLE_LOGGING_AND_PROFILING 2137 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698