예제 #1
0
def main():
    """
    Run DTrace...
    """
    thr = dtrace.DTraceConsumerThread(SCRIPT)
    thr.start()

    # we will stop the thread after some time...
    time.sleep(5)

    # stop and wait for join...
    thr.stop()
    thr.join()
예제 #2
0
파일: cli.py 프로젝트: 0mp/python-dtrace
def run_dtrace(script):
    """
    Run DTrace till Ctrl+C is pressed...
    """
    thr = dtrace.DTraceConsumerThread(script, False, walk_func=pretty_print)
    thr.start()
    brendan()
    try:
        while True:
            pass
    except (KeyboardInterrupt, SystemExit):
        thr.stop()
        thr.join()
예제 #3
0
def run_dtrace():
    """
    Runs a DTrace script for 5 seconds...
    """
    thr = dtrace.DTraceConsumerThread(SCRIPT, walk_func=walk)
    thr.start()

    # we will stop the thread after some time...
    time.sleep(5)

    # stop and wait for join...
    thr.stop()
    thr.join()
예제 #4
0
파일: dsonify.py 프로젝트: woodshop/dsonify
def main(probeScript, synthFile):
    global thr, p
    print('Starting. Press CTRL-C to stop.')
    p = subprocess.Popen(["chuck", synthFile])
    initOSCClient()
    thr = dtrace.DTraceConsumerThread(script=probeScript,
                                      consume=True,
                                      chew_func=simple_chew,
                                      chewrec_func=simple_chewrec,
                                      out_func=simple_out,
                                      walk_func=simple_walk,
                                      sleep=0)
    signal.signal(signal.SIGINT, signal_handler)
    thr.start()
    while (1):
        time.sleep(60)