cpu.h 955 B

1234567891011121314151617181920212223242526272829303132
  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 load; /* Current CPU load in percents. */
  13. lub_list_t *irqs; /* List of IRQs belong to this CPU. */
  14. };
  15. typedef struct cpu_s cpu_t;
  16. /* System CPU info */
  17. #define SYSFS_CPU_PATH "/sys/devices/system/cpu"
  18. /* CPU IDs compare function */
  19. int cpu_list_compare(const void *first, const void *second);
  20. int cpu_list_compare_len(const void *first, const void *second);
  21. /* CPU list functions */
  22. int cpu_list_free(lub_list_t *cpus);
  23. int scan_cpus(lub_list_t *cpus);
  24. int show_cpus(lub_list_t *cpus);
  25. cpu_t * cpu_list_search(lub_list_t *cpus, unsigned int id);
  26. #endif