Chromium Code Reviews| Index: test/cctest/test-log.cc |
| diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc |
| index 7168737416588efdde191ad876e5672f478c2469..f40e8c52aac80df2e714c8be1886a266e3d86594 100644 |
| --- a/test/cctest/test-log.cc |
| +++ b/test/cctest/test-log.cc |
| @@ -139,6 +139,12 @@ namespace internal { |
| class LoggerTestHelper : public AllStatic { |
| public: |
| static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); } |
| + static void reset_samples_taken() { |
| + reinterpret_cast<Sampler*>(Logger::ticker_)->reset_samples_taken(); |
| + } |
| + static bool has_samples_taken() { |
| + return reinterpret_cast<Sampler*>(Logger::ticker_)->samples_taken() > 0; |
| + } |
| }; |
| } // namespace v8::internal |
| @@ -147,24 +153,6 @@ class LoggerTestHelper : public AllStatic { |
| using v8::internal::LoggerTestHelper; |
| -// Under Linux, we need to check if signals were delivered to avoid false |
| -// positives. Under other platforms profiling is done via a high-priority |
| -// thread, so this case never happen. |
| -static bool was_sigprof_received = true; |
| -#ifdef __linux__ |
| - |
| -struct sigaction old_sigprof_handler; |
| -pthread_t our_thread; |
| - |
| -static void SigProfSignalHandler(int signal, siginfo_t* info, void* context) { |
| - if (signal != SIGPROF || !pthread_equal(pthread_self(), our_thread)) return; |
| - was_sigprof_received = true; |
| - old_sigprof_handler.sa_sigaction(signal, info, context); |
| -} |
| - |
| -#endif // __linux__ |
| - |
| - |
| namespace { |
| class ScopedLoggerInitializer { |
| @@ -266,18 +254,7 @@ static void CheckThatProfilerWorks(LogBufferMatcher* matcher) { |
| const char* code_creation = "\ncode-creation,"; // eq. to /^code-creation,/ |
| CHECK_NE(NULL, matcher->Find(code_creation)); |
| -#ifdef __linux__ |
| - // Intercept SIGPROF handler to make sure that the test process |
| - // had received it. Under load, system can defer it causing test failure. |
| - // It is important to execute this after 'ResumeProfiler'. |
| - our_thread = pthread_self(); |
| - was_sigprof_received = false; |
| - struct sigaction sa; |
| - sa.sa_sigaction = SigProfSignalHandler; |
| - sigemptyset(&sa.sa_mask); |
| - sa.sa_flags = SA_SIGINFO; |
| - CHECK_EQ(0, sigaction(SIGPROF, &sa, &old_sigprof_handler)); |
| -#endif // __linux__ |
| + LoggerTestHelper::reset_samples_taken(); |
|
Vitaly Repeshko
2010/11/25 15:01:20
Should be done while the profiler is paused.
mnaganov (inactive)
2010/11/25 15:26:56
Done.
|
| // Force compiler to generate new code by parametrizing source. |
| EmbeddedVector<char, 100> script_src; |
| @@ -306,7 +283,7 @@ static void CheckThatProfilerWorks(LogBufferMatcher* matcher) { |
| CHECK_NE(NULL, matcher->Find(code_creation)); |
| const char* tick = "\ntick,"; |
| const bool ticks_found = matcher->Find(tick) != NULL; |
| - CHECK_EQ(was_sigprof_received, ticks_found); |
| + CHECK_EQ(LoggerTestHelper::has_samples_taken(), ticks_found); |
| } |