transform .dot file into kernel rv monitor usage: dot2k [-h] -d DOT_FILE -t MONITOR_TYPE [-n MODEL_NAME] [-D DESCRIPTION] optional arguments: -h, --help show this help message and exit -d DOT_FILE, --dot DOT_FILE -t MONITOR_TYPE, --monitor_type MONITOR_TYPE -n MODEL_NAME, --model_name MODEL_NAME -D DESCRIPTION, --description DESCRIPTION Link: https://lkml.kernel.org/r/083b3ae61e5a62c1e2e5d08009baa91f82181618.1659052063.git.bristot@kernel.org Cc: Wim Van Sebroeck <wim@linux-watchdog.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Ingo Molnar <mingo@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Marco Elver <elver@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: "Paul E. McKenney" <paulmck@kernel.org> Cc: Shuah Khan <skhan@linuxfoundation.org> Cc: Gabriele Paoloni <gpaoloni@redhat.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Clark Williams <williams@redhat.com> Cc: Tao Zhou <tao.zhou@linux.dev> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-trace-devel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
91 lines
1.8 KiB
C
91 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/ftrace.h>
|
|
#include <linux/tracepoint.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/rv.h>
|
|
#include <rv/instrumentation.h>
|
|
#include <rv/da_monitor.h>
|
|
|
|
#define MODULE_NAME "MODEL_NAME"
|
|
|
|
/*
|
|
* XXX: include required tracepoint headers, e.g.,
|
|
* #include <linux/trace/events/sched.h>
|
|
*/
|
|
#include <trace/events/rv.h>
|
|
|
|
/*
|
|
* This is the self-generated part of the monitor. Generally, there is no need
|
|
* to touch this section.
|
|
*/
|
|
#include "MODEL_NAME.h"
|
|
|
|
/*
|
|
* Declare the deterministic automata monitor.
|
|
*
|
|
* The rv monitor reference is needed for the monitor declaration.
|
|
*/
|
|
struct rv_monitor rv_MODEL_NAME;
|
|
DECLARE_DA_MON_PER_CPU(MODEL_NAME, MIN_TYPE);
|
|
|
|
/*
|
|
* This is the instrumentation part of the monitor.
|
|
*
|
|
* This is the section where manual work is required. Here the kernel events
|
|
* are translated into model's event.
|
|
*
|
|
*/
|
|
TRACEPOINT_HANDLERS_SKEL
|
|
static int enable_MODEL_NAME(void)
|
|
{
|
|
int retval;
|
|
|
|
retval = da_monitor_init_MODEL_NAME();
|
|
if (retval)
|
|
return retval;
|
|
|
|
TRACEPOINT_ATTACH
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void disable_MODEL_NAME(void)
|
|
{
|
|
rv_MODEL_NAME.enabled = 0;
|
|
|
|
TRACEPOINT_DETACH
|
|
|
|
da_monitor_destroy_MODEL_NAME();
|
|
}
|
|
|
|
/*
|
|
* This is the monitor register section.
|
|
*/
|
|
struct rv_monitor rv_MODEL_NAME = {
|
|
.name = "MODEL_NAME",
|
|
.description = "auto-generated MODEL_NAME",
|
|
.enable = enable_MODEL_NAME,
|
|
.disable = disable_MODEL_NAME,
|
|
.reset = da_monitor_reset_all_MODEL_NAME,
|
|
.enabled = 0,
|
|
};
|
|
|
|
static int register_MODEL_NAME(void)
|
|
{
|
|
rv_register_monitor(&rv_MODEL_NAME);
|
|
return 0;
|
|
}
|
|
|
|
static void unregister_MODEL_NAME(void)
|
|
{
|
|
rv_unregister_monitor(&rv_MODEL_NAME);
|
|
}
|
|
|
|
module_init(register_MODEL_NAME);
|
|
module_exit(unregister_MODEL_NAME);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("dot2k: auto-generated");
|
|
MODULE_DESCRIPTION("MODEL_NAME");
|