Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
oprofile.h File Reference
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/printk.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  oprofile_operations
 
struct  op_entry
 

Macros

#define ESCAPE_CODE   ~0UL
 
#define CTX_SWITCH_CODE   1
 
#define CPU_SWITCH_CODE   2
 
#define COOKIE_SWITCH_CODE   3
 
#define KERNEL_ENTER_SWITCH_CODE   4
 
#define KERNEL_EXIT_SWITCH_CODE   5
 
#define MODULE_LOADED_CODE   6
 
#define CTX_TGID_CODE   7
 
#define TRACE_BEGIN_CODE   8
 
#define TRACE_END_CODE   9
 
#define XEN_ENTER_SWITCH_CODE   10
 
#define SPU_PROFILING_CODE   11
 
#define SPU_CTX_SWITCH_CODE   12
 
#define IBS_FETCH_CODE   13
 
#define IBS_OP_CODE   14
 

Functions

int oprofile_arch_init (struct oprofile_operations *ops)
 
void oprofile_arch_exit (void)
 
void oprofile_add_sample (struct pt_regs *const regs, unsigned long event)
 
void oprofile_add_ext_sample (unsigned long pc, struct pt_regs *const regs, unsigned long event, int is_kernel)
 
void oprofile_add_ext_hw_sample (unsigned long pc, struct pt_regs *const regs, unsigned long event, int is_kernel, struct task_struct *task)
 
void oprofile_add_pc (unsigned long pc, int is_kernel, unsigned long event)
 
void oprofile_add_trace (unsigned long eip)
 
int oprofilefs_create_file (struct super_block *sb, struct dentry *root, char const *name, const struct file_operations *fops)
 
int oprofilefs_create_file_perm (struct super_block *sb, struct dentry *root, char const *name, const struct file_operations *fops, int perm)
 
int oprofilefs_create_ulong (struct super_block *sb, struct dentry *root, char const *name, ulong *val)
 
int oprofilefs_create_ro_ulong (struct super_block *sb, struct dentry *root, char const *name, ulong *val)
 
int oprofilefs_create_ro_atomic (struct super_block *sb, struct dentry *root, char const *name, atomic_t *val)
 
struct dentryoprofilefs_mkdir (struct super_block *sb, struct dentry *root, char const *name)
 
ssize_t oprofilefs_str_to_user (char const *str, char __user *buf, size_t count, loff_t *offset)
 
ssize_t oprofilefs_ulong_to_user (unsigned long val, char __user *buf, size_t count, loff_t *offset)
 
int oprofilefs_ulong_from_user (unsigned long *val, char const __user *buf, size_t count)
 
void oprofile_put_buff (unsigned long *buf, unsigned int start, unsigned int stop, unsigned int max)
 
unsigned long oprofile_get_cpu_buffer_size (void)
 
void oprofile_cpu_buffer_inc_smpl_lost (void)
 
void oprofile_write_reserve (struct op_entry *entry, struct pt_regs *const regs, unsigned long pc, int code, int size)
 
int oprofile_add_data (struct op_entry *entry, unsigned long val)
 
int oprofile_add_data64 (struct op_entry *entry, u64 val)
 
int oprofile_write_commit (struct op_entry *entry)
 

Variables

raw_spinlock_t oprofilefs_lock
 

Detailed Description

API for machine-specific interrupts to interface to oprofile.

Remarks
Copyright 2002 OProfile authors
Read the file COPYING
Author
John Levon levon.nosp@m.@mov.nosp@m.ement.nosp@m.aria.nosp@m.n.org

Definition in file oprofile.h.

Macro Definition Documentation

#define COOKIE_SWITCH_CODE   3

Definition at line 32 of file oprofile.h.

#define CPU_SWITCH_CODE   2

Definition at line 31 of file oprofile.h.

#define CTX_SWITCH_CODE   1

Definition at line 30 of file oprofile.h.

#define CTX_TGID_CODE   7

Definition at line 36 of file oprofile.h.

#define ESCAPE_CODE   ~0UL

Definition at line 29 of file oprofile.h.

#define IBS_FETCH_CODE   13

Definition at line 42 of file oprofile.h.

#define IBS_OP_CODE   14

Definition at line 43 of file oprofile.h.

#define KERNEL_ENTER_SWITCH_CODE   4

Definition at line 33 of file oprofile.h.

#define KERNEL_EXIT_SWITCH_CODE   5

Definition at line 34 of file oprofile.h.

#define MODULE_LOADED_CODE   6

Definition at line 35 of file oprofile.h.

#define SPU_CTX_SWITCH_CODE   12

Definition at line 41 of file oprofile.h.

#define SPU_PROFILING_CODE   11

Definition at line 40 of file oprofile.h.

#define TRACE_BEGIN_CODE   8

Definition at line 37 of file oprofile.h.

#define TRACE_END_CODE   9

Definition at line 38 of file oprofile.h.

#define XEN_ENTER_SWITCH_CODE   10

Definition at line 39 of file oprofile.h.

Function Documentation

int oprofile_add_data ( struct op_entry entry,
unsigned long  val 
)

Definition at line 384 of file cpu_buffer.c.

int oprofile_add_data64 ( struct op_entry entry,
u64  val 
)

Definition at line 391 of file cpu_buffer.c.

void oprofile_add_ext_hw_sample ( unsigned long  pc,
struct pt_regs *const  regs,
unsigned long  event,
int  is_kernel,
struct task_struct task 
)

Add an hardware sample.

Definition at line 319 of file cpu_buffer.c.

void oprofile_add_ext_sample ( unsigned long  pc,
struct pt_regs *const  regs,
unsigned long  event,
int  is_kernel 
)

Add an extended sample. Use this when the PC is not from the regs, and we cannot determine if we're in kernel mode from the regs.

This function does perform a backtrace.

Definition at line 326 of file cpu_buffer.c.

void oprofile_add_pc ( unsigned long  pc,
int  is_kernel,
unsigned long  event 
)

Definition at line 413 of file cpu_buffer.c.

void oprofile_add_sample ( struct pt_regs *const  regs,
unsigned long  event 
)

Add a sample. This may be called from any context.

Definition at line 332 of file cpu_buffer.c.

void oprofile_add_trace ( unsigned long  eip)

Definition at line 419 of file cpu_buffer.c.

void oprofile_arch_exit ( void  )

One-time exit/cleanup for the arch.

Definition at line 187 of file common.c.

int oprofile_arch_init ( struct oprofile_operations ops)

One-time initialisation. *ops must be set to a filled-in operations structure. This is called even in timer interrupt mode so an arch can set a backtrace callback.

If an error occurs, the fields should be left untouched.

Definition at line 142 of file common.c.

void oprofile_cpu_buffer_inc_smpl_lost ( void  )

Definition at line 46 of file cpu_buffer.c.

unsigned long oprofile_get_cpu_buffer_size ( void  )

Definition at line 41 of file cpu_buffer.c.

void oprofile_put_buff ( unsigned long buf,
unsigned int  start,
unsigned int  stop,
unsigned int  max 
)

Add the contents of a circular buffer to the event buffer.

Definition at line 570 of file buffer_sync.c.

int oprofile_write_commit ( struct op_entry entry)

Definition at line 406 of file cpu_buffer.c.

void oprofile_write_reserve ( struct op_entry entry,
struct pt_regs *const  regs,
unsigned long  pc,
int  code,
int  size 
)

Definition at line 355 of file cpu_buffer.c.

int oprofilefs_create_file ( struct super_block sb,
struct dentry root,
char const name,
const struct file_operations fops 
)

Create a file of the given name as a child of the given root, with the specified file operations.

Definition at line 195 of file oprofilefs.c.

int oprofilefs_create_file_perm ( struct super_block sb,
struct dentry root,
char const name,
const struct file_operations fops,
int  perm 
)

Definition at line 202 of file oprofilefs.c.

int oprofilefs_create_ro_atomic ( struct super_block sb,
struct dentry root,
char const name,
atomic_t val 
)

Create a file for read-only access to an atomic_t.

Definition at line 187 of file oprofilefs.c.

int oprofilefs_create_ro_ulong ( struct super_block sb,
struct dentry root,
char const name,
ulong val 
)

Create a file for read-only access to an unsigned long.

Definition at line 165 of file oprofilefs.c.

int oprofilefs_create_ulong ( struct super_block sb,
struct dentry root,
char const name,
ulong val 
)

Create a file for read/write access to an unsigned long.

Definition at line 157 of file oprofilefs.c.

struct dentry* oprofilefs_mkdir ( struct super_block sb,
struct dentry root,
char const name 
)
read

create a directory

Definition at line 209 of file oprofilefs.c.

ssize_t oprofilefs_str_to_user ( char const str,
char __user buf,
size_t  count,
loff_t *  offset 
)

Write the given asciz string to the given user buffer , updating *offset appropriately. Returns bytes written or -EFAULT.

Definition at line 45 of file oprofilefs.c.

int oprofilefs_ulong_from_user ( unsigned long val,
char const __user buf,
size_t  count 
)

Read an ASCII string for a number from a userspace buffer and fill *val on success. Returns 0 on success, < 0 on error.

Definition at line 70 of file oprofilefs.c.

ssize_t oprofilefs_ulong_to_user ( unsigned long  val,
char __user buf,
size_t  count,
loff_t *  offset 
)

Convert an unsigned long value into ASCII and copy it to the user buffer , updating *offset appropriately. Returns bytes written or -EFAULT.

Definition at line 53 of file oprofilefs.c.

Variable Documentation

raw_spinlock_t oprofilefs_lock

lock for read/write safety