diff options
Diffstat (limited to 'src/hardware/sysfs.h')
-rw-r--r-- | src/hardware/sysfs.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/hardware/sysfs.h b/src/hardware/sysfs.h index 028b559..297a1a7 100644 --- a/src/hardware/sysfs.h +++ b/src/hardware/sysfs.h @@ -27,9 +27,23 @@ #include <dirent.h> #include <errno.h> #include <limits.h> +#include <sys/stat.h> +#include <sys/types.h> #include "utils.h" -#define SYSFS_CPU_PATH "/sys/devices/system/cpu" +#define SYSFS_PATH "/sys/devices/system" +#define SYSFS_CPU_PATH SYSFS_PATH "/cpu" +#define SYSFS_KERNEL_MM "/sys/kernel/mm" + + +/* Transparent memory huge pages statuses. */ +typedef enum _ThpStatus { + thp_unsupported = 0, + thp_never, + thp_madvise, + thp_always +} ThpStatus; + /* Processor cache from sysfs. */ typedef struct _SysfsCpuCache { @@ -59,5 +73,25 @@ short sysfs_get_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb); */ void sysfs_free_cpu_caches(SysfsCpuCache **caches, unsigned *caches_nb); +/* + * Detects whether system has NUMA memory layout. + * @return 0 if no, 1 if yes + */ +short sysfs_has_numa(); + +/* + * Get all supported sizes of memory huge pages in kB + * @param sizes array of all supported sizes if huge pages + * @param sizes_nb number of items in array + * @return 0 if success, negative value otherwise + */ +short sysfs_get_sizes_of_hugepages(unsigned **sizes, unsigned *sizes_nb); + +/* + * Get current status of transparent memory huge pages. + * @return ThpStatus + */ +ThpStatus sysfs_get_transparent_hugepages_status(); + #endif /* SYSFS_H_ */ |