loglevels: allow enable/disable
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 14:08:33 +0000 (09:08 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Dec 2011 14:08:33 +0000 (09:08 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-sessiond/main.c
lttng-sessiond/trace-ust.c
lttng/commands/enable_events.c

index c6ecb2737f2db2ef7e1c9efe0263b7f1d635242b..46fcba9391d6dba216a726b8771cd897263709ea 100644 (file)
@@ -2567,6 +2567,12 @@ error:
 
 /*
  * Command LTTNG_ENABLE_EVENT processed by the client thread.
+ *
+ * TODO: currently, both events and loglevels are kept within the same
+ * namespace for UST global registry/app registery, so if an event
+ * happen to have the same name as the loglevel (very unlikely though),
+ * and an attempt is made to enable/disable both in the same session,
+ * the first to be created will be the only one allowed to exist.
  */
 static int cmd_enable_event(struct ltt_session *session, int domain,
                char *channel_name, struct lttng_event *event)
index 1a1304ac1db9a16d0f3cfd5ca05ddbd9fd3cdc37..af78dc00086fdd506e175de11239b0325f8a0a4f 100644 (file)
@@ -212,6 +212,9 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
        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;
index 123278bc0e90750a46041f88987c2837d05df735..5740d3cbcf95547c72f8d20080da7d8f4318140d 100644 (file)
@@ -48,12 +48,12 @@ static char *opt_channel_name;
 enum {
        OPT_HELP = 1,
        OPT_TRACEPOINT,
-       OPT_MARKER,
        OPT_PROBE,
        OPT_FUNCTION,
        OPT_FUNCTION_ENTRY,
        OPT_SYSCALL,
        OPT_USERSPACE,
+       OPT_TRACEPOINT_LOGLEVEL,
 };
 
 static struct lttng_handle *handle;
@@ -69,7 +69,6 @@ static struct poptOption long_options[] = {
        {"all",            0,   POPT_ARG_VAL, &opt_pid_all, 1, 0, 0},
        {"pid",            'p', POPT_ARG_INT, &opt_pid, 0, 0, 0},
        {"tracepoint",     0,   POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0},
-       {"marker",         0,   POPT_ARG_NONE, 0, OPT_MARKER, 0, 0},
        {"probe",          0,   POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0},
        {"function",       0,   POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0},
 #if 0
@@ -80,6 +79,7 @@ static struct poptOption long_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},
        {0, 0, 0, 0, 0, 0, 0}
 };
 
@@ -101,6 +101,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "\n");
        fprintf(ofp, "Event options:\n");
        fprintf(ofp, "    --tracepoint           Tracepoint event (default)\n");
+       fprintf(ofp, "    --loglevel             Tracepoint 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");
@@ -114,7 +115,6 @@ static void usage(FILE *ofp)
        fprintf(ofp, "                           Function tracer event\n");
 #endif
        fprintf(ofp, "    --syscall              System call event\n");
-       fprintf(ofp, "    --marker               User-space marker (deprecated)\n");
        fprintf(ofp, "\n");
 }
 
@@ -346,6 +346,9 @@ static int enable_events(char *session_name)
                                /* Fall-through */
                        case LTTNG_EVENT_TRACEPOINT:
                                break;
+                       case LTTNG_EVENT_TRACEPOINT_LOGLEVEL:
+                               ev.type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
+                               break;
                        case LTTNG_EVENT_PROBE:
                        case LTTNG_EVENT_FUNCTION:
                        case LTTNG_EVENT_FUNCTION_ENTRY:
@@ -404,9 +407,6 @@ int cmd_enable_events(int argc, const char **argv)
                case OPT_TRACEPOINT:
                        opt_event_type = LTTNG_EVENT_TRACEPOINT;
                        break;
-               case OPT_MARKER:
-                       ret = CMD_NOT_IMPLEMENTED;
-                       goto end;
                case OPT_PROBE:
                        opt_event_type = LTTNG_EVENT_PROBE;
                        break;
@@ -422,6 +422,9 @@ int cmd_enable_events(int argc, const char **argv)
                case OPT_USERSPACE:
                        opt_userspace = 1;
                        break;
+               case OPT_TRACEPOINT_LOGLEVEL:
+                       opt_event_type = LTTNG_EVENT_TRACEPOINT_LOGLEVEL;
+                       break;
                default:
                        usage(stderr);
                        ret = CMD_UNDEFINED;
This page took 0.030302 seconds and 4 git commands to generate.