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 <sstream> | |
6 | |
7 #include "base/bind.h" | 5 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
9 #include "base/path_service.h" | 7 #include "base/path_service.h" |
10 #include "base/profiler/stack_sampling_profiler.h" | 8 #include "base/profiler/stack_sampling_profiler.h" |
| 9 #include "base/strings/stringprintf.h" |
11 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 | 16 |
18 using Frame = StackSamplingProfiler::Frame; | 17 using Frame = StackSamplingProfiler::Frame; |
19 using Module = StackSamplingProfiler::Module; | 18 using Module = StackSamplingProfiler::Module; |
20 using Sample = StackSamplingProfiler::Sample; | 19 using Sample = StackSamplingProfiler::Sample; |
21 using Profile = StackSamplingProfiler::Profile; | 20 using CallStackProfile = StackSamplingProfiler::CallStackProfile; |
22 | 21 |
23 namespace { | 22 namespace { |
| 23 |
24 // A thread to target for profiling, whose stack is guaranteed to contain | 24 // A thread to target for profiling, whose stack is guaranteed to contain |
25 // SignalAndWaitUntilSignaled() when coordinated with the main thread. | 25 // SignalAndWaitUntilSignaled() when coordinated with the main thread. |
26 class TargetThread : public PlatformThread::Delegate { | 26 class TargetThread : public PlatformThread::Delegate { |
27 public: | 27 public: |
28 TargetThread(); | 28 TargetThread(); |
29 | 29 |
30 // Implementation of PlatformThread::Delegate: | 30 // PlatformThread::Delegate: |
31 void ThreadMain() override; | 31 void ThreadMain() override; |
32 | 32 |
33 // Wait for the thread to have started and be executing in | 33 // Waits for the thread to have started and be executing in |
34 // SignalAndWaitUntilSignaled(). | 34 // SignalAndWaitUntilSignaled(). |
35 void WaitForThreadStart(); | 35 void WaitForThreadStart(); |
36 // Allow the thread to return from SignalAndWaitUntilSignaled() and finish | 36 |
| 37 // Allows the thread to return from SignalAndWaitUntilSignaled() and finish |
37 // execution. | 38 // execution. |
38 void SignalThreadToFinish(); | 39 void SignalThreadToFinish(); |
39 | 40 |
40 // This function is guaranteed to be executing between calls to | 41 // This function is guaranteed to be executing between calls to |
41 // WaitForThreadStart() and SignalThreadToFinish(). | 42 // WaitForThreadStart() and SignalThreadToFinish(). This function is static so |
| 43 // that we can get a straightforward address for it in one of the tests below, |
| 44 // rather than dealing with the complexity of a member function pointer |
| 45 // representation. |
42 static void SignalAndWaitUntilSignaled(WaitableEvent* thread_started_event, | 46 static void SignalAndWaitUntilSignaled(WaitableEvent* thread_started_event, |
43 WaitableEvent* finish_event); | 47 WaitableEvent* finish_event); |
44 | 48 |
45 PlatformThreadId id() const { return id_; } | 49 PlatformThreadId id() const { return id_; } |
46 | 50 |
47 private: | 51 private: |
48 WaitableEvent thread_started_event_; | 52 WaitableEvent thread_started_event_; |
49 WaitableEvent finish_event_; | 53 WaitableEvent finish_event_; |
50 PlatformThreadId id_; | 54 PlatformThreadId id_; |
51 | 55 |
(...skipping 28 matching lines...) Expand all Loading... |
80 thread_started_event->Signal(); | 84 thread_started_event->Signal(); |
81 finish_event->Wait(); | 85 finish_event->Wait(); |
82 } | 86 } |
83 #if defined(_WIN64) | 87 #if defined(_WIN64) |
84 #pragma optimize("", on) | 88 #pragma optimize("", on) |
85 #endif | 89 #endif |
86 | 90 |
87 // Called on the profiler thread when complete. Collects profiles produced by | 91 // Called on the profiler thread when complete. Collects profiles produced by |
88 // the profiler, and signals an event to allow the main thread to know that that | 92 // the profiler, and signals an event to allow the main thread to know that that |
89 // the profiler is done. | 93 // the profiler is done. |
90 void SaveProfilesAndSignalEvent(std::vector<Profile>* profiles, | 94 void SaveProfilesAndSignalEvent( |
91 WaitableEvent* event, | 95 std::vector<CallStackProfile>* profiles, |
92 const std::vector<Profile>& pending_profiles) { | 96 WaitableEvent* event, |
| 97 const std::vector<CallStackProfile>& pending_profiles) { |
93 *profiles = pending_profiles; | 98 *profiles = pending_profiles; |
94 event->Signal(); | 99 event->Signal(); |
95 } | 100 } |
96 | 101 |
97 // Captures profiles as specified by |params| on the TargetThread, and returns | 102 // Captures call stack profiles as specified by |params| on the TargetThread, |
98 // them in |profiles|. Waits up to |profiler_wait_time| for the profiler to | 103 // and returns them in |profiles|. Waits up to |profiler_wait_time| for the |
99 // complete. | 104 // profiler to complete. |
100 void CaptureProfiles(const StackSamplingProfiler::SamplingParams& params, | 105 void CaptureProfiles(const StackSamplingProfiler::SamplingParams& params, |
101 std::vector<Profile>* profiles, | 106 std::vector<CallStackProfile>* profiles, |
102 TimeDelta profiler_wait_time) { | 107 TimeDelta profiler_wait_time) { |
103 TargetThread target_thread; | 108 TargetThread target_thread; |
104 PlatformThreadHandle target_thread_handle; | 109 PlatformThreadHandle target_thread_handle; |
105 EXPECT_TRUE(PlatformThread::Create(0, &target_thread, &target_thread_handle)); | 110 EXPECT_TRUE(PlatformThread::Create(0, &target_thread, &target_thread_handle)); |
106 | 111 |
107 target_thread.WaitForThreadStart(); | 112 target_thread.WaitForThreadStart(); |
108 | 113 |
109 WaitableEvent sampling_thread_completed(true, false); | 114 WaitableEvent sampling_thread_completed(true, false); |
110 profiles->clear(); | 115 profiles->clear(); |
111 StackSamplingProfiler profiler(target_thread.id(), params); | 116 StackSamplingProfiler profiler(target_thread.id(), params); |
112 profiler.SetCustomCompletedCallback( | 117 profiler.set_custom_completed_callback( |
113 Bind(&SaveProfilesAndSignalEvent, Unretained(profiles), | 118 Bind(&SaveProfilesAndSignalEvent, Unretained(profiles), |
114 Unretained(&sampling_thread_completed))); | 119 Unretained(&sampling_thread_completed))); |
115 profiler.Start(); | 120 profiler.Start(); |
116 sampling_thread_completed.TimedWait(profiler_wait_time); | 121 sampling_thread_completed.TimedWait(profiler_wait_time); |
117 profiler.Stop(); | 122 profiler.Stop(); |
118 sampling_thread_completed.Wait(); | 123 sampling_thread_completed.Wait(); |
119 | 124 |
120 target_thread.SignalThreadToFinish(); | 125 target_thread.SignalThreadToFinish(); |
121 | 126 |
122 PlatformThread::Join(target_thread_handle); | 127 PlatformThread::Join(target_thread_handle); |
123 } | 128 } |
124 | 129 |
125 // If this executable was linked with /INCREMENTAL (the default for non-official | 130 // If this executable was linked with /INCREMENTAL (the default for non-official |
126 // debug and release builds on Windows), function addresses do not correspond to | 131 // debug and release builds on Windows), function addresses do not correspond to |
127 // function code itself, but instead to instructions in the Incremental Link | 132 // function code itself, but instead to instructions in the Incremental Link |
128 // Table that jump to the functions. Check for a jump instruction and if present | 133 // Table that jump to the functions. Checks for a jump instruction and if |
129 // do a little decompilation to find the function's actual starting address. | 134 // present does a little decompilation to find the function's actual starting |
| 135 // address. |
130 const void* MaybeFixupFunctionAddressForILT(const void* function_address) { | 136 const void* MaybeFixupFunctionAddressForILT(const void* function_address) { |
131 #if defined(_WIN64) | 137 #if defined(_WIN64) |
132 const unsigned char* opcode = | 138 const unsigned char* opcode = |
133 reinterpret_cast<const unsigned char*>(function_address); | 139 reinterpret_cast<const unsigned char*>(function_address); |
134 if (*opcode == 0xe9) { | 140 if (*opcode == 0xe9) { |
135 // This is a relative jump instruction. Assume we're in the ILT and compute | 141 // This is a relative jump instruction. Assume we're in the ILT and compute |
136 // the function start address from the instruction offset. | 142 // the function start address from the instruction offset. |
137 const unsigned char* offset = opcode + 1; | 143 const int32* offset = reinterpret_cast<const int32*>(opcode + 1); |
138 const unsigned char* next_instruction = opcode + 5; | 144 const unsigned char* next_instruction = |
139 return next_instruction + | 145 reinterpret_cast<const unsigned char*>(offset + 1); |
140 static_cast<int64>(*reinterpret_cast<const int32*>(offset)); | 146 return next_instruction + *offset; |
141 } | 147 } |
142 #endif | 148 #endif |
143 return function_address; | 149 return function_address; |
144 } | 150 } |
145 | 151 |
146 // Searches through the frames in |sample|, returning an iterator to the first | 152 // Searches through the frames in |sample|, returning an iterator to the first |
147 // frame that has an instruction pointer between |function_address| and | 153 // frame that has an instruction pointer between |function_address| and |
148 // |function_address| + |size|. Returns sample.end() if no such frames are | 154 // |function_address| + |size|. Returns sample.end() if no such frames are |
149 // found. | 155 // found. |
150 Sample::const_iterator FindFirstFrameWithinFunction( | 156 Sample::const_iterator FindFirstFrameWithinFunction( |
151 const Sample& sample, | 157 const Sample& sample, |
152 const void* function_address, | 158 const void* function_address, |
153 int function_size) { | 159 int function_size) { |
154 function_address = MaybeFixupFunctionAddressForILT(function_address); | 160 function_address = MaybeFixupFunctionAddressForILT(function_address); |
155 for (auto it = sample.begin(); it != sample.end(); ++it) { | 161 for (auto it = sample.begin(); it != sample.end(); ++it) { |
156 if ((reinterpret_cast<const unsigned char*>(it->instruction_pointer) >= | 162 if ((it->instruction_pointer >= function_address) && |
157 reinterpret_cast<const unsigned char*>(function_address)) && | 163 (it->instruction_pointer < |
158 (reinterpret_cast<const unsigned char*>(it->instruction_pointer) < | 164 (static_cast<const unsigned char*>(function_address) + function_size))) |
159 (reinterpret_cast<const unsigned char*>(function_address) + | |
160 function_size))) | |
161 return it; | 165 return it; |
162 } | 166 } |
163 return sample.end(); | 167 return sample.end(); |
164 } | 168 } |
165 | 169 |
166 // Formats a sample into a string that can be output for test diagnostics. | 170 // Formats a sample into a string that can be output for test diagnostics. |
167 std::string FormatSampleForDiagnosticOutput( | 171 std::string FormatSampleForDiagnosticOutput( |
168 const Sample& sample, | 172 const Sample& sample, |
169 const std::vector<Module>& modules) { | 173 const std::vector<Module>& modules) { |
170 std::ostringstream stream; | 174 std::string output; |
171 for (const Frame& frame: sample) { | 175 for (const Frame& frame: sample) { |
172 stream << frame.instruction_pointer << " " | 176 output += StringPrintf( |
173 << modules[frame.module_index].filename.value() << std::endl; | 177 "0x%p %s\n", frame.instruction_pointer, |
| 178 modules[frame.module_index].filename.AsUTF8Unsafe().c_str()); |
174 } | 179 } |
175 return stream.str(); | 180 return output; |
176 } | 181 } |
177 | 182 |
178 // Returns a duration that is longer than the test timeout. We would use | 183 // Returns a duration that is longer than the test timeout. We would use |
179 // TimeDelta::Max() but https://crbug.com/465948. | 184 // TimeDelta::Max() but https://crbug.com/465948. |
180 TimeDelta AVeryLongTimeDelta() { return TimeDelta::FromDays(1); } | 185 TimeDelta AVeryLongTimeDelta() { return TimeDelta::FromDays(1); } |
| 186 |
181 } // namespace | 187 } // namespace |
182 | 188 |
183 | 189 |
184 // The tests below are enabled for Win x64 only, pending implementation of the | 190 // The tests below are enabled for Win x64 only, pending implementation of the |
185 // tested functionality on other platforms/architectures. | 191 // tested functionality on other platforms/architectures. |
186 | 192 |
187 // Checks that the basic expected information is present in a sampled profile. | 193 // Checks that the basic expected information is present in a sampled call stack |
| 194 // profile. |
188 #if defined(_WIN64) | 195 #if defined(_WIN64) |
189 #define MAYBE_Basic Basic | 196 #define MAYBE_Basic Basic |
190 #else | 197 #else |
191 #define MAYBE_Basic DISABLED_Basic | 198 #define MAYBE_Basic DISABLED_Basic |
192 #endif | 199 #endif |
193 TEST(StackSamplingProfilerTest, MAYBE_Basic) { | 200 TEST(StackSamplingProfilerTest, MAYBE_Basic) { |
194 StackSamplingProfiler::SamplingParams params; | 201 StackSamplingProfiler::SamplingParams params; |
195 params.initial_delay = params.burst_interval = params.sampling_interval = | 202 params.sampling_interval = TimeDelta::FromMilliseconds(0); |
196 TimeDelta::FromMilliseconds(0); | |
197 params.bursts = 1; | |
198 params.samples_per_burst = 1; | 203 params.samples_per_burst = 1; |
199 | 204 |
200 std::vector<Profile> profiles; | 205 std::vector<CallStackProfile> profiles; |
201 CaptureProfiles(params, &profiles, AVeryLongTimeDelta()); | 206 CaptureProfiles(params, &profiles, AVeryLongTimeDelta()); |
202 | 207 |
203 // Check that the profile and samples sizes are correct, and the module | 208 // Check that the profile and samples sizes are correct, and the module |
204 // indices are in range. | 209 // indices are in range. |
205 | |
206 ASSERT_EQ(1u, profiles.size()); | 210 ASSERT_EQ(1u, profiles.size()); |
207 const Profile& profile = profiles[0]; | 211 const CallStackProfile& profile = profiles[0]; |
208 ASSERT_EQ(1u, profile.samples.size()); | 212 ASSERT_EQ(1u, profile.samples.size()); |
209 EXPECT_EQ(params.sampling_interval, profile.sampling_period); | 213 EXPECT_EQ(params.sampling_interval, profile.sampling_period); |
210 const Sample& sample = profile.samples[0]; | 214 const Sample& sample = profile.samples[0]; |
211 for (const auto& frame : sample) { | 215 for (const auto& frame : sample) { |
212 ASSERT_GE(frame.module_index, 0); | 216 ASSERT_GE(frame.module_index, 0u); |
213 ASSERT_LT(frame.module_index, static_cast<int>(profile.modules.size())); | 217 ASSERT_LT(frame.module_index, profile.modules.size()); |
214 } | 218 } |
215 | 219 |
216 // Check that the stack contains a frame for | 220 // Check that the stack contains a frame for |
217 // TargetThread::SignalAndWaitUntilSignaled() and that the frame has this | 221 // TargetThread::SignalAndWaitUntilSignaled() and that the frame has this |
218 // executable's module. | 222 // executable's module. |
219 | 223 // |
220 // Since we don't have a good way to know the function size, use 100 bytes as | 224 // Since we don't have a good way to know the function size, use 100 bytes as |
221 // a reasonable window to locate the instruction pointer. | 225 // a reasonable window to locate the instruction pointer. |
222 Sample::const_iterator loc = FindFirstFrameWithinFunction( | 226 Sample::const_iterator loc = FindFirstFrameWithinFunction( |
223 sample, | 227 sample, |
224 reinterpret_cast<const void*>(&TargetThread::SignalAndWaitUntilSignaled), | 228 reinterpret_cast<const void*>(&TargetThread::SignalAndWaitUntilSignaled), |
225 100); | 229 100); |
226 ASSERT_TRUE(loc != sample.end()) | 230 ASSERT_TRUE(loc != sample.end()) |
227 << "Function at " | 231 << "Function at " |
228 << MaybeFixupFunctionAddressForILT( | 232 << MaybeFixupFunctionAddressForILT( |
229 reinterpret_cast<const void*>( | 233 reinterpret_cast<const void*>( |
230 &TargetThread::SignalAndWaitUntilSignaled)) | 234 &TargetThread::SignalAndWaitUntilSignaled)) |
231 << " was not found in stack:" << std::endl | 235 << " was not found in stack:\n" |
232 << FormatSampleForDiagnosticOutput(sample, profile.modules); | 236 << FormatSampleForDiagnosticOutput(sample, profile.modules); |
233 | |
234 FilePath executable_path; | 237 FilePath executable_path; |
235 bool got_executable_path = PathService::Get(FILE_EXE, &executable_path); | 238 EXPECT_TRUE(PathService::Get(FILE_EXE, &executable_path)); |
236 EXPECT_TRUE(got_executable_path); | |
237 EXPECT_EQ(executable_path, profile.modules[loc->module_index].filename); | 239 EXPECT_EQ(executable_path, profile.modules[loc->module_index].filename); |
238 } | 240 } |
239 | 241 |
240 // Checks that the expected number of profiles and samples are present in the | 242 // Checks that the expected number of profiles and samples are present in the |
241 // profiles produced. | 243 // call stack profiles produced. |
242 #if defined(_WIN64) | 244 #if defined(_WIN64) |
243 #define MAYBE_MultipleProfilesAndSamples MultipleProfilesAndSamples | 245 #define MAYBE_MultipleProfilesAndSamples MultipleProfilesAndSamples |
244 #else | 246 #else |
245 #define MAYBE_MultipleProfilesAndSamples DISABLED_MultipleProfilesAndSamples | 247 #define MAYBE_MultipleProfilesAndSamples DISABLED_MultipleProfilesAndSamples |
246 #endif | 248 #endif |
247 TEST(StackSamplingProfilerTest, MAYBE_MultipleProfilesAndSamples) { | 249 TEST(StackSamplingProfilerTest, MAYBE_MultipleProfilesAndSamples) { |
248 StackSamplingProfiler::SamplingParams params; | 250 StackSamplingProfiler::SamplingParams params; |
249 params.initial_delay = params.burst_interval = params.sampling_interval = | 251 params.burst_interval = params.sampling_interval = |
250 TimeDelta::FromMilliseconds(0); | 252 TimeDelta::FromMilliseconds(0); |
251 params.bursts = 2; | 253 params.bursts = 2; |
252 params.samples_per_burst = 3; | 254 params.samples_per_burst = 3; |
253 | 255 |
254 std::vector<Profile> profiles; | 256 std::vector<CallStackProfile> profiles; |
255 CaptureProfiles(params, &profiles, AVeryLongTimeDelta()); | 257 CaptureProfiles(params, &profiles, AVeryLongTimeDelta()); |
256 | 258 |
257 ASSERT_EQ(2u, profiles.size()); | 259 ASSERT_EQ(2u, profiles.size()); |
258 EXPECT_EQ(3u, profiles[0].samples.size()); | 260 EXPECT_EQ(3u, profiles[0].samples.size()); |
259 EXPECT_EQ(3u, profiles[1].samples.size()); | 261 EXPECT_EQ(3u, profiles[1].samples.size()); |
260 } | 262 } |
261 | 263 |
262 // Checks that no profiles are captured if the profiling is stopped during the | 264 // Checks that no call stack profiles are captured if the profiling is stopped |
263 // initial delay. | 265 // during the initial delay. |
264 #if defined(_WIN64) | 266 #if defined(_WIN64) |
265 #define MAYBE_StopDuringInitialDelay StopDuringInitialDelay | 267 #define MAYBE_StopDuringInitialDelay StopDuringInitialDelay |
266 #else | 268 #else |
267 #define MAYBE_StopDuringInitialDelay DISABLED_StopDuringInitialDelay | 269 #define MAYBE_StopDuringInitialDelay DISABLED_StopDuringInitialDelay |
268 #endif | 270 #endif |
269 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInitialDelay) { | 271 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInitialDelay) { |
270 StackSamplingProfiler::SamplingParams params; | 272 StackSamplingProfiler::SamplingParams params; |
271 params.burst_interval = params.sampling_interval = | |
272 TimeDelta::FromMilliseconds(0); | |
273 params.initial_delay = TimeDelta::FromSeconds(60); | 273 params.initial_delay = TimeDelta::FromSeconds(60); |
274 params.bursts = params.samples_per_burst = 1; | |
275 | 274 |
276 std::vector<Profile> profiles; | 275 std::vector<CallStackProfile> profiles; |
277 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(0)); | 276 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(0)); |
278 | 277 |
279 EXPECT_TRUE(profiles.empty()); | 278 EXPECT_TRUE(profiles.empty()); |
280 } | 279 } |
281 | 280 |
282 // Checks that the single completed profile is captured if the profiling is | 281 // Checks that the single completed call stack profile is captured if the |
283 // stopped between bursts. | 282 // profiling is stopped between bursts. |
284 #if defined(_WIN64) | 283 #if defined(_WIN64) |
285 #define MAYBE_StopDuringInterBurstInterval StopDuringInterBurstInterval | 284 #define MAYBE_StopDuringInterBurstInterval StopDuringInterBurstInterval |
286 #else | 285 #else |
287 #define MAYBE_StopDuringInterBurstInterval DISABLED_StopDuringInterBurstInterval | 286 #define MAYBE_StopDuringInterBurstInterval DISABLED_StopDuringInterBurstInterval |
288 #endif | 287 #endif |
289 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInterBurstInterval) { | 288 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInterBurstInterval) { |
290 StackSamplingProfiler::SamplingParams params; | 289 StackSamplingProfiler::SamplingParams params; |
291 params.initial_delay = params.sampling_interval = | 290 params.sampling_interval = TimeDelta::FromMilliseconds(0); |
292 TimeDelta::FromMilliseconds(0); | |
293 params.burst_interval = TimeDelta::FromSeconds(60); | 291 params.burst_interval = TimeDelta::FromSeconds(60); |
294 params.bursts = 2; | 292 params.bursts = 2; |
295 params.samples_per_burst = 1; | 293 params.samples_per_burst = 1; |
296 | 294 |
297 std::vector<Profile> profiles; | 295 std::vector<CallStackProfile> profiles; |
298 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(50)); | 296 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(50)); |
299 | 297 |
300 ASSERT_EQ(1u, profiles.size()); | 298 ASSERT_EQ(1u, profiles.size()); |
301 EXPECT_EQ(1u, profiles[0].samples.size()); | 299 EXPECT_EQ(1u, profiles[0].samples.size()); |
302 } | 300 } |
303 | 301 |
304 // Checks that only completed profiles are captured. | 302 // Checks that only completed call stack profiles are captured. |
305 #if defined(_WIN64) | 303 #if defined(_WIN64) |
306 #define MAYBE_StopDuringInterSampleInterval StopDuringInterSampleInterval | 304 #define MAYBE_StopDuringInterSampleInterval StopDuringInterSampleInterval |
307 #else | 305 #else |
308 #define MAYBE_StopDuringInterSampleInterval \ | 306 #define MAYBE_StopDuringInterSampleInterval \ |
309 DISABLED_StopDuringInterSampleInterval | 307 DISABLED_StopDuringInterSampleInterval |
310 #endif | 308 #endif |
311 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInterSampleInterval) { | 309 TEST(StackSamplingProfilerTest, MAYBE_StopDuringInterSampleInterval) { |
312 StackSamplingProfiler::SamplingParams params; | 310 StackSamplingProfiler::SamplingParams params; |
313 params.initial_delay = params.burst_interval = TimeDelta::FromMilliseconds(0); | |
314 params.sampling_interval = TimeDelta::FromSeconds(60); | 311 params.sampling_interval = TimeDelta::FromSeconds(60); |
315 params.bursts = 1; | |
316 params.samples_per_burst = 2; | 312 params.samples_per_burst = 2; |
317 | 313 |
318 std::vector<Profile> profiles; | 314 std::vector<CallStackProfile> profiles; |
319 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(50)); | 315 CaptureProfiles(params, &profiles, TimeDelta::FromMilliseconds(50)); |
320 | 316 |
321 EXPECT_TRUE(profiles.empty()); | 317 EXPECT_TRUE(profiles.empty()); |
322 } | 318 } |
323 | 319 |
324 } // namespace tracked_objects | 320 } // namespace base |
OLD | NEW |