-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
34 lines (29 loc) · 1.09 KB
/
main.cpp
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
#include <cstdio>
#include <cstdlib>
#include "gtest/gtest.h"
namespace {
void PrintInformation()
{
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
printf("--------------- General Information ---------------\n");
printf("%-25s", "Host:"); fflush(stdout);
std::ignore = system("whoami | tr -d '\\n' && printf '@' && cat /etc/hostname");
printf("%-25s%s\n", "Build flavor:", TOSTRING(BUILD_FLAVOR));
printf("%-25s", "HugePage size:"); fflush(stdout);
std::ignore = system("cat /proc/meminfo | grep Hugepagesize | tr -s ' ' | cut -d' ' -f 2,3");
printf("%-25s", "# total HugePages:"); fflush(stdout);
std::ignore = system("cat /proc/meminfo | grep HugePages_Total | tr -s ' ' | cut -d' ' -f 2");
printf("%-25s", "# free HugePages:"); fflush(stdout);
std::ignore = system("cat /proc/meminfo | grep HugePages_Free | tr -s ' ' | cut -d' ' -f 2");
printf("---------------------------------------------------\n");
#undef TOSTRING
#undef STRINGIFY
}
} // annoymous namespace
int main(int argc, char **argv)
{
PrintInformation();
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}