MCPcopy Create free account
hub / github.com/apache/impala / StopAndClearCounter

Function StopAndClearCounter

be/src/util/runtime-profile-test.cc:1346–1362  ·  view source on GitHub ↗

Stops the periodic counter updater in 'profile' and then clears the samples in 'counter'.

Source from the content-addressed store, hash-verified

1344/// Stops the periodic counter updater in 'profile' and then clears the samples in
1345/// 'counter'.
1346void 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.
1365TEST(TimeSeriesCounterTest, TestMaximumSize) {

Callers 2

TESTFunction · 0.85
TEST_PFunction · 0.85

Calls 3

StopPeriodicCountersMethod · 0.80
GetSamplesTestMethod · 0.80

Tested by

no test coverage detected