LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13,
LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER = 14,
LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15,
+ LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16,
+ LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17,
+ LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18,
+ LTTNG_EVENT_CONTEXT_MIGRATABLE = 19,
};
enum lttng_event_field_type {
LTTNG_ERR_SESSION_NOT_STARTED = 118, /* Session not started */
LTTNG_ERR_LIVE_SESSION = 119, /* Live session unsupported */
LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */
+ LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */
/* MUST be last element */
LTTNG_ERR_NR, /* Last element */
/* Go over all channels */
cds_list_for_each_entry(kchan, &ksession->channel_list.head, list) {
ret = kernel_add_channel_context(kchan, kctx);
- if (ret < 0) {
- ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
+ if (ret != 0) {
goto error;
}
}
DBG("Add kernel context to channel '%s'", kchan->channel->name);
ret = kernel_add_channel_context(kchan, kctx);
- if (ret < 0) {
- ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
+ if (ret != 0) {
goto error;
}
case LTTNG_EVENT_CONTEXT_PERF_COUNTER:
kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER;
break;
+ case LTTNG_EVENT_CONTEXT_INTERRUPTIBLE:
+ kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE;
+ break;
+ case LTTNG_EVENT_CONTEXT_PREEMPTIBLE:
+ kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_PREEMPTIBLE;
+ break;
+ case LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE:
+ kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE;
+ break;
+ case LTTNG_EVENT_CONTEXT_MIGRATABLE:
+ kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_MIGRATABLE;
+ break;
default:
ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
goto error;
DBG("Adding context to channel %s", chan->channel->name);
ret = kernctl_add_context(chan->fd, &ctx->ctx);
if (ret < 0) {
- if (errno != EEXIST) {
- PERROR("add context ioctl");
- } else {
+ switch (errno) {
+ case ENOSYS:
+ /* Exists but not available for this kernel */
+ ret = LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE;
+ goto error;
+ case EEXIST:
/* If EEXIST, we just ignore the error */
ret = 0;
+ goto end;
+ default:
+ PERROR("add context ioctl");
+ ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
+ goto error;
}
- goto error;
}
+end:
cds_list_add_tail(&ctx->list, &chan->ctx_list);
-
return 0;
error:
case LTTNG_KERNEL_CONTEXT_HOSTNAME:
context_type_string = config_event_context_hostname;
break;
+ case LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE:
+ context_type_string = config_event_context_interruptible;
+ break;
+ case LTTNG_KERNEL_CONTEXT_PREEMPTIBLE:
+ context_type_string = config_event_context_preemptible;
+ break;
+ case LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE:
+ context_type_string = config_event_context_need_reschedule;
+ break;
+ case LTTNG_KERNEL_CONTEXT_MIGRATABLE:
+ context_type_string = config_event_context_migratable;
+ break;
default:
context_type_string = NULL;
}
CONTEXT_PERF_CPU_COUNTER = 13,
CONTEXT_PERF_THREAD_COUNTER = 14,
CONTEXT_APP_CONTEXT = 15,
+ CONTEXT_INTERRUPTIBLE = 16,
+ CONTEXT_PREEMPTIBLE = 17,
+ CONTEXT_NEED_RESCHEDULE = 18,
+ CONTEXT_MIGRATABLE = 19,
};
/*
{ "vppid", CONTEXT_VPPID },
{ "hostname", CONTEXT_HOSTNAME },
{ "ip", CONTEXT_IP },
+ { "interruptible", CONTEXT_INTERRUPTIBLE },
+ { "preemptible", CONTEXT_PREEMPTIBLE },
+ { "need_reschedule", CONTEXT_NEED_RESCHEDULE },
+ { "migratable", CONTEXT_MIGRATABLE },
/* Perf options */
extern const char * const config_event_context_ip;
extern const char * const config_event_context_perf_thread_counter;
extern const char * const config_event_context_app;
+extern const char * const config_event_context_interruptible;
+extern const char * const config_event_context_preemptible;
+extern const char * const config_event_context_need_reschedule;
+extern const char * const config_event_context_migratable;
#endif /* CONFIG_SESSION_INTERNAL_H */
const char * const config_event_context_ip = "IP";
const char * const config_event_context_perf_thread_counter = "PERF_THREAD_COUNTER";
const char * const config_event_context_app = "APP";
-
+const char * const config_event_context_interruptible = "INTERRUPTIBLE";
+const char * const config_event_context_preemptible = "PREEMPTIBLE";
+const char * const config_event_context_need_reschedule = "NEED_RESCHEDULE";
+const char * const config_event_context_migratable = "MIGRATABLE";
struct consumer_output {
int enabled;
} else if (!strcmp((char *) context_type,
config_event_context_ip)) {
ret = LTTNG_EVENT_CONTEXT_IP;
+ } else if (!strcmp((char *) context_type,
+ config_event_context_interruptible)) {
+ ret = LTTNG_EVENT_CONTEXT_INTERRUPTIBLE;
+ } else if (!strcmp((char *) context_type,
+ config_event_context_preemptible)) {
+ ret = LTTNG_EVENT_CONTEXT_PREEMPTIBLE;
+ } else if (!strcmp((char *) context_type,
+ config_event_context_need_reschedule)) {
+ ret = LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE;
+ } else if (!strcmp((char *) context_type,
+ config_event_context_migratable)) {
+ ret = LTTNG_EVENT_CONTEXT_MIGRATABLE;
} else {
goto error;
}
[ ERROR_INDEX(LTTNG_ERR_SESSION_NOT_STARTED) ] = "Session not started",
[ ERROR_INDEX(LTTNG_ERR_LIVE_SESSION) ] = "Live sessions are not supported",
[ ERROR_INDEX(LTTNG_ERR_PER_PID_SESSION) ] = "Per-PID tracing sessions are not supported",
+ [ ERROR_INDEX(LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE) ] = "Context unavailable on this kernel",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"
LTTNG_KERNEL_CONTEXT_VPPID = 9,
LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
LTTNG_KERNEL_CONTEXT_CPU_ID = 11,
+ LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE = 12,
+ LTTNG_KERNEL_CONTEXT_PREEMPTIBLE = 13,
+ LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE = 14,
+ LTTNG_KERNEL_CONTEXT_MIGRATABLE = 15,
};
/* Perf counter attributes */