1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <perftest/perftest.h>
6 
7 namespace {
8 
9 // This is a test that does nothing.  This is useful for measuring the
10 // overhead of the performance testing framework.  There will be some
11 // overhead in the perftest framework's loop that calls this function, and
12 // in the KeepRunning() calls that collect timing data.
NullTest()13 bool NullTest() {
14     return true;
15 }
16 
17 // This is a multi-step test where the steps do nothing.  This is useful
18 // for measuring the overhead of the performance testing framework.
Null5StepTest(perftest::RepeatState * state)19 bool Null5StepTest(perftest::RepeatState* state) {
20     state->DeclareStep("step1");
21     state->DeclareStep("step2");
22     state->DeclareStep("step3");
23     state->DeclareStep("step4");
24     state->DeclareStep("step5");
25     while (state->KeepRunning()) {
26         state->NextStep();
27         state->NextStep();
28         state->NextStep();
29         state->NextStep();
30     }
31     return true;
32 }
33 
RegisterTests()34 void RegisterTests() {
35     perftest::RegisterSimpleTest<NullTest>("Null");
36     perftest::RegisterTest("Null5Step", Null5StepTest);
37 }
38 PERFTEST_CTOR(RegisterTests);
39 
40 }  // namespace
41