-struct lttng_ctx *lttng_create_perf_counter_ctx(void)
-{
- return kzalloc(sizeof(struct lttng_ctx), GFP_KERNEL);
-}
-
-void lttng_destroy_perf_counter_ctx(struct lttng_ctx *ctx)
-{
- int i;
-
- for (i = 0; i < ctx->nr_fields; i++) {
- struct perf_event **events = ctx->fields[i].u.perf_counter.e;
- int cpu;
-
- mutex_lock(&perf_counter_mutex);
- list_del(&ctx->fields[i].u.perf_counter.head);
- for_each_online_cpu(cpu)
- perf_event_release_kernel(events[cpu]);
- mutex_unlock(&perf_counter_mutex);
- kfree(ctx->fields[i].u.perf_counter.attr);
- kfree(events);
- }
- kfree(ctx->fields);
- kfree(ctx);
-}
-