0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd::info: Query for various clock characteristics of the runtime.

This commit is contained in:
Jason Volk 2020-06-11 06:36:58 -07:00
parent cb2b92b241
commit c2562d7dfa
2 changed files with 31 additions and 8 deletions

View file

@ -51,11 +51,12 @@ namespace ircd::info
extern const versions sd6_version;
// System configuration / information
extern const size_t page_size;
extern const size_t iov_max;
extern const size_t aio_max;
extern const size_t aio_reqprio_max;
extern const size_t clk_tck;
extern const string_view clock_source;
extern const size_t aio_reqprio_max;
extern const size_t aio_max;
extern const size_t iov_max;
extern const size_t page_size;
extern const size_t total_ram;
extern const size_t total_swap;
@ -118,6 +119,7 @@ namespace ircd::info::hardware::x86
extern const bool mmx, sse, sse2;
extern const bool sse3, ssse3, sse4_1, sse4_2;
extern const bool avx, avx2;
extern const bool tsc, tsc_constant;
};
/// Instances of `versions` create a dynamic version registry identifying

View file

@ -132,7 +132,7 @@ ircd::info::dump_cpu_info()
#if defined(__i386__) or defined(__x86_64__)
log::info
{
log::star, "%s mmx:%b sse:%b sse2:%b sse3:%b ssse3:%b sse4.1:%b sse4.2:%b avx:%b avx2:%b",
log::star, "%s mmx:%b sse:%b sse2:%b sse3:%b ssse3:%b sse4.1:%b sse4.2:%b avx:%b avx2:%b constant_tsc:%b",
hardware::x86::vendor,
hardware::x86::mmx,
hardware::x86::sse,
@ -143,6 +143,7 @@ ircd::info::dump_cpu_info()
hardware::x86::sse4_2,
hardware::x86::avx,
hardware::x86::avx2,
hardware::x86::tsc_constant,
};
#endif
@ -418,6 +419,18 @@ ircd::info::hardware::x86::avx2
bool(features & (uint128_t(1) << (32 + 5)))
};
decltype(ircd::info::hardware::x86::tsc)
ircd::info::hardware::x86::tsc
{
bool(features & (uint128_t(1) << 4))
};
decltype(ircd::info::hardware::x86::tsc_constant)
ircd::info::hardware::x86::tsc_constant
{
bool(_apmi & (uint128_t(1) << (8)))
};
#ifdef __x86_64__
ircd::uint128_t
ircd::info::hardware::x86::cpuid(const uint &leaf,
@ -803,19 +816,20 @@ ircd::info::dump_sys_info()
fs::support::dump_info();
// Additional detected system parameters
#ifdef RB_DEBUG
//#ifdef RB_DEBUG
char buf[2][48];
log::logf
{
log::star, log::DEBUG,
"page_size=%zu iov_max=%zu aio_max=%zu aio_reqprio_max=%zu memlock_limit=%s",
"page_size=%zu iov_max=%zd aio_max=%zd aio_reqprio_max=%zd memlock_limit=%s clock_source=%s",
page_size,
iov_max,
aio_max,
aio_reqprio_max,
pretty(buf[0], iec(allocator::rlimit_memlock())),
clock_source,
};
#endif
//#endif
}
#ifdef HAVE_SYS_UTSNAME_H
@ -915,6 +929,13 @@ ircd::info::clk_tck
};
#endif
static char ircd_info_clock_source[32];
decltype(ircd::info::clock_source)
ircd::info::clock_source
{
sys::get(ircd_info_clock_source, "devices/system/clocksource/clocksource0/current_clocksource")
};
decltype(ircd::info::aio_reqprio_max)
ircd::info::aio_reqprio_max
{