def process_utilization(table, processes): required = ["Event", "Process", "Time", "Duration"] header = table.header if not all(item in header for item in required): return f_eq = lambda x, y: x == y columns = ["Time", "Duration"] # collect idles filters = [("Event", f_eq, 'I')] idles = [] for p in processes: idles.append(table.select(columns, filters + [("Process", f_eq, p)])) # collect TETs filters = [("Event", f_eq, 'T')] names, values = [], [] for p in processes: names.append(str(p)) values.append(table.select(columns, filters + [("Process", f_eq, p)])) names.reverse() values.reverse() if idles is not None: idles.reverse() return ("Utilization of processes", charts.utilization_chart(names, values, "Utilization of processes", "Time", "Process", idles))
def process_utilization(table, processes): required = ["Event", "Process", "Time", "Duration"] header = table.header if not all(item in header for item in required): return f_eq = lambda x, y: x == y columns = ["Time", "Duration"] # collect idles filters = [("Event", f_eq, 'I')] idles = [] for p in processes: idles.append(table.select(columns, filters + [("Process", f_eq, p)])) # collect TETs filters = [("Event", f_eq, 'T')] names, values = [], [] for p in processes: names.append(str(p)) values.append(table.select(columns, filters + [("Process", f_eq, p)])) names.reverse() values.reverse() if idles is not None: idles.reverse() return ("Utilization of processes", charts.utilization_chart( names, values, "Utilization of processes", "Time", "Process", idles))
def _transition_utilization_group_threads(self): names = self.tracelog.statistics["trans_gthreads_names"] values = self.tracelog.statistics["trans_gthreads_values"] values.reverse() names.reverse() return charts.utilization_chart( names, values, "Utilization of transitions (group by threads)", "Time", "Transition", self.tracelog.threads_count)
def _transitions_utilization(self): names = self.tracelog.statistics["transition_names"] values = self.tracelog.statistics["transition_values"] values.reverse() names.reverse() return charts.utilization_chart( names, values, "Utilizations of transitions", "Time", "Transition")
def _processes_utilization(self): values = self.tracelog.statistics["threads"] idles = self.tracelog.statistics["idles"] names = [] for p in range(self.tracelog.process_count): for t in range(self.tracelog.threads_count): names.append("process {0}`{1}".format(p, t)) names.reverse() values.reverse() idles.reverse() return charts.utilization_chart( names, values, "Utilizations of processes", "Time", "Processes", idles=idles)
def transition_utilization(table, processes, transitions): required = ["Event", "ID", "Time", "Duration"] header = table.header if not all(item in header for item in required): return f_eq = lambda x, y: x == y columns = ["Time", "Duration"] filters = [("Event", f_eq, 'T')] if "Process" in header: names, values = [], [] for p in processes: pnames, pvalues = [], [] for t in transitions: pnames.append("{0} {1}".format(t.get_name_or_id(), p)) pvalues.append( table.select( columns, filters + [("ID", f_eq, t.id), ("Process", f_eq, p)])) names.append(pnames) values.append(pvalues) # reorder by processes; process zero at the top values.reverse() names.reverse() # concatenate names on each process f_concate = lambda x, y: x + y values = reduce(f_concate, values, []) names = reduce(f_concate, names, []) else: names, values = [], [] for t in transitions: names.append(t.get_name_or_id()) values.append(table.select(columns, filters + [("ID", f_eq, t.id)])) return ("Utilization of transitions", charts.utilization_chart(names, values, "Utilization of transitions", "Time", "Transition"))
def transition_utilization(table, processes, transitions): required = ["Event", "ID", "Time", "Duration"] header = table.header if not all(item in header for item in required): return f_eq = lambda x, y: x == y columns = ["Time", "Duration"] filters = [("Event", f_eq, 'T')] if "Process" in header: names, values = [], [] for p in processes: pnames, pvalues = [], [] for t in transitions: pnames.append("{0} {1}".format(t.get_name_or_id(), p)) pvalues.append(table.select( columns, filters + [("ID", f_eq, t.id), ("Process", f_eq, p)])) names.append(pnames) values.append(pvalues) # reorder by processes; process zero at the top values.reverse() names.reverse() # concatenate names on each process f_concate = lambda x, y: x + y values = reduce(f_concate, values, []) names = reduce(f_concate, names, []) else: names, values = [], [] for t in transitions: names.append(t.get_name_or_id()) values.append(table.select( columns, filters + [("ID", f_eq, t.id)])) return ("Utilization of transitions", charts.utilization_chart( names, values, "Utilization of transitions", "Time", "Transition"))