grpc
third_party
benchmark
src
third_party/benchmark/src/log.h
Go to the documentation of this file.
1
#ifndef BENCHMARK_LOG_H_
2
#define BENCHMARK_LOG_H_
3
4
#include <iostream>
5
#include <ostream>
6
7
#include "benchmark/benchmark.h"
8
9
namespace
benchmark
{
10
namespace
internal
{
11
12
typedef
std::basic_ostream<char>&(
EndLType
)(std::basic_ostream<char>&);
13
14
class
LogType
{
15
friend
LogType
&
GetNullLogInstance
();
16
friend
LogType
&
GetErrorLogInstance
();
17
18
// FIXME: Add locking to output.
19
template
<
class
Tp>
20
friend
LogType
&
operator<<
(
LogType
&, Tp
const
&);
21
friend
LogType
&
operator<<
(
LogType
&,
EndLType
*);
22
23
private
:
24
LogType
(std::ostream*
out
) :
out_
(
out
) {}
25
std::ostream*
out_
;
26
BENCHMARK_DISALLOW_COPY_AND_ASSIGN
(
LogType
);
27
};
28
29
template
<
class
Tp>
30
LogType
&
operator<<
(
LogType
&
log
, Tp
const
&
value
) {
31
if
(
log
.out_) {
32
*
log
.out_ <<
value
;
33
}
34
return
log
;
35
}
36
37
inline
LogType
&
operator<<
(
LogType
&
log
,
EndLType
*
m
) {
38
if
(
log
.out_) {
39
*
log
.out_ <<
m
;
40
}
41
return
log
;
42
}
43
44
inline
int
&
LogLevel
() {
45
static
int
log_level
= 0;
46
return
log_level
;
47
}
48
49
inline
LogType
&
GetNullLogInstance
() {
50
static
LogType
log
(
nullptr
);
51
return
log
;
52
}
53
54
inline
LogType
&
GetErrorLogInstance
() {
55
static
LogType
log
(&std::clog);
56
return
log
;
57
}
58
59
inline
LogType
&
GetLogInstanceForLevel
(
int
level
) {
60
if
(
level
<=
LogLevel
()) {
61
return
GetErrorLogInstance
();
62
}
63
return
GetNullLogInstance
();
64
}
65
66
}
// end namespace internal
67
}
// end namespace benchmark
68
69
// clang-format off
70
#define BM_VLOG(x) \
71
(::benchmark::internal::GetLogInstanceForLevel(x) << "-- LOG(" << x << "):" \
72
" ")
73
// clang-format on
74
#endif
gen_build_yaml.out
dictionary out
Definition:
src/benchmark/gen_build_yaml.py:24
benchmark::internal::GetErrorLogInstance
LogType & GetErrorLogInstance()
Definition:
third_party/benchmark/src/log.h:54
log_level
static int log_level
Definition:
stress_test.cc:124
benchmark
Definition:
bm_alarm.cc:55
benchmark::internal::EndLType
std::basic_ostream< char > &() EndLType(std::basic_ostream< char > &)
Definition:
third_party/benchmark/src/log.h:12
benchmark::internal::LogType
Definition:
third_party/benchmark/src/log.h:14
benchmark::internal::LogLevel
int & LogLevel()
Definition:
third_party/benchmark/src/log.h:44
benchmark::internal::LogType::GetNullLogInstance
friend LogType & GetNullLogInstance()
Definition:
third_party/benchmark/src/log.h:49
benchmark::internal::operator<<
LogType & operator<<(LogType &log, Tp const &value)
Definition:
third_party/benchmark/src/log.h:30
benchmark::internal::LogType::LogType
LogType(std::ostream *out)
Definition:
third_party/benchmark/src/log.h:24
benchmark::internal::LogType::GetErrorLogInstance
friend LogType & GetErrorLogInstance()
Definition:
third_party/benchmark/src/log.h:54
benchmark::internal::LogType::out_
std::ostream * out_
Definition:
third_party/benchmark/src/log.h:25
benchmark::internal::GetLogInstanceForLevel
LogType & GetLogInstanceForLevel(int level)
Definition:
third_party/benchmark/src/log.h:59
log
Definition:
bloaty/third_party/zlib/examples/gzlog.c:289
benchmark::internal::LogType::operator<<
friend LogType & operator<<(LogType &, Tp const &)
Definition:
third_party/benchmark/src/log.h:30
value
const char * value
Definition:
hpack_parser_table.cc:165
benchmark::internal::LogType::BENCHMARK_DISALLOW_COPY_AND_ASSIGN
BENCHMARK_DISALLOW_COPY_AND_ASSIGN(LogType)
log
bool log
Definition:
abseil-cpp/absl/synchronization/mutex.cc:310
internal
Definition:
benchmark/test/output_test_helper.cc:20
client.level
level
Definition:
examples/python/async_streaming/client.py:118
benchmark::internal::GetNullLogInstance
LogType & GetNullLogInstance()
Definition:
third_party/benchmark/src/log.h:49
regress.m
m
Definition:
regress/regress.py:25
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:16