def run(self, script, runtime=1):
        # set simple output callbacks
        if LIBRARY.dtrace_handle_buffered(self.handle, self.buf_out,
                                          None) == -1:
            raise Exception('Unable to set the stdout buffered writer.')

        # compile
        prg = LIBRARY.dtrace_program_strcompile(self.handle,
                                                script, 3, 4, 0, None)
        if prg is None:
            raise Exception('Unable to compile the script: ',
                            get_error_msg(self.handle))

        # run
        if LIBRARY.dtrace_program_exec(self.handle, prg, None) == -1:
            raise Exception('Failed to execute: ',
                            get_error_msg(self.handle))
        if LIBRARY.dtrace_go(self.handle) != 0:
            raise Exception('Failed to run_script: ',
                            get_error_msg(self.handle))

        # aggregate data for a few sec...
        i = 0
        while i < runtime:
            LIBRARY.dtrace_sleep(self.handle)
            LIBRARY.dtrace_work(self.handle, None, self.chew, self.chew_rec,
                                None)

            time.sleep(1)
            i += 1

        LIBRARY.dtrace_stop(self.handle)

        # sorting instead of dtrace_aggregate_walk

        if LIBRARY.dtrace_aggregate_walk_valsorted(self.handle,
                                                   self.walk,
                                                   None) != 0:
            raise Exception('Failed to walk the aggregate: ',
                            get_error_msg(self.handle))
For a given list of (base, inflection)-tuples,
dataset/ETHPy150Open tmetsch/python-dtrace/dtrace_ctypes/consumer.py/DTraceConsumer.run--crossover with--dataset/ETHPy150Open clips/pattern/pattern/metrics.py/suffixes