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

Function VerifyThriftSummaryStats

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

Helper for the AggregateSummaryStats that verifies the encoded event sequence in the thrift representation when it was merged into the profile at instance offset 'offset'.

Source from the content-addressed store, hash-verified

546// in the thrift representation when it was merged into the profile at instance offset
547// 'offset'.
548static void VerifyThriftSummaryStats(
549 const TRuntimeProfileNode& tnode, int offset, int total_instances) {
550 const int NUM_VALID_INSTANCES = 3;
551 DCHECK_LE(offset + NUM_VALID_INSTANCES, total_instances);
552 ASSERT_TRUE(tnode.__isset.aggregated);
553
554 const TAggregatedRuntimeProfileNode& agg_node = tnode.aggregated;
555 ASSERT_TRUE(agg_node.__isset.summary_stats_counters);
556
557 const TAggSummaryStatsCounter& tcounter = agg_node.summary_stats_counters[0];
558 EXPECT_EQ("test ss", tcounter.name);
559 EXPECT_EQ(TUnit::UNIT, tcounter.unit);
560
561 EXPECT_LE(offset + NUM_VALID_INSTANCES, tcounter.has_value.size());
562 EXPECT_LE(offset + NUM_VALID_INSTANCES, tcounter.sum.size());
563 EXPECT_LE(offset + NUM_VALID_INSTANCES, tcounter.total_num_values.size());
564 EXPECT_LE(offset + NUM_VALID_INSTANCES, tcounter.min_value.size());
565 EXPECT_LE(offset + NUM_VALID_INSTANCES, tcounter.max_value.size());
566
567 for (int i = 0; i < total_instances; ++i) {
568 if (i < offset || i >= offset + NUM_VALID_INSTANCES) {
569 EXPECT_FALSE(tcounter.has_value[i]);
570 continue;
571 }
572 EXPECT_TRUE(tcounter.has_value[i]);
573 int min_val = i - offset;
574 EXPECT_EQ(min_val * 2 + 1, tcounter.sum[i]);
575 EXPECT_EQ(2, tcounter.total_num_values[i]);
576 EXPECT_EQ(min_val, tcounter.min_value[i]);
577 EXPECT_EQ(min_val + 1, tcounter.max_value[i]);
578 }
579}
580
581// Test handling of summary statistics in the aggregated profile.
582TEST(CountersTest, AggregateSummaryStats) {

Callers 1

TESTFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected