cpu.h 1017 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef _cpu_h
  2. #define _cpu_h
  3. #include "lub/list.h"
  4. #include "cpumask.h"
  5. struct cpu_s {
  6. unsigned int id; /* Logical processor ID */
  7. unsigned int package_id;
  8. unsigned int core_id;
  9. cpumask_t cpumask; /* Mask with one bit set - current CPU. */
  10. unsigned long long old_load_all; /* Previous whole load from /proc/stat */
  11. unsigned long long old_load_irq; /* Previous IRQ, softIRQ load */
  12. float old_load; /* Previous CPU load in percents. */
  13. float load; /* Current CPU load in percents. */
  14. lub_list_t *irqs; /* List of IRQs belong to this CPU. */
  15. };
  16. typedef struct cpu_s cpu_t;
  17. /* System CPU info */
  18. #define SYSFS_CPU_PATH "/sys/devices/system/cpu"
  19. /* CPU IDs compare function */
  20. int cpu_list_compare(const void *first, const void *second);
  21. int cpu_list_compare_len(const void *first, const void *second);
  22. /* CPU list functions */
  23. int cpu_list_free(lub_list_t *cpus);
  24. int scan_cpus(lub_list_t *cpus, int ht);
  25. int show_cpus(lub_list_t *cpus);
  26. cpu_t * cpu_list_search(lub_list_t *cpus, unsigned int id);
  27. #endif