Pigweed
Loading...
Searching...
No Matches
perf_test.h
1
// Copyright 2022 The Pigweed Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
// use this file except in compliance with the License. You may obtain a copy of
5
// the License at
6
//
7
// https://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, WITHOUT
11
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
// License for the specific language governing permissions and limitations under
13
// the License.
14
#pragma once
15
16
#include "pw_perf_test/event_handler.h"
17
#include "pw_perf_test/internal/test_info.h"
18
#include "pw_perf_test/state.h"
19
#include "pw_preprocessor/arguments.h"
20
37
#define PW_PERF_TEST(name, function, ...) \
38
const ::pw::perf_test::internal::TestInfo PwPerfTest_##name( \
39
#name, [](::pw::perf_test::State& pw_perf_test_state) { \
40
static_cast<void>( \
41
function(pw_perf_test_state PW_COMMA_ARGS(__VA_ARGS__))); \
42
})
43
58
#define PW_PERF_TEST_SIMPLE(name, function, ...) \
59
PW_PERF_TEST( \
60
name, \
61
[](::pw::perf_test::State& pw_perf_test_simple_state, \
62
const auto&... args) { \
63
while (pw_perf_test_simple_state.KeepRunning()) { \
64
function(args...); \
65
} \
66
}, \
67
__VA_ARGS__)
68
69
namespace
pw::perf_test {
70
75
void
RunAllTests(EventHandler& handler);
76
77
}
// namespace pw::perf_test
pw_perf_test
public
pw_perf_test
perf_test.h
Generated by
1.9.6