Esempio n. 1
0
 def _process_event(self, ts, event):
     hookList = self.__hooks[event.name]
     for hook in hookList:
         hook(event, self.__payload)
     if self.__payload:
         cpuId = RuntimeModel.getVirtualCPUId(event)
         ParaverTrace.emitEvent(ts, cpuId, self.__payload)
     self.__payload.clear()
Esempio n. 2
0
    def _process_first_message(self):
        msg = next(self._it)
        if type(msg) is bt2._EventMessageConst:
            clk = msg.default_clock_snapshot
            absoluteStartTime = clk.clock_class.offset.seconds
            ts = clk.value - 1  # see comments below
            assert (ts >= 0)
            ncpus = msg.event.stream.trace.environment["ncpus"]
            binaryName = msg.event.stream.trace.environment["binary_name"]
            pid = msg.event.stream.trace.environment["pid"]
            traceName = "trace_" + str(binaryName) + "_" + str(pid)

            # initialize paraver trace
            ParaverTrace.addTraceName(traceName)
            ParaverTrace.addAbsoluteStartTime(absoluteStartTime)
            ParaverTrace.addStartTime(ts)
            ParaverTrace.addNumberOfCPUs(ncpus)
            ParaverTrace.initalizeTraceFiles()

            # install event processing hooks
            RuntimeModel.initialize(ncpus)
            self.installHooks(RuntimeModel.hooks())
            for view in self.__paraverViews:
                self.installHooks(view.hooks())

            # redirect message processing
            self.__process_message = self._process_other_message

            # compute set of starting events
            for view in self.__paraverViews:
                view.start(self.__payload)
            # We emit a set of initial events one nanosecond before the first
            # event is encountered to avoid overlapping with the extrae events
            # derived from the first ctf event.
            ParaverTrace.emitEvent(ts, 0, self.__payload)
            self.__payload.clear()

        self._consume_message(msg)
Esempio n. 3
0
    def hook_flush(self, event, _):
        start = event["start"]
        end = event["end"]

        # In this view we are not emiting events trough the "payload" variable,
        # but we are emitting events directly. That's because we don't want to
        # use the current event timestamp as the extare timestamp but we want
        # to use the event's fields as timestamps. It is safe to do so becaue
        # on flushing, we know that no events could be emitted between the last
        # processed event and now, basically because nanos6 was flushing the
        # buffer :-)

        cpuId = RuntimeModel.getVirtualCPUId(event)
        ParaverTrace.emitEvent(start, cpuId, [(ExtraeEventTypes.CTF_FLUSH, 1)])
        ParaverTrace.emitEvent(end, cpuId, [(ExtraeEventTypes.CTF_FLUSH, 0)])
Esempio n. 4
0
 def getEventStack(self, event):
     thread = RuntimeModel.getCurrentThread(event)
     stack = thread.eventStack
     assert (stack != None)
     return stack
Esempio n. 5
0
 def hook_initStack(self, event, payload):
     tid = event["tid"]
     thread = RuntimeModel.getThread(tid)
     thread.eventStack = [self.Status.Runtime]
Esempio n. 6
0
 def hook_taskStop(self, event, payload):
     taskId = event["id"]
     taskTypeId = RuntimeModel.getTaskTypeId(taskId)
     payload.append(
         (ExtraeEventTypes.RUNNING_TASK_SOURCE, RuntimeActivity.End))
Esempio n. 7
0
 def hook_taskExecute(self, event, payload):
     taskId = event["id"]
     taskTypeId = RuntimeModel.getTaskTypeId(taskId)
     payload.append((ExtraeEventTypes.RUNNING_TASK_SOURCE, taskTypeId))