00001 /** 00002 * @file op_interface.h 00003 * 00004 * Module / user space interface for 2.4 00005 * 00006 * @remark Copyright 2002 OProfile authors 00007 * @remark Read the file COPYING 00008 * 00009 * @author John Levon 00010 * @author Philippe Elie 00011 */ 00012 00013 #ifndef OP_INTERFACE_H 00014 #define OP_INTERFACE_H 00015 00016 #include "op_config.h" 00017 #include "op_types.h" 00018 00019 /*@{\name notifications types encoded in op_note::type */ 00020 /** fork(),vfork(),clone() */ 00021 #define OP_FORK 1 00022 /** mapping */ 00023 #define OP_MAP 2 00024 /** execve() */ 00025 #define OP_EXEC 4 00026 /** init_module() */ 00027 #define OP_DROP_MODULES 8 00028 /** exit() */ 00029 #define OP_EXIT 16 00030 /*@}*/ 00031 00032 /** Data type to transfer samples counts from the module to the daemon */ 00033 struct op_sample { 00034 unsigned long eip; /**< eip value where occur interrupt */ 00035 u32 counter; /**< counter nr */ 00036 u32 pid; /**< 32 bits can hold any pid */ 00037 u32 tgid; /**< always equal to pid for kernel < 2.4.0 */ 00038 }; 00039 00040 /** the current kernel-side profiler state */ 00041 enum oprof_state { 00042 STOPPED = 0, 00043 STOPPING = 1, 00044 RUNNING = 2 00045 }; 00046 00047 /** 00048 * The head structure of a kernel sample buffer. 00049 */ 00050 struct op_buffer_head { 00051 int cpu_nr; /**< the CPU number of this buffer */ 00052 size_t count; /**< number of samples in this buffer */ 00053 enum oprof_state state; /**< current profiler state */ 00054 struct op_sample buffer[0]; /**< the sample buffer */ 00055 } __attribute__((__packed__)); 00056 00057 /** 00058 * Data type used by the module to notify daemon of fork/exit/mapping etc. 00059 * Meanings of fields depend on the type of notification encoded in the type 00060 * field. 00061 * \sa OP_FORK, OP_EXEC, OP_MAP, OP_DROP_MODULES and OP_EXIT 00062 */ 00063 struct op_note { 00064 unsigned long addr; 00065 unsigned long len; 00066 unsigned long offset; 00067 unsigned int hash; 00068 unsigned int pid; 00069 unsigned int tgid; 00070 unsigned short type; 00071 }; 00072 00073 /** 00074 * A path component. Directory name are stored as a stack of path components. 00075 * Note than the name index acts also as an unique identifier 00076 */ 00077 struct op_hash_index { 00078 /** index inside the string pool */ 00079 u32 name; 00080 /** parent component, zero if this component is the root */ 00081 u32 parent; 00082 } __attribute__((__packed__)); 00083 00084 /** size of hash map in bytes */ 00085 #define OP_HASH_MAP_SIZE (OP_HASH_MAP_NR * sizeof(struct op_hash_index) + POOL_SIZE) 00086 00087 #endif /* OP_INTERFACE_H */
1.6.1