• Divya Indi's avatar
    tracing: Sample module to demonstrate kernel access to Ftrace instances. · 89ed4249
    Divya Indi authored
    This is a sample module to demonstrate the use of the newly introduced and
    exported APIs to access Ftrace instances from within the kernel.
    
    Newly introduced APIs used here -
    
    1. Create/Lookup a trace array with the given name.
    struct trace_array *trace_array_get_by_name(const char *name)
    
    2. Destroy/Remove a trace array.
    int trace_array_destroy(struct trace_array *tr)
    
    4. Enable/Disable trace events:
    int trace_array_set_clr_event(struct trace_array *tr, const char *system,
            const char *event, bool enable);
    
    Exported APIs -
    1. trace_printk equivalent for instances.
    int trace_array_printk(struct trace_array *tr,
                   unsigned long ip, const char *fmt, ...);
    
    2. Helper function.
    void trace_printk_init_buffers(void);
    
    3. To decrement the reference counter.
    void trace_array_put(struct trace_array *tr)
    
    Sample output(contents of /sys/kernel/tracing/instances/sample-instance)
    NOTE: Tracing disabled after ~5 sec)
    
             ...
    89ed4249
Makefile 312 Bytes