Пример #1
0
def __command_pct_large_script(argv):
    pin = pintool.Pin(config.pin_home())
    profiler = idiom_pintool.PctProfiler()
    # parse cmdline options
    usage = 'usage: <script> pct_script [options] --- <bench name> <input index>\n\n'
    usage += benchmark_usage()
    parser = optparse.OptionParser(usage)
    register_random_cmdline_options(parser)
    profiler.register_cmdline_options(parser)
    (opt_argv, prog_argv) = separate_opt_prog(argv)
    if len(prog_argv) == 1:
        bench_name = prog_argv[0]
        input_idx = 'default'
    elif len(prog_argv) == 2:
        bench_name = prog_argv[0]
        input_idx = prog_argv[1]
    else:
        parser.print_help()
        sys.exit(0)
    if not valid_benchmark(bench_name):
        logging.err('invalid benchmark name\n')
    (options, args) = parser.parse_args(opt_argv)
    profiler.set_cmdline_options(options, args)
    # run profile
    __import__('maple.benchmark.%s' % bench_name)
    bench = sys.modules['maple.benchmark.%s' % bench_name]
    test = bench.get_test(input_idx)
    test.set_prefix(get_prefix(pin, profiler))
    testcase = idiom_testing.RandomTestCase(test, options.mode,
                                            options.threshold, profiler)
    testcase.run()
Пример #2
0
def __command_default_script(argv):
    pin = pintool.Pin(config.pin_home())
    profiler = idiom_pintool.PctProfiler()
    profiler.knob_prefix = 'profile_'
    profiler.knob_defaults['enable_observer_new'] = True
    profiler.knob_defaults['enable_predictor_new'] = True
    scheduler = idiom_pintool.Scheduler()
    scheduler.knob_prefix = 'active_'
    # parse cmdline options
    usage = 'usage: <script> default_script [options] --- <bench name> <input index>\n\n'
    usage += benchmark_usage()
    parser = optparse.OptionParser(usage)
    register_profile_cmdline_options(parser, 'profile_')
    profiler.register_cmdline_options(parser)
    register_active_cmdline_options(parser, 'active_')
    scheduler.register_cmdline_options(parser)
    parser.set_defaults(profile_mode='stable')
    parser.set_defaults(profile_threshold=3)
    parser.set_defaults(active_mode='finish')
    (opt_argv, prog_argv) = separate_opt_prog(argv)
    if len(prog_argv) == 1:
        bench_name = prog_argv[0]
        input_idx = 'default'
    elif len(prog_argv) == 2:
        bench_name = prog_argv[0]
        input_idx = prog_argv[1]
    else:
        parser.print_help()
        sys.exit(0)
    if not valid_benchmark(bench_name):
        logging.err('invalid benchmark name\n')
    (options, args) = parser.parse_args(opt_argv)
    profiler.set_cmdline_options(options, args)
    scheduler.set_cmdline_options(options, args)
    # create profile testcase
    __import__('maple.benchmark.%s' % bench_name)
    bench = sys.modules['maple.benchmark.%s' % bench_name]
    profile_test = bench.get_test(input_idx)
    profile_test.set_prefix(get_prefix(pin, profiler))
    profile_testcase = idiom_testing.ProfileTestCase(profile_test,
                                                     options.profile_mode,
                                                     options.profile_threshold,
                                                     profiler)
    # create active testcase
    active_test = bench.get_test(input_idx)
    active_test.set_prefix(get_prefix(pin, scheduler))
    active_testcase = idiom_testing.ActiveTestCase(active_test,
                                                   options.active_mode,
                                                   options.active_threshold,
                                                   scheduler)
    # run idiom testcase
    idiom_testcase = idiom_testing.IdiomTestCase(profile_testcase,
                                                 active_testcase)
    idiom_testcase.run()
Пример #3
0
def __command_default(argv):
    pin = pintool.Pin(config.pin_home())
    profiler = idiom_pintool.PctProfiler()
    profiler.knob_prefix = 'profile_'
    profiler.knob_defaults['enable_observer_new'] = True
    profiler.knob_defaults['enable_predictor_new'] = True
    scheduler = idiom_pintool.Scheduler()
    scheduler.knob_prefix = 'active_'
    # parse cmdline options
    usage = 'usage: <script> default [options] --- program'
    parser = optparse.OptionParser(usage)
    register_profile_cmdline_options(parser, 'profile_')
    profiler.register_cmdline_options(parser)
    register_active_cmdline_options(parser, 'active_')
    scheduler.register_cmdline_options(parser)
    parser.set_defaults(profile_mode='stable')
    parser.set_defaults(profile_threshold=3)
    parser.set_defaults(active_mode='finish')
    (opt_argv, prog_argv) = separate_opt_prog(argv)
    if len(prog_argv) == 0:
        parser.print_help()
        sys.exit(0)
    (options, args) = parser.parse_args(opt_argv)
    profiler.set_cmdline_options(options, args)
    scheduler.set_cmdline_options(options, args)
    # create profile testcase
    profile_test = testing.InteractiveTest(prog_argv)
    profile_test.set_prefix(get_prefix(pin, profiler))
    profile_testcase = idiom_testing.ProfileTestCase(profile_test,
                                                     options.profile_mode,
                                                     options.profile_threshold,
                                                     profiler)
    # create active testcase
    active_test = testing.InteractiveTest(prog_argv)
    active_test.set_prefix(get_prefix(pin, scheduler))
    active_testcase = idiom_testing.ActiveTestCase(active_test,
                                                   options.active_mode,
                                                   options.active_threshold,
                                                   scheduler)
    # run idiom testcase
    idiom_testcase = idiom_testing.IdiomTestCase(profile_testcase,
                                                 active_testcase)
    idiom_testcase.run()
Пример #4
0
def __command_pct_large(argv):
    pin = pintool.Pin(config.pin_home())
    profiler = idiom_pintool.PctProfiler()
    # parse cmdline options
    usage = 'usage: <script> pct_large [options] --- program'
    parser = optparse.OptionParser(usage)
    register_random_cmdline_options(parser)
    profiler.register_cmdline_options(parser)
    (opt_argv, prog_argv) = separate_opt_prog(argv)
    if len(prog_argv) == 0:
        parser.print_help()
        sys.exit(0)
    (options, args) = parser.parse_args(opt_argv)
    profiler.set_cmdline_options(options, args)
    # run profile
    test = testing.InteractiveTest(prog_argv)
    test.set_prefix(get_prefix(pin, profiler))
    testcase = idiom_testing.RandomTestCase(test, options.mode,
                                            options.threshold, profiler)
    testcase.run()