Add calibration ioctl
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 29 Jul 2011 16:06:10 +0000 (12:06 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 29 Jul 2011 16:06:10 +0000 (12:06 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile
ltt-debugfs-abi.c
ltt-debugfs-abi.h
ltt-events.h
lttng-calibrate.c [new file with mode: 0644]

index e93792c8fabb00bd8157c1c2b603b9d7276af9f9..07c3226854ecde968ec14d892e5e9b791cc5f9e8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ ltt-relay-objs :=  ltt-events.o ltt-debugfs-abi.o \
                        lttng-context-prio.o lttng-context-nice.o \
                        lttng-context-vpid.o lttng-context-tid.o \
                        lttng-context-vtid.o lttng-context-ppid.o \
-                       lttng-context-vppid.o
+                       lttng-context-vppid.o lttng-calibrate.o
 
 ifneq ($(CONFIG_PERF_EVENTS),)
 ltt-relay-objs += $(shell \
index a5f8e7ac88f47227cf6c00b308d0275140964444..31465d83ef6d759edb6462453fe484bd09bf0279 100644 (file)
@@ -220,6 +220,20 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case LTTNG_KERNEL_WAIT_QUIESCENT:
                synchronize_trace();
                return 0;
+       case LTTNG_KERNEL_CALIBRATE:
+       {
+               struct lttng_calibrate __user *ucalibrate =
+                       (struct lttng_calibrate __user *) arg;
+               struct lttng_calibrate calibrate;
+               int ret;
+
+               if (copy_from_user(&calibrate, ucalibrate, sizeof(calibrate)))
+                       return -EFAULT;
+               ret = lttng_calibrate(&calibrate);
+               if (copy_to_user(ucalibrate, &calibrate, sizeof(calibrate)))
+                       return -EFAULT;
+               return ret;
+       }
        default:
                return -ENOIOCTLCMD;
        }
index 3b8e72ea9c8544b0d55165a7311ed25e7ddbb834..3a2b81f14bb35fcbd4bd0c352ff7e322b056cd33 100644 (file)
@@ -81,6 +81,19 @@ struct lttng_kernel_tracer_version {
        uint32_t sublevel;
 };
 
+enum lttng_calibrate_type {
+       LTTNG_CALIBRATE_KRETPROBE,
+};
+
+struct lttng_calibrate {
+       enum lttng_calibrate_type type; /* type (input) */
+       union {
+               struct {
+                       uint64_t addr;  /* address to probe (output) */
+               } kretprobe;
+       } u;
+};
+
 enum lttng_kernel_context_type {
        LTTNG_KERNEL_CONTEXT_PID                = 0,
        LTTNG_KERNEL_CONTEXT_PERF_COUNTER       = 1,
@@ -113,6 +126,8 @@ struct lttng_kernel_context {
        _IOR(0xF6, 0x41, struct lttng_kernel_tracer_version)
 #define LTTNG_KERNEL_TRACEPOINT_LIST           _IO(0xF6, 0x42)
 #define LTTNG_KERNEL_WAIT_QUIESCENT            _IO(0xF6, 0x43)
+#define LTTNG_KERNEL_CALIBRATE                 \
+       _IOWR(0xF6, 0x44, struct lttng_calibrate)
 
 /* Session FD ioctl */
 #define LTTNG_KERNEL_METADATA                  \
index 6cc4ea3f6fed01bbcc9309dbfcdfbfb33400a21e..525fc982cbaf3b629e295d0da779a9c8927bc6f1 100644 (file)
@@ -415,6 +415,8 @@ void lttng_ftrace_destroy_private(struct ltt_event *event)
 }
 #endif
 
+int lttng_calibrate(struct lttng_calibrate *calibrate);
+
 extern const struct file_operations lttng_tracepoint_list_fops;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
diff --git a/lttng-calibrate.c b/lttng-calibrate.c
new file mode 100644 (file)
index 0000000..45c01e3
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * lttng-calibrate.c
+ *
+ * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng probe calibration.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include "ltt-debugfs-abi.h"
+#include "ltt-events.h"
+
+void lttng_calibrate_kretprobe(void)
+{
+}
+
+int lttng_calibrate(struct lttng_calibrate *calibrate)
+{
+       switch (calibrate->type) {
+       case LTTNG_CALIBRATE_KRETPROBE:
+               calibrate->u.kretprobe.addr = &lttng_calibrate_kretprobe;
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
This page took 0.027209 seconds and 4 git commands to generate.