Stops the periodic counter updater in 'profile' and then clears the samples in 'counter'.
| 1344 | /// Stops the periodic counter updater in 'profile' and then clears the samples in |
| 1345 | /// 'counter'. |
| 1346 | void StopAndClearCounter(RuntimeProfile* profile, |
| 1347 | RuntimeProfile::TimeSeriesCounter* counter) { |
| 1348 | // There's a race between adding the counter and calling StopPeriodicCounters so we |
| 1349 | // sleep here to make sure we exercise the code that handles the race. |
| 1350 | sleep(1); |
| 1351 | profile->StopPeriodicCounters(); |
| 1352 | |
| 1353 | // Reset the counter state by reading and clearing its samples. |
| 1354 | int num_samples = 0; |
| 1355 | int result_period_unused = 0; |
| 1356 | counter->GetSamplesTest(&num_samples, &result_period_unused); |
| 1357 | ASSERT_GT(num_samples, 0); |
| 1358 | profile->ClearChunkedTimeSeriesCounters(); |
| 1359 | // Ensure clean state. |
| 1360 | counter->GetSamplesTest(&num_samples, &result_period_unused); |
| 1361 | ASSERT_EQ(num_samples, 0); |
| 1362 | } |
| 1363 | |
| 1364 | /// Tests that ChunkedTimeSeriesCounters are bounded by a maximum size. |
| 1365 | TEST(TimeSeriesCounterTest, TestMaximumSize) { |
no test coverage detected