2025-02-03 02:19:10 +01:00
|
|
|
#pragma once
|
2017-07-18 14:21:29 +02:00
|
|
|
|
2020-12-12 13:01:29 +01:00
|
|
|
#include "util/types.hpp"
|
2017-07-18 14:21:29 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace utils
|
|
|
|
|
{
|
2017-11-09 18:33:18 +01:00
|
|
|
bool has_ssse3();
|
2017-07-18 14:21:29 +02:00
|
|
|
|
2018-04-09 16:45:37 +02:00
|
|
|
bool has_sse41();
|
|
|
|
|
|
2017-11-09 18:33:18 +01:00
|
|
|
bool has_avx();
|
2017-07-18 14:21:29 +02:00
|
|
|
|
2017-12-16 01:19:21 +01:00
|
|
|
bool has_avx2();
|
|
|
|
|
|
2017-11-09 18:33:18 +01:00
|
|
|
bool has_rtm();
|
2017-07-18 19:03:47 +02:00
|
|
|
|
2019-06-01 05:34:46 +02:00
|
|
|
bool has_tsx_force_abort();
|
2021-12-30 17:39:18 +01:00
|
|
|
|
2021-11-04 17:44:25 +01:00
|
|
|
bool has_rtm_always_abort();
|
2019-06-01 05:34:46 +02:00
|
|
|
|
2018-06-13 13:54:16 +02:00
|
|
|
bool has_mpx();
|
|
|
|
|
|
2020-03-10 17:21:00 +01:00
|
|
|
bool has_avx512();
|
2017-12-16 01:19:21 +01:00
|
|
|
|
2020-08-06 21:37:10 +02:00
|
|
|
bool has_avx512_icl();
|
|
|
|
|
|
2021-12-30 17:39:18 +01:00
|
|
|
bool has_avx512_vnni();
|
|
|
|
|
|
2023-07-28 05:55:20 +02:00
|
|
|
bool has_avx10();
|
|
|
|
|
|
|
|
|
|
u32 avx10_isa_version();
|
|
|
|
|
|
2018-01-16 12:32:57 +01:00
|
|
|
bool has_xop();
|
|
|
|
|
|
2019-11-14 17:09:34 +01:00
|
|
|
bool has_clwb();
|
|
|
|
|
|
2020-04-04 20:12:06 +02:00
|
|
|
bool has_invariant_tsc();
|
|
|
|
|
|
|
|
|
|
bool has_fma3();
|
|
|
|
|
|
|
|
|
|
bool has_fma4();
|
|
|
|
|
|
2022-09-30 23:39:24 +02:00
|
|
|
bool has_fast_vperm2b();
|
|
|
|
|
|
2021-10-30 05:55:47 +02:00
|
|
|
bool has_erms();
|
|
|
|
|
|
|
|
|
|
bool has_fsrm();
|
|
|
|
|
|
2023-08-05 10:49:30 +02:00
|
|
|
bool has_waitx();
|
|
|
|
|
|
|
|
|
|
bool has_waitpkg();
|
|
|
|
|
|
|
|
|
|
bool has_appropriate_um_wait();
|
|
|
|
|
|
2023-08-16 15:16:49 +02:00
|
|
|
bool has_um_wait();
|
|
|
|
|
|
2020-02-20 03:55:25 +01:00
|
|
|
std::string get_cpu_brand();
|
|
|
|
|
|
2017-07-18 14:21:29 +02:00
|
|
|
std::string get_system_info();
|
2019-02-16 14:05:13 +01:00
|
|
|
|
|
|
|
|
std::string get_firmware_version();
|
2019-04-19 14:05:47 +02:00
|
|
|
|
2025-02-03 02:19:10 +01:00
|
|
|
struct OS_version
|
|
|
|
|
{
|
|
|
|
|
std::string type;
|
|
|
|
|
std::string arch;
|
|
|
|
|
int version_major = 0;
|
|
|
|
|
int version_minor = 0;
|
|
|
|
|
int version_patch = 0;
|
|
|
|
|
};
|
|
|
|
|
OS_version get_OS_version();
|
|
|
|
|
|
|
|
|
|
std::string get_OS_version_string();
|
2019-07-15 16:20:12 +02:00
|
|
|
|
2022-01-10 14:15:04 +01:00
|
|
|
int get_maxfiles();
|
|
|
|
|
|
2022-03-05 17:32:35 +01:00
|
|
|
bool get_low_power_mode();
|
|
|
|
|
|
2020-02-20 03:55:25 +01:00
|
|
|
u64 get_total_memory();
|
|
|
|
|
|
|
|
|
|
u32 get_thread_count();
|
2020-12-09 19:29:48 +01:00
|
|
|
|
|
|
|
|
u32 get_cpu_family();
|
|
|
|
|
|
|
|
|
|
u32 get_cpu_model();
|
2021-03-06 18:02:16 +01:00
|
|
|
|
2021-10-30 05:55:47 +02:00
|
|
|
// A threshold of 0xFFFFFFFF means that the rep movsb is expected to be slow on this platform
|
|
|
|
|
u32 get_rep_movsb_threshold();
|
|
|
|
|
|
2022-07-09 13:42:03 +02:00
|
|
|
u64 _get_main_tid();
|
|
|
|
|
|
|
|
|
|
inline const u64 main_tid = _get_main_tid();
|
2024-10-24 12:01:40 +02:00
|
|
|
|
|
|
|
|
extern u64 s_tsc_freq;
|
|
|
|
|
|
|
|
|
|
inline ullong get_tsc_freq()
|
|
|
|
|
{
|
|
|
|
|
return s_tsc_freq;
|
|
|
|
|
}
|
2025-02-03 02:19:10 +01:00
|
|
|
|
|
|
|
|
std::pair<bool, usz> string_to_number(std::string_view str);
|
2025-04-05 21:50:45 +02:00
|
|
|
} // namespace utils
|