OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/profiler/stack_sampling_profiler.h" | 10 #include "base/profiler/stack_sampling_profiler.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 // STACK_SAMPLING_PROFILER_SUPPORTED is used to conditionally enable the tests | 18 // STACK_SAMPLING_PROFILER_SUPPORTED is used to conditionally enable the tests |
19 // below for supported platforms (currently Win x64). | 19 // below for supported platforms (currently Win x64). |
20 #if defined(_WIN64) | 20 #if defined(_WIN64) || defined(OS_MACOSX) |
Mike Wittman
2015/09/15 00:34:54
Update comment.
| |
21 #define STACK_SAMPLING_PROFILER_SUPPORTED 1 | 21 #define STACK_SAMPLING_PROFILER_SUPPORTED 1 |
22 #endif | 22 #endif |
23 | 23 |
24 namespace base { | 24 namespace base { |
25 | 25 |
26 using SamplingParams = StackSamplingProfiler::SamplingParams; | 26 using SamplingParams = StackSamplingProfiler::SamplingParams; |
27 using Frame = StackSamplingProfiler::Frame; | 27 using Frame = StackSamplingProfiler::Frame; |
28 using Module = StackSamplingProfiler::Module; | 28 using Module = StackSamplingProfiler::Module; |
29 using Sample = StackSamplingProfiler::Sample; | 29 using Sample = StackSamplingProfiler::Sample; |
30 using CallStackProfile = StackSamplingProfiler::CallStackProfile; | 30 using CallStackProfile = StackSamplingProfiler::CallStackProfile; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 sampling_completed[1]->TimedWait(TimeDelta::FromMilliseconds(25))); | 451 sampling_completed[1]->TimedWait(TimeDelta::FromMilliseconds(25))); |
452 | 452 |
453 // Start the second profiler again and it should run. | 453 // Start the second profiler again and it should run. |
454 profiler[1]->Start(); | 454 profiler[1]->Start(); |
455 sampling_completed[1]->Wait(); | 455 sampling_completed[1]->Wait(); |
456 EXPECT_EQ(1u, profiles[1].size()); | 456 EXPECT_EQ(1u, profiles[1].size()); |
457 }); | 457 }); |
458 } | 458 } |
459 | 459 |
460 } // namespace base | 460 } // namespace base |
OLD | NEW |