env.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __PERF_ENV_H
  2. #define __PERF_ENV_H
  3. #include <linux/types.h>
  4. #include "cpumap.h"
  5. struct cpu_topology_map {
  6. int socket_id;
  7. int core_id;
  8. };
  9. struct cpu_cache_level {
  10. u32 level;
  11. u32 line_size;
  12. u32 sets;
  13. u32 ways;
  14. char *type;
  15. char *size;
  16. char *map;
  17. };
  18. struct numa_node {
  19. u32 node;
  20. u64 mem_total;
  21. u64 mem_free;
  22. struct cpu_map *map;
  23. };
  24. struct perf_env {
  25. char *hostname;
  26. char *os_release;
  27. char *version;
  28. char *arch;
  29. int nr_cpus_online;
  30. int nr_cpus_avail;
  31. char *cpu_desc;
  32. char *cpuid;
  33. unsigned long long total_mem;
  34. unsigned int msr_pmu_type;
  35. int nr_cmdline;
  36. int nr_sibling_cores;
  37. int nr_sibling_threads;
  38. int nr_numa_nodes;
  39. int nr_pmu_mappings;
  40. int nr_groups;
  41. char *cmdline;
  42. const char **cmdline_argv;
  43. char *sibling_cores;
  44. char *sibling_threads;
  45. char *pmu_mappings;
  46. struct cpu_topology_map *cpu;
  47. struct cpu_cache_level *caches;
  48. int caches_cnt;
  49. struct numa_node *numa_nodes;
  50. };
  51. extern struct perf_env perf_env;
  52. void perf_env__exit(struct perf_env *env);
  53. int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
  54. int perf_env__read_cpu_topology_map(struct perf_env *env);
  55. void cpu_cache_level__free(struct cpu_cache_level *cache);
  56. #endif /* __PERF_ENV_H */