Ejemplo n.º 1
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)
Ejemplo 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)
            cpuList = str(msg.event.stream.trace.environment["cpu_list"])
            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.addCPUList(cpuList)
            ParaverTrace.addBinaryName(binaryName)
            ParaverTrace.initalizeTraceFiles()

            # Initialize both Kernel and Runtime Models. The Kernel Model must
            # be initalized before Paravare views are created
            KernelModel.initialize()
            RuntimeModel.initialize()

            # Create Paraver Views
            self.__paraverViews = [
                pv.ParaverViewRuntimeCode(),
                pv.ParaverViewRuntimeBusyWaiting(),
                pv.ParaverViewRuntimeTasks(),
                pv.ParaverViewTaskLabel(),
                pv.ParaverViewTaskSource(),
                pv.ParaverViewTaskId(),
                pv.ParaverViewHardwareCounters(),
                pv.ParaverViewThreadId(),
                pv.ParaverViewRuntimeSubsystems(),
                pv.ParaverViewCTFFlush(),
                #pv.ParaverViewNumberOfReadyTasks(),
                pv.ParaverViewNumberOfCreatedTasks(),
                pv.ParaverViewNumberOfBlockedTasks(),
                pv.ParaverViewNumberOfRunningTasks(),
                pv.ParaverViewNumberOfCreatedThreads(),
                pv.ParaverViewNumberOfRunningThreads(),
                pv.ParaverViewNumberOfBlockedThreads(),
                pv.ParaverViewKernelThreadID(),
                pv.ParaverViewKernelPreemptions(),
                pv.ParaverViewKernelSyscalls(),
            ]

            # Install event processing hooks
            self.installHooks(KernelModel.preHooks())
            self.installHooks(RuntimeModel.preHooks())
            for view in self.__paraverViews:
                self.installHooks(view.hooks())
            self.installHooks(RuntimeModel.postHooks())
            self.installHooks(KernelModel.postHooks())

            # 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)