Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <linux/ftrace.h>
0003 #include <linux/tracepoint.h>
0004 #include <linux/kernel.h>
0005 #include <linux/module.h>
0006 #include <linux/init.h>
0007 #include <linux/rv.h>
0008 #include <rv/instrumentation.h>
0009 #include <rv/da_monitor.h>
0010 
0011 #define MODULE_NAME "MODEL_NAME"
0012 
0013 /*
0014  * XXX: include required tracepoint headers, e.g.,
0015  * #include <linux/trace/events/sched.h>
0016  */
0017 #include <trace/events/rv.h>
0018 
0019 /*
0020  * This is the self-generated part of the monitor. Generally, there is no need
0021  * to touch this section.
0022  */
0023 #include "MODEL_NAME.h"
0024 
0025 /*
0026  * Declare the deterministic automata monitor.
0027  *
0028  * The rv monitor reference is needed for the monitor declaration.
0029  */
0030 struct rv_monitor rv_MODEL_NAME;
0031 DECLARE_DA_MON_PER_TASK(MODEL_NAME, MIN_TYPE);
0032 
0033 /*
0034  * This is the instrumentation part of the monitor.
0035  *
0036  * This is the section where manual work is required. Here the kernel events
0037  * are translated into model's event.
0038  *
0039  */
0040 TRACEPOINT_HANDLERS_SKEL
0041 static int enable_MODEL_NAME(void)
0042 {
0043     int retval;
0044 
0045     retval = da_monitor_init_MODEL_NAME();
0046     if (retval)
0047         return retval;
0048 
0049 TRACEPOINT_ATTACH
0050 
0051     return 0;
0052 }
0053 
0054 static void disable_MODEL_NAME(void)
0055 {
0056     rv_MODEL_NAME.enabled = 0;
0057 
0058 TRACEPOINT_DETACH
0059 
0060     da_monitor_destroy_MODEL_NAME();
0061 }
0062 
0063 /*
0064  * This is the monitor register section.
0065  */
0066 struct rv_monitor rv_MODEL_NAME = {
0067     .name = "MODEL_NAME",
0068     .description = "auto-generated MODEL_NAME",
0069     .enable = enable_MODEL_NAME,
0070     .disable = disable_MODEL_NAME,
0071     .reset = da_monitor_reset_all_MODEL_NAME,
0072     .enabled = 0,
0073 };
0074 
0075 static int register_MODEL_NAME(void)
0076 {
0077     rv_register_monitor(&rv_MODEL_NAME);
0078     return 0;
0079 }
0080 
0081 static void unregister_MODEL_NAME(void)
0082 {
0083     rv_unregister_monitor(&rv_MODEL_NAME);
0084 }
0085 
0086 module_init(register_MODEL_NAME);
0087 module_exit(unregister_MODEL_NAME);
0088 
0089 MODULE_LICENSE("GPL");
0090 MODULE_AUTHOR("dot2k: auto-generated");
0091 MODULE_DESCRIPTION("MODEL_NAME");