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

Side by Side Diff: third_party/tcmalloc/chromium/src/tests/profile-handler_unittest.cc

Issue 9416072: Fix gperftools to not arm the profiling timer by default. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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
OLDNEW
1 // Copyright 2009 Google Inc. All Rights Reserved. 1 // Copyright 2009 Google Inc. All Rights Reserved.
2 // Author: Nabeel Mian (nabeelmian@google.com) 2 // Author: Nabeel Mian (nabeelmian@google.com)
3 // Chris Demetriou (cgd@google.com) 3 // Chris Demetriou (cgd@google.com)
4 // 4 //
5 // This file contains the unit tests for profile-handler.h interface. 5 // This file contains the unit tests for profile-handler.h interface.
6 // 6 //
7 // It is linked into three separate unit tests: 7 // It is linked into three separate unit tests:
8 // profile-handler_unittest tests basic functionality 8 // profile-handler_unittest tests basic functionality
9 // profile-handler_disable_test tests that the profiler 9 // profile-handler_disable_test tests that the profiler
10 // is disabled with --install_signal_handlers=false 10 // is disabled with --install_signal_handlers=false
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 void Join() { 52 void Join() {
53 assert(joinable_); 53 assert(joinable_);
54 pthread_join(thread_, NULL); 54 pthread_join(thread_, NULL);
55 } 55 }
56 virtual void Run() = 0; 56 virtual void Run() = 0;
57 private: 57 private:
58 static void* DoRun(void* cls) { 58 static void* DoRun(void* cls) {
59 ProfileHandlerRegisterThread(); 59 ProfileHandlerRegisterThread();
60 reinterpret_cast<Thread*>(cls)->Run(); 60 reinterpret_cast<Thread*>(cls)->Run();
61 ProfileHandlerUnregisterThread();
61 return NULL; 62 return NULL;
62 } 63 }
63 pthread_t thread_; 64 pthread_t thread_;
64 bool joinable_; 65 bool joinable_;
65 }; 66 };
66 67
67 // Sleep interval in nano secs. ITIMER_PROF goes off only afer the specified CPU 68 // Sleep interval in nano secs. ITIMER_PROF goes off only afer the specified CPU
68 // time is consumed. Under heavy load this process may no get scheduled in a 69 // time is consumed. Under heavy load this process may no get scheduled in a
69 // timely fashion. Therefore, give enough time (20x of ProfileHandle timer 70 // timely fashion. Therefore, give enough time (20x of ProfileHandle timer
70 // interval 10ms (100Hz)) for this process to accumulate enought CPU time to get 71 // interval 10ms (100Hz)) for this process to accumulate enought CPU time to get
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if (FLAGS_test_profiler_signal_handler) { 498 if (FLAGS_test_profiler_signal_handler) {
498 EXPECT_EQ(FLAGS_test_profiler_enabled, IsSignalEnabled()); 499 EXPECT_EQ(FLAGS_test_profiler_enabled, IsSignalEnabled());
499 } 500 }
500 } 501 }
501 502
502 } // namespace 503 } // namespace
503 504
504 int main(int argc, char** argv) { 505 int main(int argc, char** argv) {
505 return ProfileHandlerTest::RUN_ALL_TESTS(); 506 return ProfileHandlerTest::RUN_ALL_TESTS();
506 } 507 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/profiler.cc ('k') | third_party/tcmalloc/chromium/src/tests/profiler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698