op_events.h

Go to the documentation of this file.
00001 
00012 #ifndef OP_EVENTS_H
00013 #define OP_EVENTS_H
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 #include "op_cpu_type.h"
00020 #include "op_types.h"
00021 #include "op_list.h"
00022 
00023 #define EXTRA_EDGE (1U << 18)
00024 #define EXTRA_ANY  (1U << 21)
00025 #define EXTRA_INV  (1U << 23)
00026 #define EXTRA_CMASK_SHIFT 24
00027 #define EXTRA_CMASK_MASK 0xff
00028 
00029 /*
00030  * For timer based sampling some targets (e.g. s390) use a virtual
00031  * counter whose file system resides in /dev/oprofile/timer.  These
00032  * macros set the values used to define a specific timer event solely
00033  * used by the timer counter.
00034  */
00035 #define TIMER_EVENT_NAME           "TIMER"
00036 #define TIMER_EVENT_UNIT_MASK_NAME "timer_unit_mask"
00037 #define TIMER_EVENT_DESC           "Timer based sampling"
00038 #define TIMER_EVENT_VALUE          (u32)-1
00039 
00042 enum unit_mask_type {
00043     utm_mandatory,      
00044     utm_exclusive,      
00045     utm_bitmask     
00046 };
00047 
00049 #define MAX_UNIT_MASK 32
00050 
00051 
00053 struct op_unit_mask {
00054     char * name;        
00055     u32 num;        
00056     enum unit_mask_type unit_type_mask;
00057     u32 default_mask;   
00058     struct op_described_um {
00059             u32 extra;
00060         u32 value;
00061         char * desc;
00062     } um[MAX_UNIT_MASK];
00063     struct list_head um_next; 
00064     int used;                 
00065 };
00066 
00067 
00069 struct op_event {
00070     u32 counter_mask;   
00071     u32 val;        
00073     struct op_unit_mask * unit;         
00074     char * name;        
00075     char * desc;        
00076     int min_count;      
00077     int filter;     
00078     char * ext;     
00079     struct list_head event_next;   
00080 };
00081 
00083 struct list_head * op_events(op_cpu cpu_type);
00084 
00086 struct op_event * op_find_event(op_cpu cpu_type, u32 nr, u32 um);
00087 struct op_event * op_find_event_any(op_cpu cpu_type, u32 nr);
00088 
00090 struct op_event * find_event_by_name(char const * name, unsigned um,
00091                                      int um_valid);
00092 
00097 char const * find_mapping_for_event(u32 val, op_cpu cpu_type);
00098 
00099 
00101 enum op_event_check {
00102     OP_OK_EVENT = 0, 
00103     OP_INVALID_EVENT = 1, 
00104     OP_INVALID_UM = 2, 
00105     OP_INVALID_COUNTER = 4 
00106 };
00107 
00121 int op_check_events(int ctr, u32 event, u32 um, op_cpu cpu_type);
00122 
00126 void op_free_events(void);
00127 
00128 struct op_default_event_descr {
00129     char * name;
00130     unsigned long count;
00131     unsigned long um;
00132 };
00133 
00141 void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr);
00142 
00151 struct parsed_event;
00152 void op_resolve_unit_mask(struct parsed_event *pe, u32 *extra);
00153 
00154 #ifdef __cplusplus
00155 }
00156 #endif
00157 
00158 #endif /* OP_EVENTS_H */

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1