perf.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _PERF_PERF_H
  2. #define _PERF_PERF_H
  3. #include <time.h>
  4. #include <stdbool.h>
  5. #include <linux/types.h>
  6. #include <linux/perf_event.h>
  7. extern bool test_attr__enabled;
  8. void test_attr__init(void);
  9. void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
  10. int fd, int group_fd, unsigned long flags);
  11. #define HAVE_ATTR_TEST
  12. #include "perf-sys.h"
  13. #ifndef NSEC_PER_SEC
  14. # define NSEC_PER_SEC 1000000000ULL
  15. #endif
  16. #ifndef NSEC_PER_USEC
  17. # define NSEC_PER_USEC 1000ULL
  18. #endif
  19. static inline unsigned long long rdclock(void)
  20. {
  21. struct timespec ts;
  22. clock_gettime(CLOCK_MONOTONIC, &ts);
  23. return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
  24. }
  25. #define MAX_NR_CPUS 1024
  26. extern const char *input_name;
  27. extern bool perf_host, perf_guest;
  28. extern const char perf_version_string[];
  29. void pthread__unblock_sigwinch(void);
  30. #include "util/target.h"
  31. struct record_opts {
  32. struct target target;
  33. bool group;
  34. bool inherit_stat;
  35. bool no_buffering;
  36. bool no_inherit;
  37. bool no_inherit_set;
  38. bool no_samples;
  39. bool raw_samples;
  40. bool sample_address;
  41. bool sample_weight;
  42. bool sample_time;
  43. bool sample_time_set;
  44. bool callgraph_set;
  45. bool period;
  46. bool running_time;
  47. bool full_auxtrace;
  48. bool auxtrace_snapshot_mode;
  49. bool record_switch_events;
  50. unsigned int freq;
  51. unsigned int mmap_pages;
  52. unsigned int auxtrace_mmap_pages;
  53. unsigned int user_freq;
  54. u64 branch_stack;
  55. u64 sample_intr_regs;
  56. u64 default_interval;
  57. u64 user_interval;
  58. size_t auxtrace_snapshot_size;
  59. const char *auxtrace_snapshot_opts;
  60. bool sample_transaction;
  61. unsigned initial_delay;
  62. bool use_clockid;
  63. clockid_t clockid;
  64. unsigned int proc_map_timeout;
  65. };
  66. struct option;
  67. extern const char * const *record_usage;
  68. extern struct option *record_options;
  69. #endif