• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 
6 #ifdef _WIN32
7 	#include <windows.h>
8 #endif
9 
10 #include <cpuinfo.h>
11 #include <cpuinfo/common.h>
12 
13 
14 enum cpuinfo_cache_level {
15 	cpuinfo_cache_level_1i  = 0,
16 	cpuinfo_cache_level_1d  = 1,
17 	cpuinfo_cache_level_2   = 2,
18 	cpuinfo_cache_level_3   = 3,
19 	cpuinfo_cache_level_4   = 4,
20 	cpuinfo_cache_level_max = 5,
21 };
22 
23 extern CPUINFO_INTERNAL bool cpuinfo_is_initialized;
24 extern CPUINFO_INTERNAL struct cpuinfo_processor* cpuinfo_processors;
25 extern CPUINFO_INTERNAL struct cpuinfo_core* cpuinfo_cores;
26 extern CPUINFO_INTERNAL struct cpuinfo_cluster* cpuinfo_clusters;
27 extern CPUINFO_INTERNAL struct cpuinfo_package* cpuinfo_packages;
28 extern CPUINFO_INTERNAL struct cpuinfo_cache* cpuinfo_cache[cpuinfo_cache_level_max];
29 extern CPUINFO_INTERNAL uint32_t cpuinfo_processors_count;
30 extern CPUINFO_INTERNAL uint32_t cpuinfo_cores_count;
31 extern CPUINFO_INTERNAL uint32_t cpuinfo_clusters_count;
32 extern CPUINFO_INTERNAL uint32_t cpuinfo_packages_count;
33 extern CPUINFO_INTERNAL uint32_t cpuinfo_cache_count[cpuinfo_cache_level_max];
34 extern CPUINFO_INTERNAL uint32_t cpuinfo_max_cache_size;
35 
36 CPUINFO_PRIVATE void cpuinfo_x86_mach_init(void);
37 CPUINFO_PRIVATE void cpuinfo_x86_linux_init(void);
38 #ifdef _WIN32
39 	CPUINFO_PRIVATE BOOL CALLBACK cpuinfo_x86_windows_init(PINIT_ONCE init_once, PVOID parameter, PVOID* context);
40 #endif
41 CPUINFO_PRIVATE void cpuinfo_arm_mach_init(void);
42 CPUINFO_PRIVATE void cpuinfo_arm_linux_init(void);
43 
44 CPUINFO_PRIVATE uint32_t cpuinfo_compute_max_cache_size(const struct cpuinfo_processor* processor);
45 
46 typedef void (*cpuinfo_processor_callback)(uint32_t);
47