perf_counter.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. /*
  2. * Performance counters:
  3. *
  4. * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
  5. * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
  6. * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
  7. *
  8. * Data type definitions, declarations, prototypes.
  9. *
  10. * Started by: Thomas Gleixner and Ingo Molnar
  11. *
  12. * For licencing details see kernel-base/COPYING
  13. */
  14. #ifndef _LINUX_PERF_COUNTER_H
  15. #define _LINUX_PERF_COUNTER_H
  16. #include <linux/types.h>
  17. #include <linux/ioctl.h>
  18. #include <asm/byteorder.h>
  19. /*
  20. * User-space ABI bits:
  21. */
  22. /*
  23. * attr.type
  24. */
  25. enum perf_type_id {
  26. PERF_TYPE_HARDWARE = 0,
  27. PERF_TYPE_SOFTWARE = 1,
  28. PERF_TYPE_TRACEPOINT = 2,
  29. PERF_TYPE_HW_CACHE = 3,
  30. PERF_TYPE_RAW = 4,
  31. PERF_TYPE_MAX, /* non-ABI */
  32. };
  33. /*
  34. * Generalized performance counter event types, used by the
  35. * attr.event_id parameter of the sys_perf_counter_open()
  36. * syscall:
  37. */
  38. enum perf_hw_id {
  39. /*
  40. * Common hardware events, generalized by the kernel:
  41. */
  42. PERF_COUNT_HW_CPU_CYCLES = 0,
  43. PERF_COUNT_HW_INSTRUCTIONS = 1,
  44. PERF_COUNT_HW_CACHE_REFERENCES = 2,
  45. PERF_COUNT_HW_CACHE_MISSES = 3,
  46. PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
  47. PERF_COUNT_HW_BRANCH_MISSES = 5,
  48. PERF_COUNT_HW_BUS_CYCLES = 6,
  49. PERF_COUNT_HW_MAX, /* non-ABI */
  50. };
  51. /*
  52. * Generalized hardware cache counters:
  53. *
  54. * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
  55. * { read, write, prefetch } x
  56. * { accesses, misses }
  57. */
  58. enum perf_hw_cache_id {
  59. PERF_COUNT_HW_CACHE_L1D = 0,
  60. PERF_COUNT_HW_CACHE_L1I = 1,
  61. PERF_COUNT_HW_CACHE_LL = 2,
  62. PERF_COUNT_HW_CACHE_DTLB = 3,
  63. PERF_COUNT_HW_CACHE_ITLB = 4,
  64. PERF_COUNT_HW_CACHE_BPU = 5,
  65. PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
  66. };
  67. enum perf_hw_cache_op_id {
  68. PERF_COUNT_HW_CACHE_OP_READ = 0,
  69. PERF_COUNT_HW_CACHE_OP_WRITE = 1,
  70. PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
  71. PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
  72. };
  73. enum perf_hw_cache_op_result_id {
  74. PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
  75. PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
  76. PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
  77. };
  78. /*
  79. * Special "software" counters provided by the kernel, even if the hardware
  80. * does not support performance counters. These counters measure various
  81. * physical and sw events of the kernel (and allow the profiling of them as
  82. * well):
  83. */
  84. enum perf_sw_ids {
  85. PERF_COUNT_SW_CPU_CLOCK = 0,
  86. PERF_COUNT_SW_TASK_CLOCK = 1,
  87. PERF_COUNT_SW_PAGE_FAULTS = 2,
  88. PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
  89. PERF_COUNT_SW_CPU_MIGRATIONS = 4,
  90. PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
  91. PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
  92. PERF_COUNT_SW_MAX, /* non-ABI */
  93. };
  94. /*
  95. * Bits that can be set in attr.sample_type to request information
  96. * in the overflow packets.
  97. */
  98. enum perf_counter_sample_format {
  99. PERF_SAMPLE_IP = 1U << 0,
  100. PERF_SAMPLE_TID = 1U << 1,
  101. PERF_SAMPLE_TIME = 1U << 2,
  102. PERF_SAMPLE_ADDR = 1U << 3,
  103. PERF_SAMPLE_GROUP = 1U << 4,
  104. PERF_SAMPLE_CALLCHAIN = 1U << 5,
  105. PERF_SAMPLE_ID = 1U << 6,
  106. PERF_SAMPLE_CPU = 1U << 7,
  107. PERF_SAMPLE_PERIOD = 1U << 8,
  108. };
  109. /*
  110. * Bits that can be set in attr.read_format to request that
  111. * reads on the counter should return the indicated quantities,
  112. * in increasing order of bit value, after the counter value.
  113. */
  114. enum perf_counter_read_format {
  115. PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
  116. PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
  117. PERF_FORMAT_ID = 1U << 2,
  118. };
  119. /*
  120. * Hardware event to monitor via a performance monitoring counter:
  121. */
  122. struct perf_counter_attr {
  123. /*
  124. * Major type: hardware/software/tracepoint/etc.
  125. */
  126. __u32 type;
  127. __u32 __reserved_1;
  128. /*
  129. * Type specific configuration information.
  130. */
  131. __u64 config;
  132. union {
  133. __u64 sample_period;
  134. __u64 sample_freq;
  135. };
  136. __u64 sample_type;
  137. __u64 read_format;
  138. __u64 disabled : 1, /* off by default */
  139. inherit : 1, /* children inherit it */
  140. pinned : 1, /* must always be on PMU */
  141. exclusive : 1, /* only group on PMU */
  142. exclude_user : 1, /* don't count user */
  143. exclude_kernel : 1, /* ditto kernel */
  144. exclude_hv : 1, /* ditto hypervisor */
  145. exclude_idle : 1, /* don't count when idle */
  146. mmap : 1, /* include mmap data */
  147. comm : 1, /* include comm data */
  148. freq : 1, /* use freq, not period */
  149. __reserved_2 : 53;
  150. __u32 wakeup_events; /* wakeup every n events */
  151. __u32 __reserved_3;
  152. __u64 __reserved_4;
  153. };
  154. /*
  155. * Ioctls that can be done on a perf counter fd:
  156. */
  157. #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0)
  158. #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1)
  159. #define PERF_COUNTER_IOC_REFRESH _IO ('$', 2)
  160. #define PERF_COUNTER_IOC_RESET _IO ('$', 3)
  161. #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64)
  162. enum perf_counter_ioc_flags {
  163. PERF_IOC_FLAG_GROUP = 1U << 0,
  164. };
  165. /*
  166. * Structure of the page that can be mapped via mmap
  167. */
  168. struct perf_counter_mmap_page {
  169. __u32 version; /* version number of this structure */
  170. __u32 compat_version; /* lowest version this is compat with */
  171. /*
  172. * Bits needed to read the hw counters in user-space.
  173. *
  174. * u32 seq;
  175. * s64 count;
  176. *
  177. * do {
  178. * seq = pc->lock;
  179. *
  180. * barrier()
  181. * if (pc->index) {
  182. * count = pmc_read(pc->index - 1);
  183. * count += pc->offset;
  184. * } else
  185. * goto regular_read;
  186. *
  187. * barrier();
  188. * } while (pc->lock != seq);
  189. *
  190. * NOTE: for obvious reason this only works on self-monitoring
  191. * processes.
  192. */
  193. __u32 lock; /* seqlock for synchronization */
  194. __u32 index; /* hardware counter identifier */
  195. __s64 offset; /* add to hardware counter value */
  196. /*
  197. * Control data for the mmap() data buffer.
  198. *
  199. * User-space reading this value should issue an rmb(), on SMP capable
  200. * platforms, after reading this value -- see perf_counter_wakeup().
  201. */
  202. __u64 data_head; /* head in the data section */
  203. };
  204. #define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0)
  205. #define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0)
  206. #define PERF_EVENT_MISC_KERNEL (1 << 0)
  207. #define PERF_EVENT_MISC_USER (2 << 0)
  208. #define PERF_EVENT_MISC_HYPERVISOR (3 << 0)
  209. #define PERF_EVENT_MISC_OVERFLOW (1 << 2)
  210. struct perf_event_header {
  211. __u32 type;
  212. __u16 misc;
  213. __u16 size;
  214. };
  215. enum perf_event_type {
  216. /*
  217. * The MMAP events record the PROT_EXEC mappings so that we can
  218. * correlate userspace IPs to code. They have the following structure:
  219. *
  220. * struct {
  221. * struct perf_event_header header;
  222. *
  223. * u32 pid, tid;
  224. * u64 addr;
  225. * u64 len;
  226. * u64 pgoff;
  227. * char filename[];
  228. * };
  229. */
  230. PERF_EVENT_MMAP = 1,
  231. /*
  232. * struct {
  233. * struct perf_event_header header;
  234. *
  235. * u32 pid, tid;
  236. * char comm[];
  237. * };
  238. */
  239. PERF_EVENT_COMM = 3,
  240. /*
  241. * struct {
  242. * struct perf_event_header header;
  243. * u64 time;
  244. * u64 id;
  245. * u64 sample_period;
  246. * };
  247. */
  248. PERF_EVENT_PERIOD = 4,
  249. /*
  250. * struct {
  251. * struct perf_event_header header;
  252. * u64 time;
  253. * u64 id;
  254. * };
  255. */
  256. PERF_EVENT_THROTTLE = 5,
  257. PERF_EVENT_UNTHROTTLE = 6,
  258. /*
  259. * struct {
  260. * struct perf_event_header header;
  261. * u32 pid, ppid;
  262. * };
  263. */
  264. PERF_EVENT_FORK = 7,
  265. /*
  266. * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
  267. * will be PERF_RECORD_*
  268. *
  269. * struct {
  270. * struct perf_event_header header;
  271. *
  272. * { u64 ip; } && PERF_RECORD_IP
  273. * { u32 pid, tid; } && PERF_RECORD_TID
  274. * { u64 time; } && PERF_RECORD_TIME
  275. * { u64 addr; } && PERF_RECORD_ADDR
  276. * { u64 config; } && PERF_RECORD_CONFIG
  277. * { u32 cpu, res; } && PERF_RECORD_CPU
  278. *
  279. * { u64 nr;
  280. * { u64 id, val; } cnt[nr]; } && PERF_RECORD_GROUP
  281. *
  282. * { u16 nr,
  283. * hv,
  284. * kernel,
  285. * user;
  286. * u64 ips[nr]; } && PERF_RECORD_CALLCHAIN
  287. * };
  288. */
  289. };
  290. #ifdef __KERNEL__
  291. /*
  292. * Kernel-internal data types and definitions:
  293. */
  294. #ifdef CONFIG_PERF_COUNTERS
  295. # include <asm/perf_counter.h>
  296. #endif
  297. #include <linux/list.h>
  298. #include <linux/mutex.h>
  299. #include <linux/rculist.h>
  300. #include <linux/rcupdate.h>
  301. #include <linux/spinlock.h>
  302. #include <linux/hrtimer.h>
  303. #include <linux/fs.h>
  304. #include <linux/pid_namespace.h>
  305. #include <asm/atomic.h>
  306. struct task_struct;
  307. /**
  308. * struct hw_perf_counter - performance counter hardware details:
  309. */
  310. struct hw_perf_counter {
  311. #ifdef CONFIG_PERF_COUNTERS
  312. union {
  313. struct { /* hardware */
  314. u64 config;
  315. unsigned long config_base;
  316. unsigned long counter_base;
  317. int idx;
  318. };
  319. union { /* software */
  320. atomic64_t count;
  321. struct hrtimer hrtimer;
  322. };
  323. };
  324. atomic64_t prev_count;
  325. u64 sample_period;
  326. u64 last_period;
  327. atomic64_t period_left;
  328. u64 interrupts;
  329. u64 freq_count;
  330. u64 freq_interrupts;
  331. u64 freq_stamp;
  332. #endif
  333. };
  334. struct perf_counter;
  335. /**
  336. * struct pmu - generic performance monitoring unit
  337. */
  338. struct pmu {
  339. int (*enable) (struct perf_counter *counter);
  340. void (*disable) (struct perf_counter *counter);
  341. void (*read) (struct perf_counter *counter);
  342. void (*unthrottle) (struct perf_counter *counter);
  343. };
  344. /**
  345. * enum perf_counter_active_state - the states of a counter
  346. */
  347. enum perf_counter_active_state {
  348. PERF_COUNTER_STATE_ERROR = -2,
  349. PERF_COUNTER_STATE_OFF = -1,
  350. PERF_COUNTER_STATE_INACTIVE = 0,
  351. PERF_COUNTER_STATE_ACTIVE = 1,
  352. };
  353. struct file;
  354. struct perf_mmap_data {
  355. struct rcu_head rcu_head;
  356. int nr_pages; /* nr of data pages */
  357. int nr_locked; /* nr pages mlocked */
  358. atomic_t poll; /* POLL_ for wakeups */
  359. atomic_t events; /* event limit */
  360. atomic_long_t head; /* write position */
  361. atomic_long_t done_head; /* completed head */
  362. atomic_t lock; /* concurrent writes */
  363. atomic_t wakeup; /* needs a wakeup */
  364. struct perf_counter_mmap_page *user_page;
  365. void *data_pages[0];
  366. };
  367. struct perf_pending_entry {
  368. struct perf_pending_entry *next;
  369. void (*func)(struct perf_pending_entry *);
  370. };
  371. /**
  372. * struct perf_counter - performance counter kernel representation:
  373. */
  374. struct perf_counter {
  375. #ifdef CONFIG_PERF_COUNTERS
  376. struct list_head list_entry;
  377. struct list_head event_entry;
  378. struct list_head sibling_list;
  379. int nr_siblings;
  380. struct perf_counter *group_leader;
  381. const struct pmu *pmu;
  382. enum perf_counter_active_state state;
  383. atomic64_t count;
  384. /*
  385. * These are the total time in nanoseconds that the counter
  386. * has been enabled (i.e. eligible to run, and the task has
  387. * been scheduled in, if this is a per-task counter)
  388. * and running (scheduled onto the CPU), respectively.
  389. *
  390. * They are computed from tstamp_enabled, tstamp_running and
  391. * tstamp_stopped when the counter is in INACTIVE or ACTIVE state.
  392. */
  393. u64 total_time_enabled;
  394. u64 total_time_running;
  395. /*
  396. * These are timestamps used for computing total_time_enabled
  397. * and total_time_running when the counter is in INACTIVE or
  398. * ACTIVE state, measured in nanoseconds from an arbitrary point
  399. * in time.
  400. * tstamp_enabled: the notional time when the counter was enabled
  401. * tstamp_running: the notional time when the counter was scheduled on
  402. * tstamp_stopped: in INACTIVE state, the notional time when the
  403. * counter was scheduled off.
  404. */
  405. u64 tstamp_enabled;
  406. u64 tstamp_running;
  407. u64 tstamp_stopped;
  408. struct perf_counter_attr attr;
  409. struct hw_perf_counter hw;
  410. struct perf_counter_context *ctx;
  411. struct file *filp;
  412. /*
  413. * These accumulate total time (in nanoseconds) that children
  414. * counters have been enabled and running, respectively.
  415. */
  416. atomic64_t child_total_time_enabled;
  417. atomic64_t child_total_time_running;
  418. /*
  419. * Protect attach/detach and child_list:
  420. */
  421. struct mutex child_mutex;
  422. struct list_head child_list;
  423. struct perf_counter *parent;
  424. int oncpu;
  425. int cpu;
  426. struct list_head owner_entry;
  427. struct task_struct *owner;
  428. /* mmap bits */
  429. struct mutex mmap_mutex;
  430. atomic_t mmap_count;
  431. struct perf_mmap_data *data;
  432. /* poll related */
  433. wait_queue_head_t waitq;
  434. struct fasync_struct *fasync;
  435. /* delayed work for NMIs and such */
  436. int pending_wakeup;
  437. int pending_kill;
  438. int pending_disable;
  439. struct perf_pending_entry pending;
  440. atomic_t event_limit;
  441. void (*destroy)(struct perf_counter *);
  442. struct rcu_head rcu_head;
  443. struct pid_namespace *ns;
  444. u64 id;
  445. #endif
  446. };
  447. /**
  448. * struct perf_counter_context - counter context structure
  449. *
  450. * Used as a container for task counters and CPU counters as well:
  451. */
  452. struct perf_counter_context {
  453. /*
  454. * Protect the states of the counters in the list,
  455. * nr_active, and the list:
  456. */
  457. spinlock_t lock;
  458. /*
  459. * Protect the list of counters. Locking either mutex or lock
  460. * is sufficient to ensure the list doesn't change; to change
  461. * the list you need to lock both the mutex and the spinlock.
  462. */
  463. struct mutex mutex;
  464. struct list_head counter_list;
  465. struct list_head event_list;
  466. int nr_counters;
  467. int nr_active;
  468. int is_active;
  469. atomic_t refcount;
  470. struct task_struct *task;
  471. /*
  472. * Context clock, runs when context enabled.
  473. */
  474. u64 time;
  475. u64 timestamp;
  476. /*
  477. * These fields let us detect when two contexts have both
  478. * been cloned (inherited) from a common ancestor.
  479. */
  480. struct perf_counter_context *parent_ctx;
  481. u64 parent_gen;
  482. u64 generation;
  483. int pin_count;
  484. struct rcu_head rcu_head;
  485. };
  486. /**
  487. * struct perf_counter_cpu_context - per cpu counter context structure
  488. */
  489. struct perf_cpu_context {
  490. struct perf_counter_context ctx;
  491. struct perf_counter_context *task_ctx;
  492. int active_oncpu;
  493. int max_pertask;
  494. int exclusive;
  495. /*
  496. * Recursion avoidance:
  497. *
  498. * task, softirq, irq, nmi context
  499. */
  500. int recursion[4];
  501. };
  502. #ifdef CONFIG_PERF_COUNTERS
  503. /*
  504. * Set by architecture code:
  505. */
  506. extern int perf_max_counters;
  507. extern const struct pmu *hw_perf_counter_init(struct perf_counter *counter);
  508. extern void perf_counter_task_sched_in(struct task_struct *task, int cpu);
  509. extern void perf_counter_task_sched_out(struct task_struct *task,
  510. struct task_struct *next, int cpu);
  511. extern void perf_counter_task_tick(struct task_struct *task, int cpu);
  512. extern int perf_counter_init_task(struct task_struct *child);
  513. extern void perf_counter_exit_task(struct task_struct *child);
  514. extern void perf_counter_free_task(struct task_struct *task);
  515. extern void perf_counter_do_pending(void);
  516. extern void perf_counter_print_debug(void);
  517. extern void __perf_disable(void);
  518. extern bool __perf_enable(void);
  519. extern void perf_disable(void);
  520. extern void perf_enable(void);
  521. extern int perf_counter_task_disable(void);
  522. extern int perf_counter_task_enable(void);
  523. extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
  524. struct perf_cpu_context *cpuctx,
  525. struct perf_counter_context *ctx, int cpu);
  526. extern void perf_counter_update_userpage(struct perf_counter *counter);
  527. struct perf_sample_data {
  528. struct pt_regs *regs;
  529. u64 addr;
  530. u64 period;
  531. };
  532. extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
  533. struct perf_sample_data *data);
  534. /*
  535. * Return 1 for a software counter, 0 for a hardware counter
  536. */
  537. static inline int is_software_counter(struct perf_counter *counter)
  538. {
  539. return (counter->attr.type != PERF_TYPE_RAW) &&
  540. (counter->attr.type != PERF_TYPE_HARDWARE);
  541. }
  542. extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
  543. extern void __perf_counter_mmap(struct vm_area_struct *vma);
  544. static inline void perf_counter_mmap(struct vm_area_struct *vma)
  545. {
  546. if (vma->vm_flags & VM_EXEC)
  547. __perf_counter_mmap(vma);
  548. }
  549. extern void perf_counter_comm(struct task_struct *tsk);
  550. extern void perf_counter_fork(struct task_struct *tsk);
  551. extern void perf_counter_task_migration(struct task_struct *task, int cpu);
  552. #define MAX_STACK_DEPTH 255
  553. struct perf_callchain_entry {
  554. u16 nr;
  555. u16 hv;
  556. u16 kernel;
  557. u16 user;
  558. u64 ip[MAX_STACK_DEPTH];
  559. };
  560. extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
  561. extern int sysctl_perf_counter_paranoid;
  562. extern int sysctl_perf_counter_mlock;
  563. extern int sysctl_perf_counter_sample_rate;
  564. extern void perf_counter_init(void);
  565. #ifndef perf_misc_flags
  566. #define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
  567. PERF_EVENT_MISC_KERNEL)
  568. #define perf_instruction_pointer(regs) instruction_pointer(regs)
  569. #endif
  570. #else
  571. static inline void
  572. perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
  573. static inline void
  574. perf_counter_task_sched_out(struct task_struct *task,
  575. struct task_struct *next, int cpu) { }
  576. static inline void
  577. perf_counter_task_tick(struct task_struct *task, int cpu) { }
  578. static inline int perf_counter_init_task(struct task_struct *child) { return 0; }
  579. static inline void perf_counter_exit_task(struct task_struct *child) { }
  580. static inline void perf_counter_free_task(struct task_struct *task) { }
  581. static inline void perf_counter_do_pending(void) { }
  582. static inline void perf_counter_print_debug(void) { }
  583. static inline void perf_disable(void) { }
  584. static inline void perf_enable(void) { }
  585. static inline int perf_counter_task_disable(void) { return -EINVAL; }
  586. static inline int perf_counter_task_enable(void) { return -EINVAL; }
  587. static inline void
  588. perf_swcounter_event(u32 event, u64 nr, int nmi,
  589. struct pt_regs *regs, u64 addr) { }
  590. static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
  591. static inline void perf_counter_comm(struct task_struct *tsk) { }
  592. static inline void perf_counter_fork(struct task_struct *tsk) { }
  593. static inline void perf_counter_init(void) { }
  594. static inline void perf_counter_task_migration(struct task_struct *task,
  595. int cpu) { }
  596. #endif
  597. #endif /* __KERNEL__ */
  598. #endif /* _LINUX_PERF_COUNTER_H */