vec_free (tr->node_stats);
for (int j = 0; j < PERF_MAX_EVENTS; j++)
if (tr->mmap_pages[j])
- munmap (tr->mmap_pages, page_size);
+ munmap (tr->mmap_pages[j], page_size);
}
vec_free (pm->thread_runtimes);
s = b->src;
ASSERT (b->n_events);
- if (b->type == PERFMON_BUNDLE_TYPE_NODE)
+ if (b->active_type == PERFMON_BUNDLE_TYPE_NODE)
is_node = 1;
if (s->instances_by_type == 0)
{
perfmon_thread_runtime_t *rt;
rt = vec_elt_at_index (pm->thread_runtimes, i);
+ rt->bundle = b;
rt->n_events = b->n_events;
rt->n_nodes = n_nodes;
+ rt->preserve_samples = b->preserve_samples;
vec_validate_aligned (rt->node_stats, n_nodes - 1,
CLIB_CACHE_LINE_BYTES);
}
return clib_error_return_unix (0, "ioctl(PERF_EVENT_IOC_ENABLE)");
}
}
- if (pm->active_bundle->type == PERFMON_BUNDLE_TYPE_NODE)
+ if (b->active_type == PERFMON_BUNDLE_TYPE_NODE)
{
+ vlib_node_function_t *dispatch_wrapper = NULL;
+ err = b->src->config_dispatch_wrapper (b, &dispatch_wrapper);
+ if (err || !dispatch_wrapper)
+ {
+ perfmon_reset (vm);
+ return err;
+ }
+
for (int i = 0; i < vlib_get_n_threads (); i++)
vlib_node_set_dispatch_wrapper (vlib_get_main_by_index (i),
- perfmon_dispatch_wrapper);
+ dispatch_wrapper);
}
-
pm->sample_time = vlib_time_now (vm);
pm->is_running = 1;
if (pm->is_running != 1)
return clib_error_return (0, "not running");
- if (pm->active_bundle->type == PERFMON_BUNDLE_TYPE_NODE)
+ if (pm->active_bundle->active_type == PERFMON_BUNDLE_TYPE_NODE)
{
for (int i = 0; i < vlib_get_n_threads (); i++)
vlib_node_set_dispatch_wrapper (vlib_get_main_by_index (i), 0);
}
hash_set_mem (pm->source_by_name, s->name, s);
- log_debug ("source '%s' regisrtered", s->name);
+ log_debug ("source '%s' registered", s->name);
s = s->next;
}
{
clib_error_t *err;
uword *p;
- if (hash_get_mem (pm->bundle_by_name, b->name) != 0)
- clib_panic ("duplicate bundle name '%s'", b->name);
if ((p = hash_get_mem (pm->source_by_name, b->source)) == 0)
{
}
b->src = (perfmon_source_t *) p[0];
+ if (b->src->bundle_support && !b->src->bundle_support (b))
+ {
+ log_debug ("skipping bundle '%s' - not supported", b->name);
+ b = b->next;
+ continue;
+ }
+
if (b->init_fn && ((err = (b->init_fn) (vm, b))))
{
log_warn ("skipping bundle '%s' - %U", b->name, format_clib_error,
continue;
}
+ if (hash_get_mem (pm->bundle_by_name, b->name) != 0)
+ clib_panic ("duplicate bundle name '%s'", b->name);
+
hash_set_mem (pm->bundle_by_name, b->name, b);
- log_debug ("bundle '%s' regisrtered", b->name);
+ log_debug ("bundle '%s' registered", b->name);
b = b->next;
}