- context.ctx = type;
- if (type == LTTNG_KERNEL_CONTEXT_PERF_COUNTER) {
- context.u.perf_counter.type = opt_perf_type;
- context.u.perf_counter.config = opt_perf_id;
- strncpy(context.u.perf_counter.name, opt_perf_name,
- LTTNG_SYMBOL_NAME_LEN);
- }
+ /* Iterate over all context type given */
+ cds_list_for_each_entry(type, &ctx_type_list.head, list) {
+ context.ctx = type->type;
+ if (type->type == LTTNG_KERNEL_CONTEXT_PERF_COUNTER) {
+ /* Not defined */
+ if (opt_perf_type == -1) {
+ ERR("No perf event type given. Please use --perf-type TYPE.");
+ goto error;
+ }
+ context.u.perf_counter.type = opt_perf_type;
+ if (opt_perf_id == -1) {
+ ERR("No perf event id given. Please use --perf-id ID.");
+ goto error;
+ }
+ context.u.perf_counter.config = opt_perf_id;
+ if (opt_perf_name == NULL) {
+ ERR("No perf name given. Please use --perf-name NAME.");
+ goto error;
+ }
+ strncpy(context.u.perf_counter.name, opt_perf_name,
+ LTTNG_SYMBOL_NAME_LEN);
+ }