Lines Matching refs:self
20 def __init__(self, file_path, MonitorType): argument
23 self.monitor_type = self.monitor_types.get(MonitorType)
24 if self.monitor_type == None:
27 self.monitor_type = MonitorType
28 self.__fill_rv_templates_dir()
29 self.main_c = self.__open_file(self.monitor_templates_dir + "main_" + MonitorType + ".c")
30 self.enum_suffix = "_%s" % self.name
32 def __fill_rv_templates_dir(self): argument
34 if os.path.exists(self.monitor_templates_dir) == True:
43 self.monitor_templates_dir = kernel_path
47 self.monitor_templates_dir = "/usr/share/dot2/dot2k_templates/"
53 def __open_file(self, path): argument
63 def __buff_to_string(self, buff): argument
72 def fill_tracepoint_handlers_skel(self): argument
74 for event in self.events:
77 if self.monitor_type == "per_task":
79 … buff.append("\tda_handle_event_%s(p, %s%s);" % (self.name, event, self.enum_suffix));
81 buff.append("\tda_handle_event_%s(%s%s);" % (self.name, event, self.enum_suffix));
84 return self.__buff_to_string(buff)
86 def fill_tracepoint_attach_probe(self): argument
88 for event in self.events:
89 …f.append("\trv_attach_trace_probe(\"%s\", /* XXX: tracepoint */, handle_%s);" % (self.name, event))
90 return self.__buff_to_string(buff)
92 def fill_tracepoint_detach_helper(self): argument
94 for event in self.events:
95 …f.append("\trv_detach_trace_probe(\"%s\", /* XXX: tracepoint */, handle_%s);" % (self.name, event))
96 return self.__buff_to_string(buff)
98 def fill_main_c(self): argument
99 main_c = self.main_c
100 min_type = self.get_minimun_type()
101 nr_events = self.events.__len__()
102 tracepoint_handlers = self.fill_tracepoint_handlers_skel()
103 tracepoint_attach = self.fill_tracepoint_attach_probe()
104 tracepoint_detach = self.fill_tracepoint_detach_helper()
107 main_c = main_c.replace("MODEL_NAME", self.name)
115 def fill_model_h_header(self): argument
118 buff.append(" * Automatically generated C representation of %s automaton" % (self.name))
126 def fill_model_h(self): argument
130 self.enum_states_def = "states_%s" % self.name
131 self.enum_events_def = "events_%s" % self.name
132 self.struct_automaton_def = "automaton_%s" % self.name
133 self.var_automaton_def = "automaton_%s" % self.name
135 buff = self.fill_model_h_header()
136 buff += self.format_model()
138 return self.__buff_to_string(buff)
140 def __create_directory(self): argument
142 os.mkdir(self.name)
146 print("Fail creating the output dir: %s" % self.name)
148 def __create_file(self, file_name, content): argument
149 path = "%s/%s" % (self.name, file_name)
161 def __get_main_name(self): argument
162 path = "%s/%s" % (self.name, "main.c")
167 def print_files(self): argument
168 main_c = self.fill_main_c()
169 model_h = self.fill_model_h()
171 self.__create_directory()
173 path = "%s.c" % self.name
174 self.__create_file(path, main_c)
176 path = "%s.h" % self.name
177 self.__create_file(path, model_h)