protobuf
third_party
benchmark
src
protobuf/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
#define VLOG(x) \
70
(::benchmark::internal::GetLogInstanceForLevel(x) << "-- LOG(" << x << "):" \
71
" ")
72
73
#endif
benchmark
Definition:
benchmark.h:241
benchmark::internal::EndLType
std::basic_ostream< char > &() EndLType(std::basic_ostream< char > &)
Definition:
protobuf/third_party/benchmark/src/log.h:12
benchmark::internal::GetNullLogInstance
LogType & GetNullLogInstance()
Definition:
protobuf/third_party/benchmark/src/log.h:49
benchmark::internal::LogType
Definition:
protobuf/third_party/benchmark/src/log.h:14
benchmark::internal::GetErrorLogInstance
LogType & GetErrorLogInstance()
Definition:
protobuf/third_party/benchmark/src/log.h:54
benchmark::internal::operator<<
LogType & operator<<(LogType &log, Tp const &value)
Definition:
protobuf/third_party/benchmark/src/log.h:30
benchmark::internal::LogType::GetNullLogInstance
friend LogType & GetNullLogInstance()
Definition:
protobuf/third_party/benchmark/src/log.h:49
benchmark::internal::LogType::LogType
LogType(std::ostream *out)
Definition:
protobuf/third_party/benchmark/src/log.h:24
benchmark::internal::LogType::GetErrorLogInstance
friend LogType & GetErrorLogInstance()
Definition:
protobuf/third_party/benchmark/src/log.h:54
benchmark::internal::LogLevel
int & LogLevel()
Definition:
protobuf/third_party/benchmark/src/log.h:44
benchmark::internal::LogType::operator<<
friend LogType & operator<<(LogType &, Tp const &)
Definition:
protobuf/third_party/benchmark/src/log.h:30
benchmark::internal::GetLogInstanceForLevel
LogType & GetLogInstanceForLevel(int level)
Definition:
protobuf/third_party/benchmark/src/log.h:59
benchmark::internal::LogType::BENCHMARK_DISALLOW_COPY_AND_ASSIGN
BENCHMARK_DISALLOW_COPY_AND_ASSIGN(LogType)
m
const upb_json_parsermethod * m
Definition:
ruby/ext/google/protobuf_c/upb.h:10501
benchmark::internal::LogType::out_
std::ostream * out_
Definition:
protobuf/third_party/benchmark/src/log.h:25
internal
Definition:
any.pb.h:40
value
GLsizei const GLfloat * value
Definition:
glcorearb.h:3093
level
GLint level
Definition:
glcorearb.h:2773
benchmark.h
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55