69 #define KERNEL_BLOCKING_DEBUG 0 75 #define EVNAME_KERNEL_BLOCK "BLOCKTIME" 76 #define EVNAME_CONTEXT_SWITCHES "CS" 109 TMSG(LINUX_PERF,
"old t: %d, c: %d, p: %d, td: %d -- vs -- t: %d, c: %d, p: %d, td: %d",
163 if (mmap_data ==
NULL) {
198 if (args->
current->
attr.config == PERF_COUNT_SW_CONTEXT_SWITCHES) {
212 #if KERNEL_BLOCKING_DEBUG 213 unsigned int cpumode = mmap_data->
header_misc & PERF_RECORD_MISC_CPUMODE_MASK;
214 assert(cpumode == PERF_RECORD_MISC_USER);
243 if (event_info ==
NULL)
271 u64 sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID |
272 PERF_SAMPLE_TIME | PERF_SAMPLE_CALLCHAIN |
273 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD;
275 struct perf_event_attr *attr = &(event_info->
attr);
276 attr->config = PERF_COUNT_SW_CONTEXT_SWITCHES;
277 attr->type = PERF_TYPE_SOFTWARE;
285 event_info->
attr.context_switch = 1;
286 event_info->
attr.sample_id_all = 1;
291 attr->config, 1, metric_cs, event_info);;
305 event_kernel_blocking->
desc =
"Approximation of a thread's blocking time." 306 " This event requires another event (such as CYCLES) to profile with." 307 " The unit time is hardware-dependent but mostly in microseconds." 308 " This event is only available on Linux kernel 4.3 or newer.";
struct event_info_s * current
struct perf_event_attr attr
#define EVNAME_CONTEXT_SWITCHES
event_handler_t * handler_fn
struct event_custom_s * metric_custom
static void cct_metric_data_increment(int metric_id, cct_node_t *x, cct_metric_data_t incr)
metric_desc_t * hpcrun_set_metric_info_and_period(int metric_id, const char *name, MetricFlags_ValFmt_t valFmt, size_t period, metric_desc_properties_t prop)
static int metric_blocking_index
static void blame_kernel_time(cct_node_t *cct_kernel, perf_mmap_data_t *mmap_data)
static int register_blocking(sample_source_t *self, event_custom_t *event, struct event_threshold_s *period)
static void kernel_block_handler(event_handler_arg_t *args)
struct perf_mmap_data_s * data
void * hpcrun_malloc(size_t size)
static __thread cct_node_t * cct_kernel
int perf_util_attr_init(const char *event_name, struct perf_event_attr *attr, bool usePeriod, u64 threshold, u64 sampletype)
#define METHOD_CALL(obj, meth,...)
register_event_t * register_fn
int hpcrun_new_metric(void)
event_handle_type_t handle_type
static __thread u64 time_cs_out
#define EVNAME_KERNEL_BLOCK
void kernel_blocking_init()
thread_data_t *(* hpcrun_get_thread_data)(void)
#define metric_property_none
int event_custom_register(event_custom_t *event)