evlist.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __PERF_EVLIST_H
  2. #define __PERF_EVLIST_H 1
  3. #include <linux/list.h>
  4. #include "../perf.h"
  5. #include "event.h"
  6. struct pollfd;
  7. struct thread_map;
  8. struct cpu_map;
  9. #define PERF_EVLIST__HLIST_BITS 8
  10. #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
  11. struct perf_evlist {
  12. struct list_head entries;
  13. struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
  14. int nr_entries;
  15. int nr_fds;
  16. int mmap_len;
  17. bool overwrite;
  18. union perf_event event_copy;
  19. struct perf_mmap *mmap;
  20. struct pollfd *pollfd;
  21. struct thread_map *threads;
  22. struct cpu_map *cpus;
  23. };
  24. struct perf_evsel;
  25. struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
  26. struct thread_map *threads);
  27. void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
  28. struct thread_map *threads);
  29. void perf_evlist__exit(struct perf_evlist *evlist);
  30. void perf_evlist__delete(struct perf_evlist *evlist);
  31. void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
  32. int perf_evlist__add_default(struct perf_evlist *evlist);
  33. void perf_evlist__id_add(struct perf_evlist *evlist, struct perf_evsel *evsel,
  34. int cpu, int thread, u64 id);
  35. int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
  36. void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
  37. struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
  38. union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);
  39. int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
  40. int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
  41. void perf_evlist__munmap(struct perf_evlist *evlist);
  42. static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
  43. struct cpu_map *cpus,
  44. struct thread_map *threads)
  45. {
  46. evlist->cpus = cpus;
  47. evlist->threads = threads;
  48. }
  49. int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
  50. pid_t target_tid, const char *cpu_list);
  51. void perf_evlist__delete_maps(struct perf_evlist *evlist);
  52. int perf_evlist__set_filters(struct perf_evlist *evlist);
  53. #endif /* __PERF_EVLIST_H */