예제 #1
0
def toggleEvents(toggle, wakeups=False, command=None):
    if toggle:
        ftrace.enableEvent("sched/sched_switch")
        if wakeups:
            ftrace.enableEvent("sched/sched_wakeup")
        if command:
            ftrace.filterPid(os.getpid())
        ftrace.enableStackTrace()
        ftrace.clearTraceBuffer()
        ftrace.enableFtrace()
    else:
        ftrace.disableFtrace()
        ftrace.disableEvent("sched/sched_switch")
        ftrace.disableEvent("sched/sched_wakeup")
        ftrace.disableStackTrace()
        ftrace.clearFilterPid()
예제 #2
0
            continue

        e = sched.SchedSwitchEvent(trace, eventDict)
        sleeping[eventDict["prev_pid"]] = e
        if not commandP and liveSystem and (time.time() - start) >= runTime:
            if not continual:
                toggleEvents(False, args.w)
                exited = True
                break
            printSummary(processes, lastTime - firstTime)
            firstTime = 0.0
            processes = {}
            sleeping = {}
            waking = {}
            start = time.time()

        # Check to see if our command exited, if it did disable polling and
        # trace_pipe will return EOF once we've gotten the rest of the stuff in
        # the buffer.
        if commandP and not exited:
            retval = commandP.poll()
            if retval is not None:
                exited = True
                ftrace.disableFtrace()

printSummary(processes, lastTime - firstTime)
if traceFile:
    traceFile.close()
if args.run:
    devNull.close()