LTTNG_EVENT_FUNCTION_ENTRY = 3,
LTTNG_EVENT_NOOP = 4,
LTTNG_EVENT_SYSCALL = 5,
- LTTNG_EVENT_TRACEPOINT_LOGLEVEL = 6,
+};
+
+/*
+ * Loglevel information.
+ */
+enum lttng_loglevel_type {
+ LTTNG_EVENT_LOGLEVEL = 0,
+ LTTNG_EVENT_LOGLEVEL_ONLY = 1,
};
/*
* Generic lttng event
*/
struct lttng_event {
+ enum lttng_event_type type;
char name[LTTNG_SYMBOL_NAME_LEN];
+
+ enum lttng_loglevel_type loglevel_type;
char loglevel[LTTNG_SYMBOL_NAME_LEN];
- int64_t loglevel_value;
- enum lttng_event_type type;
+ int64_t loglevel_value; /* for printing */
+
uint32_t enabled;
pid_t pid;
/* Per event type configuration */
case LTTNG_EVENT_TRACEPOINT:
lue->attr.instrumentation = LTTNG_UST_TRACEPOINT;
break;
- case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
- lue->attr.instrumentation = LTTNG_UST_TRACEPOINT_LOGLEVEL;
- break;
default:
ERR("Unknown ust instrumentation type (%d)", ev->type);
goto error_free_event;
strncpy(lue->attr.name, ev->name, LTTNG_UST_SYM_NAME_LEN);
lue->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ switch (ev->loglevel_type) {
+ case LTTNG_EVENT_LOGLEVEL:
+ lue->attr.loglevel_type = LTTNG_UST_LOGLEVEL;
+ break;
+ case LTTNG_EVENT_LOGLEVEL_ONLY:
+ lue->attr.loglevel_type = LTTNG_UST_LOGLEVEL_ONLY;
+ break;
+ default:
+ ERR("Unknown ust loglevel type (%d)", ev->type);
+ goto error_free_event;
+ }
+
+ /* Copy loglevel name */
+ strncpy(lue->attr.loglevel, ev->loglevel, LTTNG_UST_SYM_NAME_LEN);
+ lue->attr.loglevel[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+
/* Init node */
lttng_ht_node_init_str(&lue->node, lue->attr.name);
/* Alloc context hash tables */
static char *opt_event_list;
static int opt_event_type;
+static const char *opt_loglevel;
+static int opt_loglevel_type;
static int opt_kernel;
static char *opt_session_name;
static int opt_userspace;
OPT_FUNCTION_ENTRY,
OPT_SYSCALL,
OPT_USERSPACE,
- OPT_TRACEPOINT_LOGLEVEL,
+ OPT_LOGLEVEL,
+ OPT_LOGLEVEL_ONLY,
OPT_LIST_OPTIONS,
};
{"function:entry", 0, POPT_ARG_STRING, &opt_function_entry_symbol, OPT_FUNCTION_ENTRY, 0, 0},
#endif
{"syscall", 0, POPT_ARG_NONE, 0, OPT_SYSCALL, 0, 0},
- {"loglevel", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT_LOGLEVEL, 0, 0},
+ {"loglevel", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL, 0, 0},
+ {"loglevel-only", 0, POPT_ARG_STRING, 0, OPT_LOGLEVEL_ONLY, 0, 0},
{"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
{0, 0, 0, 0, 0, 0, 0}
};
fprintf(ofp, " e.g.:\n");
fprintf(ofp, " \"*\"\n");
fprintf(ofp, " \"app_component:na*\"\n");
- fprintf(ofp, " --loglevel Tracepoint loglevel\n");
+ fprintf(ofp, " --loglevel name\n");
+ fprintf(ofp, " Tracepoint loglevel (range: 0 to loglevel)\n");
+ fprintf(ofp, " --loglevel-only name\n");
+ fprintf(ofp, " Tracepoint loglevel (only this loglevel)\n");
fprintf(ofp, " --probe [addr | symbol | symbol+offset]\n");
fprintf(ofp, " Dynamic probe.\n");
fprintf(ofp, " Addr and offset can be octal (0NNN...),\n");
ret = CMD_UNDEFINED;
goto error;
}
+
+ if (opt_loglevel[0] != '\0') {
+ MSG("Kernel loglevels are not supported.");
+ ret = CMD_UNDEFINED;
+ goto error;
+ }
+
+ /* kernel loglevels not implemented */
+ ev.loglevel_type = opt_loglevel_type;
+ ev.loglevel[0] = '\0';
} else if (opt_userspace) { /* User-space tracer action */
#if 0
if (opt_cmd_name != NULL || opt_pid) {
strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
break;
- case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
- /* Copy name and type of the event */
- ev.type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
- strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
- ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
- break;
case LTTNG_EVENT_PROBE:
case LTTNG_EVENT_FUNCTION:
case LTTNG_EVENT_FUNCTION_ENTRY:
ret = CMD_UNDEFINED;
goto error;
}
+
+ ev.loglevel_type = opt_loglevel_type;
+ strncpy(ev.loglevel, opt_loglevel, LTTNG_SYMBOL_NAME_LEN);
+ ev.loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
goto error;
case OPT_USERSPACE:
opt_userspace = 1;
break;
- case OPT_TRACEPOINT_LOGLEVEL:
- opt_event_type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
+ case OPT_LOGLEVEL:
+ opt_loglevel_type = LTTNG_EVENT_LOGLEVEL;
+ opt_loglevel = poptGetOptArg(pc);
+ break;
+ case OPT_LOGLEVEL_ONLY:
+ opt_loglevel_type = LTTNG_EVENT_LOGLEVEL_ONLY;
+ opt_loglevel = poptGetOptArg(pc);
break;
case OPT_LIST_OPTIONS:
list_cmd_options(stdout, long_options);