perf.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 period;
  44. bool sample_intr_regs;
  45. bool running_time;
  46. bool full_auxtrace;
  47. bool auxtrace_snapshot_mode;
  48. unsigned int freq;
  49. unsigned int mmap_pages;
  50. unsigned int auxtrace_mmap_pages;
  51. unsigned int user_freq;
  52. u64 branch_stack;
  53. u64 default_interval;
  54. u64 user_interval;
  55. size_t auxtrace_snapshot_size;
  56. const char *auxtrace_snapshot_opts;
  57. bool sample_transaction;
  58. unsigned initial_delay;
  59. bool use_clockid;
  60. clockid_t clockid;
  61. unsigned int proc_map_timeout;
  62. };
  63. struct option;
  64. extern const char * const *record_usage;
  65. extern struct option *record_options;
  66. #endif