| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests of logging functions from log.h | 3 // Tests of logging functions from log.h |
| 4 | 4 |
| 5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 6 | 6 |
| 7 #ifdef __linux__ | 7 #ifdef __linux__ |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 private: | 395 private: |
| 396 v8::internal::Semaphore* semaphore_; | 396 v8::internal::Semaphore* semaphore_; |
| 397 bool was_sample_stack_called_; | 397 bool was_sample_stack_called_; |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 | 400 |
| 401 } // namespace | 401 } // namespace |
| 402 | 402 |
| 403 TEST(ProfMultipleThreads) { | 403 TEST(ProfMultipleThreads) { |
| 404 // V8 needs to be initialized before the first Locker | |
| 405 // instantiation. Otherwise, Top::Initialize will reset | |
| 406 // thread_id_ in ThreadTopLocal. | |
| 407 v8::HandleScope scope; | |
| 408 v8::Handle<v8::Context> env = v8::Context::New(); | |
| 409 env->Enter(); | |
| 410 | |
| 411 LoopingJsThread jsThread; | 404 LoopingJsThread jsThread; |
| 412 jsThread.Start(); | 405 jsThread.Start(); |
| 413 LoopingNonJsThread nonJsThread; | 406 LoopingNonJsThread nonJsThread; |
| 414 nonJsThread.Start(); | 407 nonJsThread.Start(); |
| 415 | 408 |
| 416 TestSampler sampler; | 409 TestSampler sampler; |
| 417 sampler.Start(); | 410 sampler.Start(); |
| 418 CHECK(!sampler.WasSampleStackCalled()); | 411 CHECK(!sampler.WasSampleStackCalled()); |
| 419 jsThread.WaitForRunning(); | 412 jsThread.WaitForRunning(); |
| 420 jsThread.SendSigProf(); | 413 jsThread.SendSigProf(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 // Make sure that all log data is written prior crash due to CHECK failure. | 889 // Make sure that all log data is written prior crash due to CHECK failure. |
| 897 fflush(stdout); | 890 fflush(stdout); |
| 898 CHECK(results_equal); | 891 CHECK(results_equal); |
| 899 | 892 |
| 900 env->Exit(); | 893 env->Exit(); |
| 901 Logger::TearDown(); | 894 Logger::TearDown(); |
| 902 i::FLAG_always_compact = saved_always_compact; | 895 i::FLAG_always_compact = saved_always_compact; |
| 903 } | 896 } |
| 904 | 897 |
| 905 #endif // ENABLE_LOGGING_AND_PROFILING | 898 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |