Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
core.c File Reference
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/cpu.h>
#include <linux/smp.h>
#include <linux/idr.h>
#include <linux/file.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/hash.h>
#include <linux/sysfs.h>
#include <linux/dcache.h>
#include <linux/percpu.h>
#include <linux/ptrace.h>
#include <linux/reboot.h>
#include <linux/vmstat.h>
#include <linux/device.h>
#include <linux/export.h>
#include <linux/vmalloc.h>
#include <linux/hardirq.h>
#include <linux/rculist.h>
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/anon_inodes.h>
#include <linux/kernel_stat.h>
#include <linux/perf_event.h>
#include <linux/ftrace_event.h>
#include <linux/hw_breakpoint.h>
#include <linux/mm_types.h>
#include "internal.h"
#include <asm/irq_regs.h>

Go to the source code of this file.

Data Structures

struct  remote_function_call
 
struct  perf_read_event
 
struct  perf_task_event
 
struct  perf_comm_event
 
struct  perf_mmap_event
 
struct  swevent_htable
 

Macros

#define PERF_FLAG_ALL
 
#define PERF_SAMPLE_BRANCH_PERM_PLM
 
#define DEFAULT_MAX_SAMPLE_RATE   100000
 
#define MAX_INTERRUPTS   (~0ULL)
 
#define list_next_entry(pos, member)   list_entry(pos->member.next, typeof(*pos), member)
 
#define for_each_task_context_nr(ctxn)   for ((ctxn) = 0; (ctxn) < perf_nr_task_contexts; (ctxn)++)
 
#define REDUCE_FLS(a, b)
 
#define PERF_FORMAT_TOTAL_TIMES
 

Enumerations

enum  event_type_t { EVENT_FLEXIBLE = 0x1, EVENT_PINNED = 0x2, EVENT_ALL = EVENT_FLEXIBLE | EVENT_PINNED }
 

Functions

int perf_proc_update_handler (struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
 
void __weak perf_event_print_debug (void)
 
__weak const charperf_pmu_name (void)
 
void perf_cgroup_switch (struct task_struct *task, struct task_struct *next)
 
void perf_pmu_disable (struct pmu *pmu)
 
void perf_pmu_enable (struct pmu *pmu)
 
int __perf_event_disable (void *info)
 
void perf_event_disable (struct perf_event *event)
 
 EXPORT_SYMBOL_GPL (perf_event_disable)
 
void perf_event_enable (struct perf_event *event)
 
 EXPORT_SYMBOL_GPL (perf_event_enable)
 
int perf_event_refresh (struct perf_event *event, int refresh)
 
 EXPORT_SYMBOL_GPL (perf_event_refresh)
 
void __perf_event_task_sched_out (struct task_struct *task, struct task_struct *next)
 
void __perf_event_task_sched_in (struct task_struct *prev, struct task_struct *task)
 
void perf_event_task_tick (void)
 
int perf_event_release_kernel (struct perf_event *event)
 
 EXPORT_SYMBOL_GPL (perf_event_release_kernel)
 
u64 perf_event_read_value (struct perf_event *event, u64 *enabled, u64 *running)
 
 EXPORT_SYMBOL_GPL (perf_event_read_value)
 
int perf_event_task_enable (void)
 
int perf_event_task_disable (void)
 
void __weak arch_perf_update_userpage (struct perf_event_mmap_page *userpg, u64 now)
 
void perf_event_update_userpage (struct perf_event *event)
 
void perf_event_wakeup (struct perf_event *event)
 
int perf_register_guest_info_callbacks (struct perf_guest_info_callbacks *cbs)
 
 EXPORT_SYMBOL_GPL (perf_register_guest_info_callbacks)
 
int perf_unregister_guest_info_callbacks (struct perf_guest_info_callbacks *cbs)
 
 EXPORT_SYMBOL_GPL (perf_unregister_guest_info_callbacks)
 
void perf_event_header__init_id (struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event)
 
void perf_event__output_id_sample (struct perf_event *event, struct perf_output_handle *handle, struct perf_sample_data *sample)
 
void perf_output_sample (struct perf_output_handle *handle, struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event)
 
void perf_prepare_sample (struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event, struct pt_regs *regs)
 
void perf_event_fork (struct task_struct *task)
 
void perf_event_comm (struct task_struct *task)
 
void perf_event_mmap (struct vm_area_struct *vma)
 
int perf_event_overflow (struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs)
 
int perf_swevent_get_recursion_context (void)
 
 EXPORT_SYMBOL_GPL (perf_swevent_get_recursion_context)
 
void perf_swevent_put_recursion_context (int rctx)
 
void __perf_sw_event (u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
 
int perf_pmu_register (struct pmu *pmu, char *name, int type)
 
void perf_pmu_unregister (struct pmu *pmu)
 
struct pmuperf_init_event (struct perf_event *event)
 
 SYSCALL_DEFINE5 (perf_event_open, struct perf_event_attr __user *, attr_uptr, pid_t, pid, int, cpu, int, group_fd, unsigned long, flags)
 
struct perf_eventperf_event_create_kernel_counter (struct perf_event_attr *attr, int cpu, struct task_struct *task, perf_overflow_handler_t overflow_handler, void *context)
 
 EXPORT_SYMBOL_GPL (perf_event_create_kernel_counter)
 
void perf_pmu_migrate_context (struct pmu *pmu, int src_cpu, int dst_cpu)
 
 EXPORT_SYMBOL_GPL (perf_pmu_migrate_context)
 
void perf_event_exit_task (struct task_struct *child)
 
void perf_event_free_task (struct task_struct *task)
 
void perf_event_delayed_put (struct task_struct *task)
 
int perf_event_init_context (struct task_struct *child, int ctxn)
 
int perf_event_init_task (struct task_struct *child)
 
void __init perf_event_init (void)
 
 device_initcall (perf_event_sysfs_init)
 

Variables

struct static_key_deferred
perf_sched_events 
__read_mostly = 1
 
struct perf_guest_info_callbacksperf_guest_cbs
 
struct static_key perf_swevent_enabled [PERF_COUNT_SW_MAX]
 

Macro Definition Documentation

#define DEFAULT_MAX_SAMPLE_RATE   100000

Definition at line 166 of file core.c.

#define for_each_task_context_nr (   ctxn)    for ((ctxn) = 0; (ctxn) < perf_nr_task_contexts; (ctxn)++)

Definition at line 2037 of file core.c.

#define list_next_entry (   pos,
  member 
)    list_entry(pos->member.next, typeof(*pos), member)

Definition at line 1950 of file core.c.

#define MAX_INTERRUPTS   (~0ULL)

Definition at line 1388 of file core.c.

#define PERF_FLAG_ALL
Value:
PERF_FLAG_FD_OUTPUT |\
PERF_FLAG_PID_CGROUP)

Definition at line 118 of file core.c.

#define PERF_FORMAT_TOTAL_TIMES
Value:
PERF_FORMAT_TOTAL_TIME_RUNNING)

Definition at line 4023 of file core.c.

#define PERF_SAMPLE_BRANCH_PERM_PLM
Value:
PERF_SAMPLE_BRANCH_HV)

Definition at line 125 of file core.c.

#define REDUCE_FLS (   a,
  b 
)
Value:
do { \
if (a##_fls > b##_fls) { \
a >>= 1; \
a##_fls--; \
} else { \
b >>= 1; \
b##_fls--; \
} \
} while (0)

Enumeration Type Documentation

Enumerator:
EVENT_FLEXIBLE 
EVENT_PINNED 
EVENT_ALL 

Definition at line 129 of file core.c.

Function Documentation

int __perf_event_disable ( void info)

Definition at line 1259 of file core.c.

void __perf_event_task_sched_in ( struct task_struct prev,
struct task_struct task 
)

Definition at line 2291 of file core.c.

void __perf_event_task_sched_out ( struct task_struct task,
struct task_struct next 
)

Definition at line 2051 of file core.c.

void __perf_sw_event ( u32  event_id,
u64  nr,
struct pt_regs regs,
u64  addr 
)

Definition at line 5151 of file core.c.

void __weak arch_perf_update_userpage ( struct perf_event_mmap_page userpg,
u64  now 
)

Definition at line 3361 of file core.c.

device_initcall ( perf_event_sysfs_init  )
EXPORT_SYMBOL_GPL ( perf_event_disable  )
EXPORT_SYMBOL_GPL ( perf_event_enable  )
EXPORT_SYMBOL_GPL ( perf_event_refresh  )
EXPORT_SYMBOL_GPL ( perf_event_release_kernel  )
EXPORT_SYMBOL_GPL ( perf_event_read_value  )
EXPORT_SYMBOL_GPL ( perf_register_guest_info_callbacks  )
EXPORT_SYMBOL_GPL ( perf_unregister_guest_info_callbacks  )
EXPORT_SYMBOL_GPL ( perf_swevent_get_recursion_context  )
EXPORT_SYMBOL_GPL ( perf_event_create_kernel_counter  )
EXPORT_SYMBOL_GPL ( perf_pmu_migrate_context  )
void perf_cgroup_switch ( struct task_struct task,
struct task_struct next 
)

Definition at line 604 of file core.c.

void perf_event__output_id_sample ( struct perf_event event,
struct perf_output_handle handle,
struct perf_sample_data *  sample 
)

Definition at line 3949 of file core.c.

void perf_event_comm ( struct task_struct task)

Definition at line 4581 of file core.c.

struct perf_event* perf_event_create_kernel_counter ( struct perf_event_attr attr,
int  cpu,
struct task_struct task,
perf_overflow_handler_t  overflow_handler,
void context 
)
read

perf_event_create_kernel_counter

: attributes of the counter to create : cpu in which the counter is bound : task to profile (NULL for percpu)

Definition at line 6688 of file core.c.

void perf_event_delayed_put ( struct task_struct task)

Definition at line 6982 of file core.c.

void perf_event_disable ( struct perf_event event)

Definition at line 1310 of file core.c.

void perf_event_enable ( struct perf_event event)

Definition at line 1783 of file core.c.

void perf_event_exit_task ( struct task_struct child)

Definition at line 6904 of file core.c.

void perf_event_fork ( struct task_struct task)

Definition at line 4468 of file core.c.

void perf_event_free_task ( struct task_struct task)

Definition at line 6951 of file core.c.

void perf_event_header__init_id ( struct perf_event_header header,
struct perf_sample_data *  data,
struct perf_event event 
)

Definition at line 3920 of file core.c.

void __init perf_event_init ( void  )

Definition at line 7379 of file core.c.

int perf_event_init_context ( struct task_struct child,
int  ctxn 
)

Definition at line 7142 of file core.c.

int perf_event_init_task ( struct task_struct child)

Definition at line 7237 of file core.c.

void perf_event_mmap ( struct vm_area_struct vma)

Definition at line 4782 of file core.c.

int perf_event_overflow ( struct perf_event event,
struct perf_sample_data *  data,
struct pt_regs regs 
)

Definition at line 4922 of file core.c.

void __weak perf_event_print_debug ( void  )

Definition at line 200 of file core.c.

u64 perf_event_read_value ( struct perf_event event,
u64 enabled,
u64 running 
)

Definition at line 2990 of file core.c.

int perf_event_refresh ( struct perf_event event,
int  refresh 
)

Definition at line 1841 of file core.c.

int perf_event_release_kernel ( struct perf_event event)

Definition at line 2908 of file core.c.

int perf_event_task_disable ( void  )

Definition at line 3325 of file core.c.

int perf_event_task_enable ( void  )

Definition at line 3313 of file core.c.

void perf_event_task_tick ( void  )

Definition at line 2549 of file core.c.

void perf_event_update_userpage ( struct perf_event event)

Definition at line 3370 of file core.c.

void perf_event_wakeup ( struct perf_event event)

Definition at line 3717 of file core.c.

struct pmu* perf_init_event ( struct perf_event event)
read

Definition at line 6067 of file core.c.

void perf_output_sample ( struct perf_output_handle handle,
struct perf_event_header header,
struct perf_sample_data *  data,
struct perf_event event 
)

Definition at line 4050 of file core.c.

void perf_pmu_disable ( struct pmu pmu)

Definition at line 630 of file core.c.

void perf_pmu_enable ( struct pmu pmu)

Definition at line 637 of file core.c.

void perf_pmu_migrate_context ( struct pmu pmu,
int  src_cpu,
int  dst_cpu 
)

Definition at line 6730 of file core.c.

__weak const char* perf_pmu_name ( void  )

Definition at line 202 of file core.c.

int perf_pmu_register ( struct pmu pmu,
char name,
int  type 
)

Definition at line 5943 of file core.c.

void perf_pmu_unregister ( struct pmu pmu)

Definition at line 6046 of file core.c.

void perf_prepare_sample ( struct perf_event_header header,
struct perf_sample_data *  data,
struct perf_event event,
struct pt_regs regs 
)

Definition at line 4174 of file core.c.

int perf_proc_update_handler ( struct ctl_table table,
int  write,
void __user buffer,
size_t lenp,
loff_t *  ppos 
)

Definition at line 171 of file core.c.

int perf_register_guest_info_callbacks ( struct perf_guest_info_callbacks cbs)

Definition at line 3750 of file core.c.

int perf_swevent_get_recursion_context ( void  )

Definition at line 5136 of file core.c.

void perf_swevent_put_recursion_context ( int  rctx)
inline

Definition at line 5144 of file core.c.

int perf_unregister_guest_info_callbacks ( struct perf_guest_info_callbacks cbs)

Definition at line 3757 of file core.c.

SYSCALL_DEFINE5 ( perf_event_open  ,
struct perf_event_attr __user ,
attr_uptr  ,
pid_t  ,
pid  ,
int  ,
cpu  ,
int  ,
group_fd  ,
unsigned  long,
flags   
)

sys_perf_event_open - open a performance event, associate it to a task/cpu

: event_id type attributes for monitoring/sampling : target pid : target cpu : group leader event fd

Definition at line 6433 of file core.c.

Variable Documentation

int max_samples_per_tick __read_mostly = 1

Definition at line 139 of file core.c.

Definition at line 3748 of file core.c.

struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX]

Definition at line 5308 of file core.c.