blob: 52bc222e5fe22a17692968527bc5b7d3f812f490 [file] [log] [blame]
Yangster-mac20877162017-12-22 17:19:39 -08001// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include <gtest/gtest.h>
16
17#include "src/StatsLogProcessor.h"
Yangster-macb8144812018-01-04 10:56:23 -080018#include "src/stats_log_util.h"
Yangster-mac20877162017-12-22 17:19:39 -080019#include "tests/statsd_test_util.h"
20
21#include <vector>
22
23namespace android {
24namespace os {
25namespace statsd {
26
27#ifdef __ANDROID__
28
Yangster-mac87718e22018-01-11 16:16:26 -080029namespace {
30
Yangster-mac20877162017-12-22 17:19:39 -080031StatsdConfig CreateStatsdConfig(DurationMetric::AggregationType aggregationType) {
32 StatsdConfig config;
David Chen8faaa012018-02-28 15:54:36 -080033 config.add_allowed_log_source("AID_ROOT"); // LogEvent defaults to UID of root.
Yangster-mac20877162017-12-22 17:19:39 -080034 *config.add_atom_matcher() = CreateScreenTurnedOnAtomMatcher();
35 *config.add_atom_matcher() = CreateScreenTurnedOffAtomMatcher();
36 *config.add_atom_matcher() = CreateAcquireWakelockAtomMatcher();
37 *config.add_atom_matcher() = CreateReleaseWakelockAtomMatcher();
38
39 auto screenIsOffPredicate = CreateScreenIsOffPredicate();
40 *config.add_predicate() = screenIsOffPredicate;
41
42 auto holdingWakelockPredicate = CreateHoldingWakelockPredicate();
43 // The predicate is dimensioning by any attribution node and both by uid and tag.
David Chen27785a82018-01-19 17:06:45 -080044 FieldMatcher dimensions = CreateAttributionUidAndTagDimensions(
Jeffrey Huang3eb84d42020-03-17 10:31:22 -070045 util::WAKELOCK_STATE_CHANGED, {Position::FIRST, Position::LAST});
David Chen27785a82018-01-19 17:06:45 -080046 // Also slice by the wakelock tag
47 dimensions.add_child()->set_field(3); // The wakelock tag is set in field 3 of the wakelock.
48 *holdingWakelockPredicate.mutable_simple_predicate()->mutable_dimensions() = dimensions;
Yangster-mac20877162017-12-22 17:19:39 -080049 *config.add_predicate() = holdingWakelockPredicate;
50
51 auto durationMetric = config.add_duration_metric();
Yangster-mac94e197c2018-01-02 16:03:03 -080052 durationMetric->set_id(StringToId("WakelockDuration"));
53 durationMetric->set_what(holdingWakelockPredicate.id());
54 durationMetric->set_condition(screenIsOffPredicate.id());
Yangster-mac20877162017-12-22 17:19:39 -080055 durationMetric->set_aggregation_type(aggregationType);
56 // The metric is dimensioning by first attribution node and only by uid.
Yangster-mac468ff042018-01-17 12:26:34 -080057 *durationMetric->mutable_dimensions_in_what() =
Yangster-mac20877162017-12-22 17:19:39 -080058 CreateAttributionUidDimensions(
Jeffrey Huang3eb84d42020-03-17 10:31:22 -070059 util::WAKELOCK_STATE_CHANGED, {Position::FIRST});
yro59cc24d2018-02-13 20:17:32 -080060 durationMetric->set_bucket(FIVE_MINUTES);
Yangster-mac20877162017-12-22 17:19:39 -080061 return config;
62}
63
tsaichristine7747d372020-02-28 17:36:59 -080064std::vector<int> attributionUids1 = {111, 222, 222};
65std::vector<string> attributionTags1 = {"App1", "GMSCoreModule1", "GMSCoreModule2"};
Yangster-mac87718e22018-01-11 16:16:26 -080066
tsaichristine7747d372020-02-28 17:36:59 -080067std::vector<int> attributionUids2 = {111, 222, 222};
68std::vector<string> attributionTags2 = {"App2", "GMSCoreModule1", "GMSCoreModule2"};
David Chen27785a82018-01-19 17:06:45 -080069
tsaichristine7747d372020-02-28 17:36:59 -080070/*
71Events:
72Screen off is met from (200ns,1 min+500ns].
73Acquire event for wl1 from 2ns to 1min+2ns
74Acquire event for wl2 from 1min-10ns to 2min-15ns
75*/
76void FeedEvents(StatsdConfig config, sp<StatsLogProcessor> processor) {
77 uint64_t bucketStartTimeNs = 10000000000;
78 uint64_t bucketSizeNs =
79 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
80
81 auto screenTurnedOnEvent = CreateScreenStateChangedEvent(
82 bucketStartTimeNs + 1, android::view::DisplayStateEnum::DISPLAY_STATE_ON);
83 auto screenTurnedOffEvent = CreateScreenStateChangedEvent(
84 bucketStartTimeNs + 200, android::view::DisplayStateEnum::DISPLAY_STATE_OFF);
85 auto screenTurnedOnEvent2 =
86 CreateScreenStateChangedEvent(bucketStartTimeNs + bucketSizeNs + 500,
87 android::view::DisplayStateEnum::DISPLAY_STATE_ON);
88
89 auto acquireEvent1 = CreateAcquireWakelockEvent(bucketStartTimeNs + 2, attributionUids1,
90 attributionTags1, "wl1");
91 auto releaseEvent1 = CreateReleaseWakelockEvent(bucketStartTimeNs + bucketSizeNs + 2,
92 attributionUids1, attributionTags1, "wl1");
93 auto acquireEvent2 = CreateAcquireWakelockEvent(bucketStartTimeNs + bucketSizeNs - 10,
94 attributionUids2, attributionTags2, "wl2");
95 auto releaseEvent2 = CreateReleaseWakelockEvent(bucketStartTimeNs + 2 * bucketSizeNs - 15,
96 attributionUids2, attributionTags2, "wl2");
97
98 std::vector<std::unique_ptr<LogEvent>> events;
99
100 events.push_back(std::move(screenTurnedOnEvent));
101 events.push_back(std::move(screenTurnedOffEvent));
102 events.push_back(std::move(screenTurnedOnEvent2));
103 events.push_back(std::move(acquireEvent1));
104 events.push_back(std::move(acquireEvent2));
105 events.push_back(std::move(releaseEvent1));
106 events.push_back(std::move(releaseEvent2));
107
108 sortLogEventsByTimestamp(&events);
109
110 for (const auto& event : events) {
111 processor->OnLogEvent(event.get());
112 }
113}
Yangster-mac20877162017-12-22 17:19:39 -0800114
David Chen27785a82018-01-19 17:06:45 -0800115} // namespace
116
tsaichristine7747d372020-02-28 17:36:59 -0800117TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration1) {
118 ConfigKey cfgKey;
119 auto config = CreateStatsdConfig(DurationMetric::SUM);
120 uint64_t bucketStartTimeNs = 10000000000;
121 uint64_t bucketSizeNs =
122 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
123 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700124 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800125 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
126 FeedEvents(config, processor);
127 vector<uint8_t> buffer;
128 ConfigMetricsReportList reports;
129 processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true, ADB_DUMP,
130 FAST, &buffer);
131 EXPECT_TRUE(buffer.size() > 0);
132 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
133 backfillDimensionPath(&reports);
134 backfillStringInReport(&reports);
135 backfillStartEndTimestamp(&reports);
136
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700137 ASSERT_EQ(reports.reports_size(), 1);
138 ASSERT_EQ(reports.reports(0).metrics_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800139 // Only 1 dimension output. The tag dimension in the predicate has been aggregated.
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700140 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800141
142 auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
143 // Validate dimension value.
144 ValidateAttributionUidDimension(data.dimensions_in_what(),
Jeffrey Huang3eb84d42020-03-17 10:31:22 -0700145 util::WAKELOCK_STATE_CHANGED, 111);
tsaichristine7747d372020-02-28 17:36:59 -0800146 // Validate bucket info.
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700147 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800148 data = reports.reports(0).metrics(0).duration_metrics().data(0);
149 // The wakelock holding interval starts from the screen off event and to the end of the 1st
150 // bucket.
151 EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs - 200);
152}
153
154TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration2) {
155 ConfigKey cfgKey;
156 auto config = CreateStatsdConfig(DurationMetric::SUM);
157 uint64_t bucketStartTimeNs = 10000000000;
158 uint64_t bucketSizeNs =
159 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
160 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700161 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800162 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
163 FeedEvents(config, processor);
164 vector<uint8_t> buffer;
165 ConfigMetricsReportList reports;
166 processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true, ADB_DUMP,
167 FAST, &buffer);
168 EXPECT_TRUE(buffer.size() > 0);
169 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
170 backfillDimensionPath(&reports);
171 backfillStringInReport(&reports);
172 backfillStartEndTimestamp(&reports);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700173 ASSERT_EQ(reports.reports_size(), 1);
174 ASSERT_EQ(reports.reports(0).metrics_size(), 1);
175 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800176 // Dump the report after the end of 2nd bucket.
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700177 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
tsaichristine7747d372020-02-28 17:36:59 -0800178 auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
179 // Validate dimension value.
180 ValidateAttributionUidDimension(data.dimensions_in_what(),
Jeffrey Huang3eb84d42020-03-17 10:31:22 -0700181 util::WAKELOCK_STATE_CHANGED, 111);
tsaichristine7747d372020-02-28 17:36:59 -0800182 // Two output buckets.
183 // The wakelock holding interval in the 1st bucket starts from the screen off event and to
184 // the end of the 1st bucket.
185 EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(),
186 bucketStartTimeNs + bucketSizeNs - (bucketStartTimeNs + 200));
187 // The wakelock holding interval in the 2nd bucket starts at the beginning of the bucket and
188 // ends at the second screen on event.
189 EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 500UL);
190}
191
192TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForSumDuration3) {
193 ConfigKey cfgKey;
194 auto config = CreateStatsdConfig(DurationMetric::SUM);
195 uint64_t bucketStartTimeNs = 10000000000;
196 uint64_t bucketSizeNs =
197 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
198 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700199 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800200 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
201 FeedEvents(config, processor);
202 vector<uint8_t> buffer;
203 ConfigMetricsReportList reports;
204
205 std::vector<std::unique_ptr<LogEvent>> events;
206 events.push_back(
207 CreateScreenStateChangedEvent(bucketStartTimeNs + 2 * bucketSizeNs + 90,
208 android::view::DisplayStateEnum::DISPLAY_STATE_OFF));
209 events.push_back(CreateAcquireWakelockEvent(bucketStartTimeNs + 2 * bucketSizeNs + 100,
210 attributionUids1, attributionTags1, "wl3"));
211 events.push_back(CreateReleaseWakelockEvent(bucketStartTimeNs + 5 * bucketSizeNs + 100,
212 attributionUids1, attributionTags1, "wl3"));
213 sortLogEventsByTimestamp(&events);
214 for (const auto& event : events) {
215 processor->OnLogEvent(event.get());
216 }
217
218 processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true, ADB_DUMP,
219 FAST, &buffer);
220 EXPECT_TRUE(buffer.size() > 0);
221 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
222 backfillDimensionPath(&reports);
223 backfillStringInReport(&reports);
224 backfillStartEndTimestamp(&reports);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700225 ASSERT_EQ(reports.reports_size(), 1);
226 ASSERT_EQ(reports.reports(0).metrics_size(), 1);
227 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
228 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 6);
tsaichristine7747d372020-02-28 17:36:59 -0800229 auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
230 ValidateAttributionUidDimension(data.dimensions_in_what(),
Jeffrey Huang3eb84d42020-03-17 10:31:22 -0700231 util::WAKELOCK_STATE_CHANGED, 111);
tsaichristine7747d372020-02-28 17:36:59 -0800232 // The last wakelock holding spans 4 buckets.
233 EXPECT_EQ((unsigned long long)data.bucket_info(2).duration_nanos(), bucketSizeNs - 100);
234 EXPECT_EQ((unsigned long long)data.bucket_info(3).duration_nanos(), bucketSizeNs);
235 EXPECT_EQ((unsigned long long)data.bucket_info(4).duration_nanos(), bucketSizeNs);
236 EXPECT_EQ((unsigned long long)data.bucket_info(5).duration_nanos(), 100UL);
237}
238
239TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration1) {
240 ConfigKey cfgKey;
241 auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
242 uint64_t bucketStartTimeNs = 10000000000;
243 uint64_t bucketSizeNs =
244 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
245 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700246 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800247 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
248 FeedEvents(config, processor);
249 ConfigMetricsReportList reports;
250 vector<uint8_t> buffer;
251 processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs - 1, false, true, ADB_DUMP,
252 FAST, &buffer);
253 EXPECT_TRUE(buffer.size() > 0);
254
255 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
256 backfillDimensionPath(&reports);
257 backfillStringInReport(&reports);
258 backfillStartEndTimestamp(&reports);
259
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700260 ASSERT_EQ(reports.reports_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800261
262 // When using ProtoOutputStream, if nothing written to a sub msg, it won't be treated as
263 // one. It was previsouly 1 because we had a fake onDumpReport which calls add_metric() by
264 // itself.
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700265 ASSERT_EQ(1, reports.reports(0).metrics_size());
266 ASSERT_EQ(0, reports.reports(0).metrics(0).duration_metrics().data_size());
tsaichristine7747d372020-02-28 17:36:59 -0800267}
268
269TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration2) {
270 ConfigKey cfgKey;
271 auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
272 uint64_t bucketStartTimeNs = 10000000000;
273 uint64_t bucketSizeNs =
274 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
275 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700276 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800277 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
278 FeedEvents(config, processor);
279 ConfigMetricsReportList reports;
280 vector<uint8_t> buffer;
281 processor->onDumpReport(cfgKey, bucketStartTimeNs + 2 * bucketSizeNs + 1, false, true, ADB_DUMP,
282 FAST, &buffer);
283 EXPECT_TRUE(buffer.size() > 0);
284 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
285 backfillDimensionPath(&reports);
286 backfillStringInReport(&reports);
287 backfillStartEndTimestamp(&reports);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700288 ASSERT_EQ(reports.reports_size(), 1);
289 ASSERT_EQ(reports.reports(0).metrics_size(), 1);
290 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800291 // Dump the report after the end of 2nd bucket. One dimension with one bucket.
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700292 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 1);
tsaichristine7747d372020-02-28 17:36:59 -0800293 auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
294 // Validate dimension value.
295 ValidateAttributionUidDimension(data.dimensions_in_what(),
Jeffrey Huang3eb84d42020-03-17 10:31:22 -0700296 util::WAKELOCK_STATE_CHANGED, 111);
tsaichristine7747d372020-02-28 17:36:59 -0800297 // The max is acquire event for wl1 to screen off start.
298 EXPECT_EQ((unsigned long long)data.bucket_info(0).duration_nanos(), bucketSizeNs + 2 - 200);
299}
300
301TEST(WakelockDurationE2eTest, TestAggregatedPredicateDimensionsForMaxDuration3) {
302 ConfigKey cfgKey;
303 auto config = CreateStatsdConfig(DurationMetric::MAX_SPARSE);
304 uint64_t bucketStartTimeNs = 10000000000;
305 uint64_t bucketSizeNs =
306 TimeUnitToBucketSizeInMillis(config.duration_metric(0).bucket()) * 1000000LL;
307 auto processor = CreateStatsLogProcessor(bucketStartTimeNs, bucketStartTimeNs, config, cfgKey);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700308 ASSERT_EQ(processor->mMetricsManagers.size(), 1u);
tsaichristine7747d372020-02-28 17:36:59 -0800309 EXPECT_TRUE(processor->mMetricsManagers.begin()->second->isConfigValid());
310 FeedEvents(config, processor);
311 ConfigMetricsReportList reports;
312 vector<uint8_t> buffer;
313
314 std::vector<std::unique_ptr<LogEvent>> events;
315 events.push_back(
316 CreateScreenStateChangedEvent(bucketStartTimeNs + 2 * bucketSizeNs + 90,
317 android::view::DisplayStateEnum::DISPLAY_STATE_OFF));
318 events.push_back(CreateAcquireWakelockEvent(bucketStartTimeNs + 2 * bucketSizeNs + 100,
319 attributionUids1, attributionTags1, "wl3"));
320 events.push_back(CreateReleaseWakelockEvent(bucketStartTimeNs + 5 * bucketSizeNs + 100,
321 attributionUids1, attributionTags1, "wl3"));
322 sortLogEventsByTimestamp(&events);
323 for (const auto& event : events) {
324 processor->OnLogEvent(event.get());
325 }
326
327 processor->onDumpReport(cfgKey, bucketStartTimeNs + 6 * bucketSizeNs + 1, false, true, ADB_DUMP,
328 FAST, &buffer);
329 EXPECT_TRUE(buffer.size() > 0);
330 EXPECT_TRUE(reports.ParseFromArray(&buffer[0], buffer.size()));
331 backfillDimensionPath(&reports);
332 backfillStringInReport(&reports);
333 backfillStartEndTimestamp(&reports);
Muhammad Qureshidff78d62020-05-11 13:37:43 -0700334 ASSERT_EQ(reports.reports_size(), 1);
335 ASSERT_EQ(reports.reports(0).metrics_size(), 1);
336 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data_size(), 1);
337 ASSERT_EQ(reports.reports(0).metrics(0).duration_metrics().data(0).bucket_info_size(), 2);
tsaichristine7747d372020-02-28 17:36:59 -0800338 auto data = reports.reports(0).metrics(0).duration_metrics().data(0);
339 ValidateAttributionUidDimension(data.dimensions_in_what(),
Jeffrey Huang3eb84d42020-03-17 10:31:22 -0700340 util::WAKELOCK_STATE_CHANGED, 111);
tsaichristine7747d372020-02-28 17:36:59 -0800341 // The last wakelock holding spans 4 buckets.
342 EXPECT_EQ((unsigned long long)data.bucket_info(1).duration_nanos(), 3 * bucketSizeNs);
343 EXPECT_EQ((unsigned long long)data.bucket_info(1).start_bucket_elapsed_nanos(),
344 bucketStartTimeNs + 5 * bucketSizeNs);
345 EXPECT_EQ((unsigned long long)data.bucket_info(1).end_bucket_elapsed_nanos(),
346 bucketStartTimeNs + 6 * bucketSizeNs);
347}
David Chen27785a82018-01-19 17:06:45 -0800348
Yangster-mac20877162017-12-22 17:19:39 -0800349#else
350GTEST_LOG_(INFO) << "This test does nothing.\n";
351#endif
352
353} // namespace statsd
354} // namespace os
yro59cc24d2018-02-13 20:17:32 -0800355} // namespace android