aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h75
1 files changed, 48 insertions, 27 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index a177698d95e2..90e0521b1690 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -288,7 +288,7 @@ struct perf_event_mmap_page {
288}; 288};
289 289
290#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) 290#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0)
291#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) 291#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
292#define PERF_RECORD_MISC_KERNEL (1 << 0) 292#define PERF_RECORD_MISC_KERNEL (1 << 0)
293#define PERF_RECORD_MISC_USER (2 << 0) 293#define PERF_RECORD_MISC_USER (2 << 0)
294#define PERF_RECORD_MISC_HYPERVISOR (3 << 0) 294#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
@@ -354,8 +354,8 @@ enum perf_event_type {
354 * u64 stream_id; 354 * u64 stream_id;
355 * }; 355 * };
356 */ 356 */
357 PERF_RECORD_THROTTLE = 5, 357 PERF_RECORD_THROTTLE = 5,
358 PERF_RECORD_UNTHROTTLE = 6, 358 PERF_RECORD_UNTHROTTLE = 6,
359 359
360 /* 360 /*
361 * struct { 361 * struct {
@@ -369,10 +369,10 @@ enum perf_event_type {
369 369
370 /* 370 /*
371 * struct { 371 * struct {
372 * struct perf_event_header header; 372 * struct perf_event_header header;
373 * u32 pid, tid; 373 * u32 pid, tid;
374 * 374 *
375 * struct read_format values; 375 * struct read_format values;
376 * }; 376 * };
377 */ 377 */
378 PERF_RECORD_READ = 8, 378 PERF_RECORD_READ = 8,
@@ -410,7 +410,7 @@ enum perf_event_type {
410 * char data[size];}&& PERF_SAMPLE_RAW 410 * char data[size];}&& PERF_SAMPLE_RAW
411 * }; 411 * };
412 */ 412 */
413 PERF_RECORD_SAMPLE = 9, 413 PERF_RECORD_SAMPLE = 9,
414 414
415 PERF_RECORD_MAX, /* non-ABI */ 415 PERF_RECORD_MAX, /* non-ABI */
416}; 416};
@@ -476,18 +476,19 @@ struct hw_perf_event {
476 union { 476 union {
477 struct { /* hardware */ 477 struct { /* hardware */
478 u64 config; 478 u64 config;
479 u64 last_tag;
479 unsigned long config_base; 480 unsigned long config_base;
480 unsigned long event_base; 481 unsigned long event_base;
481 int idx; 482 int idx;
483 int last_cpu;
482 }; 484 };
483 struct { /* software */ 485 struct { /* software */
484 s64 remaining; 486 s64 remaining;
485 struct hrtimer hrtimer; 487 struct hrtimer hrtimer;
486 }; 488 };
487#ifdef CONFIG_HAVE_HW_BREAKPOINT 489#ifdef CONFIG_HAVE_HW_BREAKPOINT
488 union { /* breakpoint */ 490 /* breakpoint */
489 struct arch_hw_breakpoint info; 491 struct arch_hw_breakpoint info;
490 };
491#endif 492#endif
492 }; 493 };
493 atomic64_t prev_count; 494 atomic64_t prev_count;
@@ -496,9 +497,8 @@ struct hw_perf_event {
496 atomic64_t period_left; 497 atomic64_t period_left;
497 u64 interrupts; 498 u64 interrupts;
498 499
499 u64 freq_count; 500 u64 freq_time_stamp;
500 u64 freq_interrupts; 501 u64 freq_count_stamp;
501 u64 freq_stamp;
502#endif 502#endif
503}; 503};
504 504
@@ -510,6 +510,8 @@ struct perf_event;
510struct pmu { 510struct pmu {
511 int (*enable) (struct perf_event *event); 511 int (*enable) (struct perf_event *event);
512 void (*disable) (struct perf_event *event); 512 void (*disable) (struct perf_event *event);
513 int (*start) (struct perf_event *event);
514 void (*stop) (struct perf_event *event);
513 void (*read) (struct perf_event *event); 515 void (*read) (struct perf_event *event);
514 void (*unthrottle) (struct perf_event *event); 516 void (*unthrottle) (struct perf_event *event);
515}; 517};
@@ -563,6 +565,10 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
563 struct perf_sample_data *, 565 struct perf_sample_data *,
564 struct pt_regs *regs); 566 struct pt_regs *regs);
565 567
568enum perf_group_flag {
569 PERF_GROUP_SOFTWARE = 0x1,
570};
571
566/** 572/**
567 * struct perf_event - performance event kernel representation: 573 * struct perf_event - performance event kernel representation:
568 */ 574 */
@@ -572,6 +578,7 @@ struct perf_event {
572 struct list_head event_entry; 578 struct list_head event_entry;
573 struct list_head sibling_list; 579 struct list_head sibling_list;
574 int nr_siblings; 580 int nr_siblings;
581 int group_flags;
575 struct perf_event *group_leader; 582 struct perf_event *group_leader;
576 struct perf_event *output; 583 struct perf_event *output;
577 const struct pmu *pmu; 584 const struct pmu *pmu;
@@ -656,7 +663,7 @@ struct perf_event {
656 663
657 perf_overflow_handler_t overflow_handler; 664 perf_overflow_handler_t overflow_handler;
658 665
659#ifdef CONFIG_EVENT_PROFILE 666#ifdef CONFIG_EVENT_TRACING
660 struct event_filter *filter; 667 struct event_filter *filter;
661#endif 668#endif
662 669
@@ -681,7 +688,8 @@ struct perf_event_context {
681 */ 688 */
682 struct mutex mutex; 689 struct mutex mutex;
683 690
684 struct list_head group_list; 691 struct list_head pinned_groups;
692 struct list_head flexible_groups;
685 struct list_head event_list; 693 struct list_head event_list;
686 int nr_events; 694 int nr_events;
687 int nr_active; 695 int nr_active;
@@ -744,10 +752,9 @@ extern int perf_max_events;
744 752
745extern const struct pmu *hw_perf_event_init(struct perf_event *event); 753extern const struct pmu *hw_perf_event_init(struct perf_event *event);
746 754
747extern void perf_event_task_sched_in(struct task_struct *task, int cpu); 755extern void perf_event_task_sched_in(struct task_struct *task);
748extern void perf_event_task_sched_out(struct task_struct *task, 756extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
749 struct task_struct *next, int cpu); 757extern void perf_event_task_tick(struct task_struct *task);
750extern void perf_event_task_tick(struct task_struct *task, int cpu);
751extern int perf_event_init_task(struct task_struct *child); 758extern int perf_event_init_task(struct task_struct *child);
752extern void perf_event_exit_task(struct task_struct *child); 759extern void perf_event_exit_task(struct task_struct *child);
753extern void perf_event_free_task(struct task_struct *task); 760extern void perf_event_free_task(struct task_struct *task);
@@ -762,7 +769,7 @@ extern int perf_event_task_disable(void);
762extern int perf_event_task_enable(void); 769extern int perf_event_task_enable(void);
763extern int hw_perf_group_sched_in(struct perf_event *group_leader, 770extern int hw_perf_group_sched_in(struct perf_event *group_leader,
764 struct perf_cpu_context *cpuctx, 771 struct perf_cpu_context *cpuctx,
765 struct perf_event_context *ctx, int cpu); 772 struct perf_event_context *ctx);
766extern void perf_event_update_userpage(struct perf_event *event); 773extern void perf_event_update_userpage(struct perf_event *event);
767extern int perf_event_release_kernel(struct perf_event *event); 774extern int perf_event_release_kernel(struct perf_event *event);
768extern struct perf_event * 775extern struct perf_event *
@@ -850,9 +857,23 @@ extern int sysctl_perf_event_paranoid;
850extern int sysctl_perf_event_mlock; 857extern int sysctl_perf_event_mlock;
851extern int sysctl_perf_event_sample_rate; 858extern int sysctl_perf_event_sample_rate;
852 859
860static inline bool perf_paranoid_tracepoint_raw(void)
861{
862 return sysctl_perf_event_paranoid > -1;
863}
864
865static inline bool perf_paranoid_cpu(void)
866{
867 return sysctl_perf_event_paranoid > 0;
868}
869
870static inline bool perf_paranoid_kernel(void)
871{
872 return sysctl_perf_event_paranoid > 1;
873}
874
853extern void perf_event_init(void); 875extern void perf_event_init(void);
854extern void perf_tp_event(int event_id, u64 addr, u64 count, 876extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size);
855 void *record, int entry_size);
856extern void perf_bp_event(struct perf_event *event, void *data); 877extern void perf_bp_event(struct perf_event *event, void *data);
857 878
858#ifndef perf_misc_flags 879#ifndef perf_misc_flags
@@ -873,12 +894,12 @@ extern void perf_event_enable(struct perf_event *event);
873extern void perf_event_disable(struct perf_event *event); 894extern void perf_event_disable(struct perf_event *event);
874#else 895#else
875static inline void 896static inline void
876perf_event_task_sched_in(struct task_struct *task, int cpu) { } 897perf_event_task_sched_in(struct task_struct *task) { }
877static inline void 898static inline void
878perf_event_task_sched_out(struct task_struct *task, 899perf_event_task_sched_out(struct task_struct *task,
879 struct task_struct *next, int cpu) { } 900 struct task_struct *next) { }
880static inline void 901static inline void
881perf_event_task_tick(struct task_struct *task, int cpu) { } 902perf_event_task_tick(struct task_struct *task) { }
882static inline int perf_event_init_task(struct task_struct *child) { return 0; } 903static inline int perf_event_init_task(struct task_struct *child) { return 0; }
883static inline void perf_event_exit_task(struct task_struct *child) { } 904static inline void perf_event_exit_task(struct task_struct *child) { }
884static inline void perf_event_free_task(struct task_struct *task) { } 905static inline void perf_event_free_task(struct task_struct *task) { }
@@ -893,13 +914,13 @@ static inline void
893perf_sw_event(u32 event_id, u64 nr, int nmi, 914perf_sw_event(u32 event_id, u64 nr, int nmi,
894 struct pt_regs *regs, u64 addr) { } 915 struct pt_regs *regs, u64 addr) { }
895static inline void 916static inline void
896perf_bp_event(struct perf_event *event, void *data) { } 917perf_bp_event(struct perf_event *event, void *data) { }
897 918
898static inline void perf_event_mmap(struct vm_area_struct *vma) { } 919static inline void perf_event_mmap(struct vm_area_struct *vma) { }
899static inline void perf_event_comm(struct task_struct *tsk) { } 920static inline void perf_event_comm(struct task_struct *tsk) { }
900static inline void perf_event_fork(struct task_struct *tsk) { } 921static inline void perf_event_fork(struct task_struct *tsk) { }
901static inline void perf_event_init(void) { } 922static inline void perf_event_init(void) { }
902static inline int perf_swevent_get_recursion_context(void) { return -1; } 923static inline int perf_swevent_get_recursion_context(void) { return -1; }
903static inline void perf_swevent_put_recursion_context(int rctx) { } 924static inline void perf_swevent_put_recursion_context(int rctx) { }
904static inline void perf_event_enable(struct perf_event *event) { } 925static inline void perf_event_enable(struct perf_event *event) { }
905static inline void perf_event_disable(struct perf_event *event) { } 926static inline void perf_event_disable(struct perf_event *event) { }