benchmark 1.10.0
Loading...
Searching...
No Matches
managers.h
1// Copyright 2015 Google Inc. All rights reserved.
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#ifndef BENCHMARK_MANAGERS_H_
16#define BENCHMARK_MANAGERS_H_
17
18#include <stdint.h>
19
20#include <limits>
21
22#include "benchmark/macros.h"
23#include "benchmark/state.h"
24#include "benchmark/types.h"
25
26namespace benchmark {
27
29 public:
30 static constexpr int64_t TombstoneValue = std::numeric_limits<int64_t>::max();
31
32 struct Result {
33 Result()
34 : num_allocs(0),
35 max_bytes_used(0),
36 total_allocated_bytes(TombstoneValue),
37 net_heap_growth(TombstoneValue),
38 memory_iterations(0) {}
39
40 int64_t num_allocs;
41 int64_t max_bytes_used;
42 int64_t total_allocated_bytes;
43 int64_t net_heap_growth;
44 IterationCount memory_iterations;
45 };
46
47 virtual ~MemoryManager() {}
48 virtual void Start() = 0;
49 virtual void Stop(Result& result) = 0;
50};
51
52BENCHMARK_EXPORT
53void RegisterMemoryManager(MemoryManager* memory_manager);
54
56 public:
57 virtual ~ProfilerManager() {}
58 virtual void AfterSetupStart() {}
59 virtual void BeforeTeardownStop() {}
60 virtual void AfterSetupStartWithState(const State&) { AfterSetupStart(); }
61 virtual void BeforeTeardownStopWithState(const State&) {
62 BeforeTeardownStop();
63 }
64};
65
66BENCHMARK_EXPORT
67void RegisterProfilerManager(ProfilerManager* profiler_manager);
68
69} // namespace benchmark
70
71#endif // BENCHMARK_MANAGERS_H_
Definition managers.h:28
Definition managers.h:55
Definition state.h:43