Change lttng API to use a lttng_handle
[lttng-tools.git] / lttng / commands / calibrate.c
index 76227e27e20f4bd3228a46ea40b0f72c7cfb44af..b4d0fe04537c8be1cb1212b34ae5aca8bf739381 100644 (file)
@@ -49,6 +49,8 @@ enum {
        OPT_FUNCTION_ENTRY,
 };
 
+static struct lttng_handle *handle;
+
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
        {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
@@ -105,6 +107,12 @@ static int calibrate_lttng(void)
                dom.type = LTTNG_DOMAIN_KERNEL;
        }
 
+       handle = lttng_create_handle(NULL, &dom);
+       if (handle == NULL) {
+               ret = -1;
+               goto end;
+       }
+
        /* Kernel tracer action */
        if (opt_kernel) {
                switch (opt_event_type) {
@@ -117,7 +125,7 @@ static int calibrate_lttng(void)
                case LTTNG_EVENT_FUNCTION:
                        DBG("Calibrating kernel functions");
                        calibrate.type = LTTNG_CALIBRATE_FUNCTION;
-                       ret = lttng_calibrate(&dom, &calibrate);
+                       ret = lttng_calibrate(handle, &calibrate);
                        break;
                case LTTNG_EVENT_FUNCTION_ENTRY:
                        DBG("Calibrating kernel function entry");
@@ -140,6 +148,8 @@ static int calibrate_lttng(void)
                goto end;
        }
 end:
+       lttng_destroy_handle(handle);
+
        return ret;
 }
 
This page took 0.023701 seconds and 4 git commands to generate.