perf.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifndef MAX_NR_CPUS
  26. #define MAX_NR_CPUS 1024
  27. #endif
  28. extern const char *input_name;
  29. extern bool perf_host, perf_guest;
  30. extern const char perf_version_string[];
  31. void pthread__unblock_sigwinch(void);
  32. #include "util/target.h"
  33. struct record_opts {
  34. struct target target;
  35. bool group;
  36. bool inherit_stat;
  37. bool no_buffering;
  38. bool no_inherit;
  39. bool no_inherit_set;
  40. bool no_samples;
  41. bool raw_samples;
  42. bool sample_address;
  43. bool sample_weight;
  44. bool sample_time;
  45. bool sample_time_set;
  46. bool callgraph_set;
  47. bool period;
  48. bool running_time;
  49. bool full_auxtrace;
  50. bool auxtrace_snapshot_mode;
  51. bool record_switch_events;
  52. unsigned int freq;
  53. unsigned int mmap_pages;
  54. unsigned int auxtrace_mmap_pages;
  55. unsigned int user_freq;
  56. u64 branch_stack;
  57. u64 sample_intr_regs;
  58. u64 default_interval;
  59. u64 user_interval;
  60. size_t auxtrace_snapshot_size;
  61. const char *auxtrace_snapshot_opts;
  62. bool sample_transaction;
  63. unsigned initial_delay;
  64. bool use_clockid;
  65. clockid_t clockid;
  66. unsigned int proc_map_timeout;
  67. };
  68. struct option;
  69. extern const char * const *record_usage;
  70. extern struct option *record_options;
  71. #endif