Пример #1
0
 def event_receive(self, process_id, time, origin_id):
     start_time = self.idles[process_id]
     if start_time is not None:
         self.add_row('I', start_time, time - start_time, process_id, None,
                      (None, None))
         self.idles[process_id] = None
     RunInstance.event_receive(self, process_id, time, origin_id)
Пример #2
0
    def __init__(self, tracelog, transitions, place_functions, columns):
        RunInstance.__init__(self, tracelog.project, tracelog.process_count)

        self.transitions = dict(
            (transition.id, transition) for transition in transitions)

        self.place_functions = dict(
            (place.id, (place, f_index)) for place, f_index in place_functions)

        self.traced_places = dict(
            (p.id, p) for p in tracelog.project.nets[0].places()
            if p.trace_tokens and place_counter_name(p) in columns)

        self.column_event = "Event" in columns
        self.column_time = "Time" in columns
        self.column_duration = "Duration" in columns
        self.column_process = "Process" in columns
        self.column_id = "ID" in columns
        self.column_value = bool(place_functions)
        self.column_tokens = bool(self.traced_places)

        self.table = self._create_table()

        self.idles = [None] * self.process_count
        self.tokens_counters = [[0] * len(self.traced_places)
                                for p in range(tracelog.process_count)]
Пример #3
0
    def __init__(self, project, process_count, threads_count):
        RunInstance.__init__(self, project, process_count, threads_count)

        self.threads_data = [ [] for t in range(self.process_count * self.threads_count)]
        self.idles_data = [ [] for t in range(self.process_count * self.threads_count)]
        self.transitions_data = {} # [transition_id] -> [ (start_time, lenght) ]
        self.tokens_data = {} # [process_id][place_id] -> int
        self.group_nets = {}
        self.last_transition_fired = {}
        self.last_time = 0
        self.last_event_info = None
        self.idles = {}
        self.tokens_info = dict()
        self.sender_info = dict()

        self.bigtable = {'action'          : [],
                         'previous_action' : [],
                         'time_start'      : [],
                         'snd_process'     : [],
                         'snd_thread'      : [],
                         'process'         : [],
                         'thread'          : [],
                         'transition_id'   : [],
                         'transition_value'   : [],
                         'time_send'       : [],
                         'place_id'        : [],
                         'token_value'     : []}
Пример #4
0
    def __init__(self, tracelog, transitions, place_functions, columns):
        RunInstance.__init__(self,
                             tracelog.project,
                             tracelog.process_count)

        self.transitions = dict((transition.id, transition)
                                for transition in transitions)

        self.place_functions = dict((place.id, (place, f_index))
                                    for place, f_index in place_functions)

        self.traced_places = dict((p.id, p)
                                  for p in tracelog.project.nets[0].places()
                                  if p.trace_tokens and
                                     place_counter_name(p) in columns)

        self.column_event = "Event" in columns
        self.column_time = "Time" in columns
        self.column_duration = "Duration" in columns
        self.column_process = "Process" in columns
        self.column_id = "ID" in columns
        self.column_value = bool(place_functions)
        self.column_tokens = bool(self.traced_places)

        self.table = self._create_table()

        self.idles = [None] * self.process_count
        self.tokens_counters = [[0] * len(self.traced_places)
                                for p in range(tracelog.process_count)]
Пример #5
0
 def transition_finished(self, process_id, time):
     activity = self.activites[process_id]
     if activity.transition.id in self.transitions:
         start_time = activity.time
         self.add_row('T', start_time, time - start_time, process_id,
                      activity.transition.id, (None, None))
     RunInstance.transition_finished(self, process_id, time)
Пример #6
0
 def add_token(self, place_id, token_pointer, token_value, send_time):
     RunInstance.add_token(self, place_id, token_pointer, token_value, send_time)
     for pf in self.place_functions:
         if pf[0].id == place_id:
             self.add_row("A",
                          self.last_event_time,
                          place_id,
                          self.last_event_process,
                          token_value[pf[1]])
Пример #7
0
 def transition_finished(self, process_id, time):
     activity = self.activites[process_id]
     if activity.transition.id in self.transitions:
         start_time = activity.time
         self.add_row('T',
                      start_time,
                      time - start_time,
                      process_id,
                      activity.transition.id,
                      (None, None))
     RunInstance.transition_finished(self, process_id, time)
Пример #8
0
 def event_receive(self, process_id, time, origin_id):
     start_time = self.idles[process_id]
     if start_time is not None:
         self.add_row('I',
                      start_time,
                      time - start_time,
                      process_id,
                      None,
                      (None, None))
         self.idles[process_id] = None
     RunInstance.event_receive(self, process_id, time, origin_id)
Пример #9
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        self._change_place_counter(place_id, +1)

        if place_id in self.place_functions:
            place, f_index = self.place_functions[place_id]
            self.add_row(
                'A', self.last_event_time, None, self.last_event_process,
                place_id,
                (place_value_name(place, f_index), token_value[f_index]))
        RunInstance.add_token(self, place_id, token_pointer, token_value,
                              send_time)
Пример #10
0
 def __init__(self, tracelog, transitions, place_functions, columns):
     RunInstance.__init__(self, tracelog.project, tracelog.process_count, tracelog.threads_count)
     self.transitions = transitions
     self.place_functions = place_functions
     self.column_event = "Event" in columns
     self.column_time = "Time" in columns
     self.column_id = "ID" in columns
     self.column_process = "Process" in columns
     self.column_tet = "TET" in columns
     self.column_value = bool(place_functions)
     self.rows = []
     self.tet = None
Пример #11
0
    def __init__(self, filename, export_data=False):
        self.filename = filename
        self.export_data = export_data
        self._read_header()

        self.traces = [None] * self.process_count
        for process_id in xrange(self.process_count):
            self._read_trace(process_id)

        self.first_runinstance = RunInstance(self.project, self.process_count)

        self._preprocess()
Пример #12
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        self._change_place_counter(place_id, +1)

        if place_id in self.place_functions:
            place, f_index = self.place_functions[place_id]
            self.add_row('A',
                         self.last_event_time,
                         None,
                         self.last_event_process,
                         place_id,
                         (place_value_name(place, f_index),
                          token_value[f_index]))
        RunInstance.add_token(
            self, place_id, token_pointer, token_value, send_time)
Пример #13
0
    def add_token(self, place_id, token_pointer, token_value, send_time):
        RunInstance.add_token(self, place_id, token_pointer, token_value, send_time)
        net_instance = self.last_event_instance
        self.change_tokens_data(net_instance.process_id,
                                place_id, self.last_time, 1)

        previous_action = self.last_event_info.get_name()
        time = self.last_event_info.get_time()
        process = self.last_event_info.get_process()
        thread = self.last_event_info.get_thread()
        transition = self.last_event_info.get_transition()
        transition_value = self.last_event_info.get_transition_value()

        val = token_value[0] if token_value is not None else ""
        self.add_entry(
            "add_token", previous_action, time, process, thread, process, thread,
            transition, transition_value, send_time, place_id, val)
Пример #14
0
    def transition_finished(self, process_id, thread_id, time):
        time_start = self.activites[process_id * self.threads_count + thread_id].time
        RunInstance.transition_finished(self, process_id, thread_id, time)
        self.last_time = time
        activity = self.last_event_activity
        if activity.transition.has_code():
            value = (time_start, time - time_start)
            self.threads_data[activity.process_id * self.threads_count + activity.thread_id].append(value)
            self.add_transition_data(process_id, thread_id, activity.transition.id, value)

            transition_values = self.last_transition_fired.pop(process_id * self.threads_count + thread_id, None)
            self.add_entry(
                "transition_executed", self.last_event_info.get_name(), time_start, process_id, thread_id, process_id, thread_id,
                activity.transition.id, transition_values, (time - time_start), "", "")
            self.last_event_info = EventInformation(
                "_transition_finished", time, process_id, thread_id,
                activity.transition.id, transition_values, (time-time_start))
Пример #15
0
    def remove_token(self, place_id, token_pointer):
        RunInstance.remove_token(self, place_id, token_pointer)
        net_instance = self.last_event_instance
        self.change_tokens_data(net_instance.process_id,
                                place_id, self.last_time, -1)

        previous_action = self.last_event_info.get_name()
        time = self.last_event_info.get_time()
        process = self.last_event_info.get_process()
        thread = self.last_event_info.get_thread()
        transition = self.last_event_info.get_transition()
        transition_value = self.last_event_info.get_transition_value()
        time_length = self.last_event_info.get_time_length()

        self.add_entry(
            "remove_token", previous_action, time, process, thread, process, thread,
            transition, transition_value, time_length, place_id, "")
Пример #16
0
    def _preprocess(self):
        # Set time offsets
        starttime = min([ trace.get_init_time() for trace in self.traces ])
        for trace in self.traces:
            trace.time_offset = trace.get_init_time() - starttime
        trace_times = [ trace.get_next_event_time() for trace in self.traces ]

        if self.export_data:
            place_counters = [place_counter_name(p)
                              for p in self.project.nets[0].places()
                              if p.trace_tokens]

            ri = ExportRunInstance(
                self,
                [ t for t in self.project.nets[0].transitions() if t.trace_fire ],
                [ (p, i) for p in self.project.nets[0].places()
                         for i, tracing in enumerate(p.trace_tokens_functions)
                         if tracing.return_numpy_type != 'O' ],
                ExportRunInstance.basic_header + place_counters)
        else:
            ri = RunInstance(
                self.project, self.process_count)

        index = 0
        timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        full_timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        while True:

            # Searching for trace with minimal event time
            minimal_time_index = utils.index_of_minimal_value(trace_times)
            if minimal_time_index is None:
                break

            trace = self.traces[minimal_time_index]

            full_timeline.add_row((minimal_time_index, trace.pointer))

            # Timeline update
            if trace.is_next_event_visible():
                timeline.add_row(full_timeline[index])

            trace.process_event(ri)
            trace_times[minimal_time_index] = trace.get_next_event_time()

            index += 1

        self.data = Table([], 0)
        if self.export_data:
            self.data = ri.get_table()

        timeline.trim()
        full_timeline.trim()
        self.timeline, self.full_timeline = timeline, full_timeline

        self.missed_receives = ri.missed_receives
Пример #17
0
    def transition_fired(self, process_id, thread_id, time, transition_id, values):
        RunInstance.transition_fired(self, process_id, thread_id, time, transition_id, values)
        idle_value = self.store_idle(process_id, thread_id, time)
        if idle_value is not None:
            self.idles_data[process_id * self.threads_count + thread_id].append(idle_value)

        self.last_time = time
        if not values:
            transition_value = None
        else:
            tr_vals_count = len(values)
            transition_value = "{0}:".format(tr_vals_count)
            for i in range(0, tr_vals_count-1):
                transition_value += "{0};".format(values[i])
            transition_value += str(values[tr_vals_count-1])

        self.last_transition_fired[process_id * self.threads_count + thread_id] = transition_value

        self.last_event_info = EventInformation(
            "_transition_fired", time, process_id, thread_id, transition_id, transition_value, 0)
Пример #18
0
    def __init__(self, filename, export_data=False):
        self.filename = filename
        self.export_data = export_data
        self._read_header()

        self.traces = [None] * self.process_count
        for process_id in xrange(self.process_count):
            self._read_trace(process_id)

        self.first_runinstance = RunInstance(self.project, self.process_count)

        self._preprocess()
Пример #19
0
    def event_receive(self, process_id, thread_id, time, origin_id):
        send_time = RunInstance.event_receive(self, process_id, thread_id, time, origin_id)
        idle_value = self.store_idle(process_id, thread_id, time)
        if idle_value is not None:
            self.idles_data[process_id * self.threads_count + thread_id].append(idle_value)

        self.last_time = time
        """
        self.add_entry(
            "send_receive", self.last_event_info.get_name(),
            time - send_time,
            snd_process, snd_thread,
            process_id, thread_id,
            "", "", send_time, "", "")"""


        self.last_event_info = EventInformation(
            "_event_send", time, process_id, thread_id, "", "", send_time)
        return send_time
Пример #20
0
        def reports_callback(line):
            root = xml.fromstring(line)
            net_id = utils.xml_int(root, "net-id")
            runinstance = RunInstance(self.project, self.process_count)
            for process_id, e in enumerate(root.findall("process")):
                runinstance.event_spawn(process_id, 0, net_id)
                for pe in e.findall("place"):
                    place_id = utils.xml_int(pe, "id")
                    for te in pe.findall("token"):
                        name = te.get("value")
                        source = te.get("source")
                        if source is not None:
                            name = "{{{0}}} {1}".format(source, name)
                        runinstance.add_token(place_id, 0, name)
                    runinstance.clear_removed_and_new_tokens()

                for tre in e.findall("enabled"):
                    runinstance.add_enabled_transition(utils.xml_int(tre, "id"))

            for e in root.findall("activation"):
                process_id = utils.xml_int(e, "process-id")
                transition_id = utils.xml_int(e, "transition-id")
                runinstance.transition_fired(process_id,
                                             0,
                                             transition_id, [])
                if utils.xml_bool(e, "blocked", False):
                    runinstance.transition_blocked(process_id)

            for e in root.findall("packet"):
                origin_id = utils.xml_int(e, "origin-id")
                target_id = utils.xml_int(e, "target-id")
                size = utils.xml_int(e, "size")
                edge_id = utils.xml_int(e, "edge-id")
                runinstance.event_send(origin_id, 0, target_id, size, edge_id)

            runinstance.reset_last_event_info()

            self.runinstance = runinstance
            self.history_instances.append(runinstance)

            if self.state != "finished" and utils.xml_bool(root, "quit"):
                self.state = "finished"
                self.emit_event("error", "Program finished\n")
            if callback:
                callback()
            self.emit_event("changed", True)
Пример #21
0
 def event_idle(self, process_id, time):
     self.idles[process_id] = time
     RunInstance.event_idle(self, process_id, time)
Пример #22
0
class TraceLog:
    def __init__(self, filename, export_data=False):
        self.filename = filename
        self.export_data = export_data
        self._read_header()

        self.traces = [None] * self.process_count
        for process_id in xrange(self.process_count):
            self._read_trace(process_id)

        self.first_runinstance = RunInstance(self.project, self.process_count)

        self._preprocess()

    def execute_visible_events(self, ri, from_event=0, to_event=None):
        if to_event is None:
            to_event = len(self.timeline)
        for i in xrange(from_event, to_event):
            event_pointer = self.timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
        return ri

    def execute_all_events(self, ri, from_event=0, to_event=None):
        if to_event is None:
            to_event = len(self.full_timeline)
        for i in xrange(from_event, to_event):
            event_pointer = self.full_timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
        return ri

    def get_event_runinstance(self, index):
        return self.execute_visible_events(self.first_runinstance.copy(), 0,
                                           index)

    def get_event_process(self, index):
        if index == 0:
            return "X"
        index -= 1
        event_pointer = self.timeline[index]
        return event_pointer["process"]

    def get_event_time(self, index):
        if index == 0:
            return 0
        index -= 1
        event_pointer = self.timeline[index]
        trace = self.traces[event_pointer["process"]]
        trace.pointer = event_pointer["pointer"]
        return trace.get_next_event_time()

    def get_event_name(self, index):
        if index == 0:
            return "Init "
        index -= 1
        event_pointer = self.timeline[index]
        trace = self.traces[event_pointer["process"]]
        trace.pointer = event_pointer["pointer"]
        return trace.get_next_event_name()

    def get_runinstances_count(self):
        return len(self.timeline) + 1

    def get_max_time(self):
        return self.get_event_time(len(self.timeline))

    def export_sequence(self, index):
        time = utils.time_to_string(self.get_event_time(index))
        name = "Tracelog upto {0}".format(time)
        sequence = controlseq.ControlSequence(name)
        ri = self.first_runinstance.copy()
        for i in xrange(index):
            event_pointer = self.timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
            if ri.last_event == "fire":
                sequence.add_transition_start(
                    ri.last_event_process,
                    ri.last_event_activity.transition.get_name())
            elif ri.last_event == "finish":
                sequence.add_transition_finish(ri.last_event_process)
            elif ri.last_event == "receive":
                sequence.add_receive(ri.last_event_process,
                                     ri.last_event_activity.origin_id)
        return sequence

    def _read_header(self):
        with open(self.filename, "r") as f:
            header = xml.fromstring(f.readline())
            self.pointer_size = utils.xml_int(header, "pointer-size")
            self.process_count = utils.xml_int(header, "process-count")
            x = xml.fromstring(f.read())
            self.project = loader.load_project_from_xml(x, "")

    def _read_trace(self, process_id):
        filename = "{0}-{1}-0.ktt".format(
            utils.trim_filename_suffix(self.filename), process_id)
        with open(filename, "rb") as f:
            trace = Trace(f.read(), process_id, self.pointer_size)
            self.traces[process_id] = trace

    def _preprocess(self):
        # Set time offsets
        starttime = min([trace.get_init_time() for trace in self.traces])
        for trace in self.traces:
            trace.time_offset = trace.get_init_time() - starttime
        trace_times = [trace.get_next_event_time() for trace in self.traces]

        if self.export_data:
            place_counters = [
                place_counter_name(p) for p in self.project.nets[0].places()
                if p.trace_tokens
            ]

            ri = ExportRunInstance(
                self, [
                    t
                    for t in self.project.nets[0].transitions() if t.trace_fire
                ], [(p, i) for p in self.project.nets[0].places()
                    for i, tracing in enumerate(p.trace_tokens_functions)
                    if tracing.return_numpy_type != 'O'],
                ExportRunInstance.basic_header + place_counters)
        else:
            ri = RunInstance(self.project, self.process_count)

        index = 0
        timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        full_timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        while True:

            # Searching for trace with minimal event time
            minimal_time_index = utils.index_of_minimal_value(trace_times)
            if minimal_time_index is None:
                break

            trace = self.traces[minimal_time_index]

            full_timeline.add_row((minimal_time_index, trace.pointer))

            # Timeline update
            if trace.is_next_event_visible():
                timeline.add_row(full_timeline[index])

            trace.process_event(ri)
            trace_times[minimal_time_index] = trace.get_next_event_time()

            index += 1

        self.data = Table([], 0)
        if self.export_data:
            self.data = ri.get_table()

        timeline.trim()
        full_timeline.trim()
        self.timeline, self.full_timeline = timeline, full_timeline
Пример #23
0
 def remove_token(self, place_id, token_pointer):
     self._change_place_counter(place_id, -1)
     RunInstance.remove_token(self, place_id, token_pointer)
Пример #24
0
 def remove_token(self, place_id, token_pointer):
     self._change_place_counter(place_id, -1)
     RunInstance.remove_token(self, place_id, token_pointer)
Пример #25
0
 def event_idle(self, process_id, time):
     self.idles[process_id] = time
     RunInstance.event_idle(self, process_id, time)
Пример #26
0
 def event_spawn(self, process_id, thread_id, time, net_id):
     RunInstance.event_spawn(self, process_id, thread_id, time, net_id)
     self.last_time = time
     self.last_event_info = EventInformation(
         "_event_spawn", time, process_id, thread_id, "", "", "")
Пример #27
0
 def event_quit(self, process_id, thread_id, time):
     RunInstance.event_quit(self, process_id, thread_id, time)
     self.last_time = time
     self.last_event_info = EventInformation(
         "_event_quit", time, process_id, thread_id, "", "", "")
Пример #28
0
 def event_send(self, process_id, thread_id, time, target_id, size, edge_id):
     RunInstance.event_send(self, process_id, thread_id, time, target_id, size, edge_id)
     self.last_time = time
     self.last_event_info = EventInformation(
         "_event_send", time, process_id, thread_id, "", "", "")
Пример #29
0
 def transition_finished(self, process_id, thread_id, time):
     activity = self.activites[process_id * self.threads_count + thread_id]
     self.tet = time - activity.time
     if activity.transition in self.transitions:
         self.add_row("T", time, activity.transition.id, process_id, "")
     RunInstance.transition_finished(self, process_id, thread_id, time)
Пример #30
0
 def pre_event(self):
     RunInstance.pre_event(self)
     self.tet = None
Пример #31
0
class TraceLog:

    def __init__(self, filename, export_data=False):
        self.filename = filename
        self.export_data = export_data
        self._read_header()

        self.traces = [None] * self.process_count
        for process_id in xrange(self.process_count):
            self._read_trace(process_id)

        self.first_runinstance = RunInstance(self.project, self.process_count)

        self._preprocess()

    def execute_visible_events(self, ri, from_event=0, to_event=None):
        if to_event is None:
            to_event = len(self.timeline)
        for i in xrange(from_event, to_event):
            event_pointer = self.timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
        return ri

    def execute_all_events(self, ri,from_event=0, to_event=None):
        if to_event is None:
            to_event = len(self.full_timeline)
        for i in xrange(from_event, to_event):
            event_pointer = self.full_timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
        return ri

    def get_event_runinstance(self, index):
        return self.execute_visible_events(
            self.first_runinstance.copy(), 0, index)

    def get_event_process(self, index):
        if index == 0:
            return "X"
        index -= 1
        event_pointer = self.timeline[index]
        return event_pointer["process"]

    def get_event_time(self, index):
        if index == 0:
            return 0
        index -= 1
        event_pointer = self.timeline[index]
        trace = self.traces[event_pointer["process"]]
        trace.pointer = event_pointer["pointer"]
        return trace.get_next_event_time()

    def get_event_name(self, index):
        if index == 0:
            return "Init "
        index -= 1
        event_pointer = self.timeline[index]
        trace = self.traces[event_pointer["process"]]
        trace.pointer = event_pointer["pointer"]
        return trace.get_next_event_name()

    def get_runinstances_count(self):
        return len(self.timeline) + 1

    def get_max_time(self):
        return self.get_event_time(len(self.timeline))

    def export_sequence(self, index):
        time = utils.time_to_string(self.get_event_time(index))
        name = "Tracelog upto {0}".format(time)
        sequence = controlseq.ControlSequence(name)
        ri = self.first_runinstance.copy()
        for i in xrange(index):
            event_pointer = self.timeline[i]
            trace = self.traces[event_pointer["process"]]
            trace.pointer = event_pointer["pointer"]
            trace.process_event(ri)
            if ri.last_event == "fire":
                sequence.add_transition_start(ri.last_event_process,
                                              ri.last_event_activity.transition.get_name())
            elif ri.last_event == "finish":
                sequence.add_transition_finish(ri.last_event_process)
            elif ri.last_event == "receive":
                sequence.add_receive(ri.last_event_process,
                                     ri.last_event_activity.origin_id)
        return sequence

    def _read_header(self):
        with open(self.filename, "r") as f:
            header = xml.fromstring(f.readline())
            self.pointer_size = utils.xml_int(header, "pointer-size")
            self.process_count = utils.xml_int(header, "process-count")
            x = xml.fromstring(f.read())
            self.project = loader.load_project_from_xml(x, "")

    def _read_trace(self, process_id):
        filename = "{0}-{1}-0.ktt".format(
            utils.trim_filename_suffix(self.filename),
            process_id)
        with open(filename, "rb") as f:
            trace = Trace(f.read(), process_id, self.pointer_size)
            self.traces[process_id] = trace

    def _preprocess(self):
        # Set time offsets
        starttime = min([ trace.get_init_time() for trace in self.traces ])
        for trace in self.traces:
            trace.time_offset = trace.get_init_time() - starttime
        trace_times = [ trace.get_next_event_time() for trace in self.traces ]

        if self.export_data:
            place_counters = [place_counter_name(p)
                              for p in self.project.nets[0].places()
                              if p.trace_tokens]

            ri = ExportRunInstance(
                self,
                [ t for t in self.project.nets[0].transitions() if t.trace_fire ],
                [ (p, i) for p in self.project.nets[0].places()
                         for i, tracing in enumerate(p.trace_tokens_functions)
                         if tracing.return_numpy_type != 'O' ],
                ExportRunInstance.basic_header + place_counters)
        else:
            ri = RunInstance(
                self.project, self.process_count)

        index = 0
        timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        full_timeline = Table([("process", "<i4"), ("pointer", "<i4")], 100)
        while True:

            # Searching for trace with minimal event time
            minimal_time_index = utils.index_of_minimal_value(trace_times)
            if minimal_time_index is None:
                break

            trace = self.traces[minimal_time_index]

            full_timeline.add_row((minimal_time_index, trace.pointer))

            # Timeline update
            if trace.is_next_event_visible():
                timeline.add_row(full_timeline[index])

            trace.process_event(ri)
            trace_times[minimal_time_index] = trace.get_next_event_time()

            index += 1

        self.data = Table([], 0)
        if self.export_data:
            self.data = ri.get_table()

        timeline.trim()
        full_timeline.trim()
        self.timeline, self.full_timeline = timeline, full_timeline

        self.missed_receives = ri.missed_receives
Пример #32
0
 def event_idle(self, process_id, thread_id, time):
     RunInstance.event_idle(self, process_id, thread_id, time)
     idx = process_id * self.threads_count + thread_id
     self.idles[idx] = time