cpu.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. unsigned int use_cnt; /* How many IRQs were moved to this CPU on current tact */
  16. };
  17. typedef struct cpu_s cpu_t;
  18. /* System CPU info */
  19. #define SYSFS_CPU_PATH "/sys/devices/system/cpu"
  20. /* CPU IDs compare function */
  21. int cpu_list_compare(const void *first, const void *second);
  22. int cpu_list_compare_len(const void *first, const void *second);
  23. /* CPU list functions */
  24. int cpu_list_free(lub_list_t *cpus);
  25. int scan_cpus(lub_list_t *cpus, int ht);
  26. int show_cpus(lub_list_t *cpus);
  27. cpu_t * cpu_list_search(lub_list_t *cpus, unsigned int id);
  28. #endif