perf.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _PERF_PERF_H
  3. #define _PERF_PERF_H
  4. #include <time.h>
  5. #include <stdbool.h>
  6. #include <linux/types.h>
  7. #include <linux/stddef.h>
  8. #include <linux/perf_event.h>
  9. extern bool test_attr__enabled;
  10. void test_attr__ready(void);
  11. void test_attr__init(void);
  12. void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
  13. int fd, int group_fd, unsigned long flags);
  14. #define HAVE_ATTR_TEST
  15. #include "perf-sys.h"
  16. static inline unsigned long long rdclock(void)
  17. {
  18. struct timespec ts;
  19. clock_gettime(CLOCK_MONOTONIC, &ts);
  20. return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
  21. }
  22. #ifndef MAX_NR_CPUS
  23. #define MAX_NR_CPUS 2048
  24. #endif
  25. extern const char *input_name;
  26. extern bool perf_host, perf_guest;
  27. extern const char perf_version_string[];
  28. void pthread__unblock_sigwinch(void);
  29. #include "util/target.h"
  30. struct record_opts {
  31. struct target target;
  32. bool group;
  33. bool inherit_stat;
  34. bool no_buffering;
  35. bool no_inherit;
  36. bool no_inherit_set;
  37. bool no_samples;
  38. bool raw_samples;
  39. bool sample_address;
  40. bool sample_phys_addr;
  41. bool sample_weight;
  42. bool sample_time;
  43. bool sample_time_set;
  44. bool sample_cpu;
  45. bool period;
  46. bool period_set;
  47. bool running_time;
  48. bool full_auxtrace;
  49. bool auxtrace_snapshot_mode;
  50. bool record_namespaces;
  51. bool record_switch_events;
  52. bool all_kernel;
  53. bool all_user;
  54. bool tail_synthesize;
  55. bool overwrite;
  56. bool ignore_missing_thread;
  57. bool strict_freq;
  58. bool sample_id;
  59. unsigned int freq;
  60. unsigned int mmap_pages;
  61. unsigned int auxtrace_mmap_pages;
  62. unsigned int user_freq;
  63. u64 branch_stack;
  64. u64 sample_intr_regs;
  65. u64 sample_user_regs;
  66. u64 default_interval;
  67. u64 user_interval;
  68. size_t auxtrace_snapshot_size;
  69. const char *auxtrace_snapshot_opts;
  70. bool sample_transaction;
  71. unsigned initial_delay;
  72. bool use_clockid;
  73. clockid_t clockid;
  74. unsigned int proc_map_timeout;
  75. };
  76. struct option;
  77. extern const char * const *record_usage;
  78. extern struct option *record_options;
  79. extern int version_verbose;
  80. int record__parse_freq(const struct option *opt, const char *str, int unset);
  81. #endif