Implement cpu_id context for filtering
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 Jun 2015 15:39:16 +0000 (17:39 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 Jun 2015 15:39:16 +0000 (17:39 +0200)
cpu_id context can now be used for filtering, e.g.:

lttng enable-event -k sched_switch --filter '$ctx.cpu_id==1'

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile
lttng-abi.c
lttng-abi.h
lttng-context.c
lttng-events.h

index b1bc6b95f953366472d7b4559b17970bc4fad881..f233e660473b8b21167d8ecea5a4b3593fcdd692 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,8 @@ lttng-tracer-objs :=  lttng-events.o lttng-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-calibrate.o \
+                       lttng-context-vppid.o lttng-context-cpu-id.o \
+                       lttng-calibrate.o \
                        lttng-context-hostname.o wrapper/random.o \
                        probes/lttng.o wrapper/trace-clock.o \
                        wrapper/page_alloc.o \
index d4c5ea0fc8938d1d31b6639357546b24a5d19ffa..93cdce3e0f00ec37e007ae17a54bce290ee035df 100644 (file)
@@ -240,6 +240,8 @@ long lttng_abi_add_context(struct file *file,
                return lttng_add_procname_to_ctx(ctx);
        case LTTNG_KERNEL_CONTEXT_HOSTNAME:
                return lttng_add_hostname_to_ctx(ctx);
+       case LTTNG_KERNEL_CONTEXT_CPU_ID:
+               return lttng_add_cpu_id_to_ctx(ctx);
        default:
                return -EINVAL;
        }
index 06eae78586d2d2a853119c7a37db1328c9f17a71..ab54cf8dc50ec06b6ca5a504ff173bdfeb6d8bc0 100644 (file)
@@ -141,6 +141,7 @@ enum lttng_kernel_context_type {
        LTTNG_KERNEL_CONTEXT_PPID               = 8,
        LTTNG_KERNEL_CONTEXT_VPPID              = 9,
        LTTNG_KERNEL_CONTEXT_HOSTNAME           = 10,
+       LTTNG_KERNEL_CONTEXT_CPU_ID             = 11,
 };
 
 struct lttng_kernel_perf_counter_ctx {
index d8ce9770b82e8dd104bb48daafbf8e6a7549b6bb..eca58ce1873b3ab18c25001ac362a086dda6ecbd 100644 (file)
@@ -264,6 +264,10 @@ int lttng_context_init(void)
        if (ret) {
                printk(KERN_WARNING "Cannot add context lttng_add_vpid_to_ctx");
        }
+       ret = lttng_add_cpu_id_to_ctx(&lttng_static_ctx);
+       if (ret) {
+               printk(KERN_WARNING "Cannot add context lttng_add_cpu_id_to_ctx");
+       }
        /* TODO: perf counters for filtering */
        return 0;
 }
index 4d1b54f907992a5a22dad8ce4ecc0f5172f135f6..4d9bdfd0574390da27f7177c26d561683ae3c553 100644 (file)
@@ -605,6 +605,7 @@ void lttng_remove_context_field(struct lttng_ctx **ctx,
                                struct lttng_ctx_field *field);
 void lttng_destroy_context(struct lttng_ctx *ctx);
 int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
 int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
 int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
 int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
This page took 0.028587 seconds and 4 git commands to generate.