-
Notifications
You must be signed in to change notification settings - Fork 8
/
get_platform_info.cpp
48 lines (36 loc) · 1.74 KB
/
get_platform_info.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// A tool to get linux system configuration details for low latency applications.
//
#include <platform/platform.h>
#include <thread>
#include <cstdlib>
#include <iomanip>
#include <iostream>
using plf = ihft::platform::trait;
int main()
{
std::cout << "IHFT platform information\n" << std::endl;
std::cout << "Hugepage allocator info (how many pages are available):" << std::endl;
std::cout << "Total 1GB hugepages: " << plf::total_1gb_hugepages() << std::endl;
std::cout << "Total 2MB hugepages: " << plf::total_2mb_hugepages() << std::endl;
std::cout << "\n";
std::cout << "Positive factors (should be true):" << std::endl;
std::cout << "Is CPU scaling governor use performance: " << std::boolalpha << plf::is_scaling_governor_use_performance_mode() << std::endl;
std::cout << "\n";
std::cout << "Negative factors (should be false):" << std::endl;
std::cout << "Is hyper threading active: " << std::boolalpha << plf::is_hyper_threading_active() << std::endl;
std::cout << "Is transparent_hugepage active: " << std::boolalpha << plf::is_transparent_hugepages_active() << std::endl;
std::cout << "Is swap active: " << std::boolalpha << plf::is_swap_active() << std::endl;
std::cout << "\n";
std::cout << "| cpu | isolation | nohz_full | rcu_nocbs |" << std::endl;
for(unsigned int i = 0; i < std::thread::hardware_concurrency(); i++)
{
std::cout << std::noboolalpha
<< std::setw(5) << i
<< std::setw(12) << (plf::get_cpu_isolation_status(i) ? '*' : ' ')
<< std::setw(12) << (plf::get_cpu_nohz_full_status(i) ? '*' : ' ')
<< std::setw(12) << (plf::get_cpu_rcu_nocbs_status(i) ? '*' : ' ')
<< std::endl;
}
return EXIT_SUCCESS;
}