benchmark 1.10.0
Loading...
Searching...
No Matches
sysinfo.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_SYSINFO_H_
16#define BENCHMARK_SYSINFO_H_
17
18#if defined(_MSC_VER)
19#pragma warning(push)
20#pragma warning(disable : 4251)
21#endif
22
23#include <string>
24#include <vector>
25
26#include "benchmark/macros.h"
27
28namespace benchmark {
29
30struct BENCHMARK_EXPORT CPUInfo {
31 struct CacheInfo {
32 std::string type;
33 int level;
34 int size;
35 int num_sharing;
36 };
37
38 enum Scaling { UNKNOWN, ENABLED, DISABLED };
39
40 int num_cpus;
41 Scaling scaling;
42 double cycles_per_second;
43 std::vector<CacheInfo> caches;
44 std::vector<double> load_avg;
45
46 static const CPUInfo& Get();
47
48 private:
49 CPUInfo();
50 BENCHMARK_DISALLOW_COPY_AND_ASSIGN(CPUInfo);
51};
52
53struct BENCHMARK_EXPORT SystemInfo {
54 enum class ASLR { UNKNOWN, ENABLED, DISABLED };
55
56 std::string name;
57 ASLR ASLRStatus;
58 static const SystemInfo& Get();
59
60 private:
61 SystemInfo();
62 BENCHMARK_DISALLOW_COPY_AND_ASSIGN(SystemInfo);
63};
64
65} // namespace benchmark
66
67#if defined(_MSC_VER)
68#pragma warning(pop)
69#endif
70
71#endif // BENCHMARK_SYSINFO_H_
Definition sysinfo.h:31
Definition sysinfo.h:30