def main(): checkEnvironment() input_schedule = sys.argv[1] output_schedule = sys.argv[2] binary_file = sys.argv[3] thrille_root = os.environ.get('THRILLE_ROOT') sched, enabled, addrlist, condlist = \ blockremoval.readInNewSchedule(sys.argv[1]) error = blockremoval.recordFailure(sys.argv[1]) assert blockremoval.testSchedule(sched, error, addrlist, binary_file, \ thrille_root) start_blocks = blockremoval.getTotalBlocks(sched) start_context = \ preemptremoval.countContextSwitches(sched, enabled, condlist) start_npcs = \ preemptremoval.countNonpreemptiveCS(sched, enabled, condlist) start_preemptions = \ preemptremoval.countPreemptions(sched, enabled, condlist) assert (start_npcs + start_preemptions) == start_context, "sanity fail" simpsched = noniterativeAA(output_schedule, binary_file,\ thrille_root, sched,\ enabled, addrlist, error) blockremoval.outputResult(simpsched, error, addrlist,\ binary_file, thrille_root, output_schedule) sched, enabled, addrlist, condlist = \ blockremoval.readInNewSchedule(output_schedule) end_blocks = blockremoval.getTotalBlocks(sched) end_context = \ preemptremoval.countContextSwitches(sched, enabled, condlist) end_npcs = \ preemptremoval.countNonpreemptiveCS(sched, enabled, condlist) end_preemptions = \ preemptremoval.countPreemptions(sched, enabled, condlist) assert (end_npcs + end_preemptions) == end_context, "sanity fail" print "Start:\n\tblocks:", start_blocks, print "\n\tcontext switches:", start_context, "\n\t\tpreemptions:", print start_preemptions, "\n\t\tnon-preemptive switches:", start_npcs print print "End:\n\tblocks:", end_blocks, print "\n\tcontext switches:", end_context, "\n\t\tpreemptions:", print end_preemptions, "\n\t\tnon-preemptive switches:", end_npcs
def main(): checkEnvironment() input_schedule = sys.argv[1] output_schedule = sys.argv[2] binary_file = sys.argv[3] thrille_root = os.environ.get('THRILLE_ROOT') sched, enabled, addrlist, condlist = \ blockremoval.readInNewSchedule(sys.argv[1]) error = blockremoval.recordFailure(sys.argv[1]) assert blockremoval.testSchedule(sched, error, addrlist, \ binary_file, thrille_root) start_blocks = blockremoval.getTotalBlocks(sched) start_context = \ preemptremoval.countContextSwitches(sched, enabled, condlist) start_npcs = \ preemptremoval.countNonpreemptiveCS(sched, enabled, condlist) start_preemptions = \ preemptremoval.countPreemptions(sched, enabled, condlist) assert (start_npcs + start_preemptions) == start_context, "sanity fail" simpsched = noniterativeBB(output_schedule, binary_file,\ thrille_root, sched,\ enabled, addrlist, error) blockremoval.outputResult(simpsched, error, addrlist, \ binary_file, thrille_root, output_schedule) sched, enabled, addrlist, condlist = \ blockremoval.readInNewSchedule(output_schedule) end_blocks = blockremoval.getTotalBlocks(sched) end_context = \ preemptremoval.countContextSwitches(sched, enabled, condlist) end_npcs = \ preemptremoval.countNonpreemptiveCS(sched, enabled, condlist) end_preemptions = \ preemptremoval.countPreemptions(sched, enabled, condlist) assert (end_npcs + end_preemptions) == end_context, "sanity fail" print "Start:\n\tblocks:", start_blocks, print "\n\tcontext switches:", start_context, "\n\t\tpreemptions:", print start_preemptions, "\n\t\tnon-preemptive switches:", start_npcs print print "End:\n\tblocks:", end_blocks, print "\n\tcontext switches:", end_context, "\n\t\tpreemptions:", print end_preemptions, "\n\t\tnon-preemptive switches:", end_npcs
def outputScheduleInformation(str, sched, enabled, condlist): blocks = blockremoval.getTotalBlocks(sched) contexts = preemptremoval.countContextSwitches(sched, enabled, condlist) npcs = preemptremoval.countNonpreemptiveCS(sched, enabled, condlist) preemptions = preemptremoval.countPreemptions(sched, enabled, condlist) assert (npcs + preemptions) == contexts, "sanity fail" print str, ":" print "\tblocks:", blocks, print "\n\tcontext switches:", contexts, "\n\t\tpreemptions:", print preemptions, "\n\t\tnon-preemptive switches:", npcs