forked from pingcap/tiflash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTiFlashBuildInfo.cpp
More file actions
196 lines (179 loc) · 4.25 KB
/
TiFlashBuildInfo.cpp
File metadata and controls
196 lines (179 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// Copyright 2023 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <Common/TiFlashBuildInfo.h>
#include <Common/config.h>
#include <Common/config_version.h>
#include <VectorSearch/DistanceSIMDFeatures.h>
#include <VectorSearch/SIMDFeatures.h>
#include <common/config_common.h>
#include <common/logger_useful.h>
#include <fmt/core.h>
#include <fmt/format.h>
#include <openssl/opensslconf.h>
#include <openssl/opensslv.h>
#include <vector>
namespace TiFlashBuildInfo
{
String getName()
{
return TIFLASH_NAME;
}
String getVersion()
{
return TIFLASH_VERSION;
}
String getReleaseVersion()
{
return TIFLASH_RELEASE_VERSION;
}
String getEdition()
{
return TIFLASH_EDITION;
}
String getGitHash()
{
return TIFLASH_GIT_HASH;
}
String getGitBranch()
{
return TIFLASH_GIT_BRANCH;
}
String getUTCBuildTime()
{
return TIFLASH_UTC_BUILD_TIME;
}
UInt32 getMajorVersion()
{
return TIFLASH_VERSION_MAJOR;
}
UInt32 getMinorVersion()
{
return TIFLASH_VERSION_MINOR;
}
UInt32 getPatchVersion()
{
return TIFLASH_VERSION_PATCH;
}
// clang-format off
String getEnabledFeatures()
{
std::vector<String> features
{
// allocator
#if USE_JEMALLOC
"jemalloc",
#elif USE_MIMALLOC
"mimalloc",
#endif
// sm4
#if USE_GM_SSL
"sm4(GmSSL)",
#elif OPENSSL_VERSION_NUMBER >= 0x1010100fL && !defined(OPENSSL_NO_SM4)
"sm4(OpenSSL)",
#endif
// mem-profiling
#if USE_JEMALLOC_PROF
"mem-profiling",
#endif
// failpoints
#if ENABLE_FAILPOINTS
"failpoints",
#endif
// SIMD related
#ifdef TIFLASH_ENABLE_AVX_SUPPORT
"avx2",
#endif
#ifdef TIFLASH_ENABLE_AVX512_SUPPORT
"avx512",
#endif
#ifdef TIFLASH_ENABLE_ASIMD_SUPPORT
"asimd",
#endif
#ifdef TIFLASH_ENABLE_SVE_SUPPORT
"sve",
#endif
// Unwind related
#if USE_UNWIND
#if USE_LLVM_LIBUNWIND
"llvm-unwind",
#else
"unwind",
#endif
#endif
// THINLTO
#if ENABLE_THINLTO
"thinlto",
#endif
// Profile instrumentation
#if ENABLE_LLVM_PROFILE_INSTR
"profile-instr",
#endif
// PGO
#if ENABLE_LLVM_PGO_USE_SAMPLE
"pgo-sample",
#elif ENABLE_LLVM_PGO
"pgo-instr",
#endif
// FDO
#if USE_LLVM_FDO
"fdo",
#endif
// Next-Gen
#if ENABLE_NEXT_GEN
"next-gen",
#endif
// Clara
#if ENABLE_CLARA
"clara",
#endif
};
{
auto f = DB::DM::VectorIndexHNSWSIMDFeatures::get();
for (const auto & feature : f)
features.push_back(feature);
}
{
auto f = DB::VectorDistanceSIMDFeatures::get();
for (const auto & feature : f)
features.push_back(feature);
}
return fmt::format("{}", fmt::join(features.begin(), features.end(), " "));
}
// clang-format on
String getProfile()
{
return TIFLASH_PROFILE;
}
String getCompilerVersion()
{
return fmt::format(
"{} {}",
// TIFLASH_CXX_COMPILER is some strings like "/tiflash-env-17/sysroot/bin/clang++",
// use `LogFmtDetails::getFileNameOffset` to get the compiler name
&TIFLASH_CXX_COMPILER[LogFmtDetails::getFileNameOffset(TIFLASH_CXX_COMPILER)],
TIFLASH_CXX_COMPILER_VERSION);
}
void outputDetail(std::ostream & os)
{
os << getName() << std::endl
<< "Release Version: " << getReleaseVersion() << std::endl
<< "Edition: " << getEdition() << std::endl
<< "Git Commit Hash: " << getGitHash() << std::endl
<< "Git Branch: " << getGitBranch() << std::endl
<< "UTC Build Time: " << getUTCBuildTime() << std::endl
<< "Enable Features: " << getEnabledFeatures() << std::endl
<< "Profile: " << getProfile() << std::endl
<< "Compiler: " << getCompilerVersion() << std::endl;
}
} // namespace TiFlashBuildInfo