Exemplo n.º 1
0
    def __init__(self, list_process_times):
        self.processes = []
        count = 0
        for l in list_process_times:
            temp = Process(l, count)
            self.processes.append(temp)
            count += 1

        self.current_process = None
        self.ready_queue = []
        self.total_time = 0.0
        self.used_time = 0.0
        self.stats = defaultdict(dict)
def getData(filePath):
    '''
    Given a filepath getData opens that file, then parses through the lines
    one by one splitting the values into an array, then assigning them
    to a new process object. These process objects are added to an array
    and returned at the end.
    '''

    f = open(filePath, 'r')
    processArray = []
    for line in f:
        processItemArray = line.split()

        # There is a strong dependency here that the data be well formed as:
        #  Process ID  |  Arrival Time  | Duration
        current_process = Process()
        current_process.setID(processItemArray[0])
        current_process.setArrivalTime(int(processItemArray[1]))
        current_process.setDuration(int(processItemArray[2]))

        processArray.append(current_process)
    f.close()

    return processArray
Exemplo n.º 3
0
    args = GetArgs()
    files = GetFiles()

    # modules to include or ignore
    included_mods = readmodfile(incmodfile)
    ignored_mods = readmodfile(ignmodfile)

    original_inputs = RandomInputMutator(args + files, NullMutator)
    expanded_input_generator = RandomInputMutator(args + files,
                                                  RandomExpanderMutator)
    mutated_input_generator = RandomInputMutator(args + files,
                                                 RandomByteMutator)

    app = Process(program,
                  envs,
                  timeout,
                  included_mods,
                  ignored_mods,
                  no_stdout=not show_stdout)

    prt = TypePrinter("/dev/stdout", program)

    # unchanged input
    null_mutt, original_input = original_inputs.next()
    original_events = app.getData(prepare_inputs(original_input))

    if original_events is None:
        print "Execution of", program, "failed!"
        exit(-1)

    #prt.set_original_events(original_events)
    prt.print_events(null_mutt, original_events)