コード例 #1
0
from Agents.BenchmarkAgent import BenchmarkAgent

import this

from executor import main

# mixed_scenario_enders_and_getters = {ReserverEnder: 30, ReserverSingleGetter: 20}
# reserve_get_status = {ReserverGetterOnlyStatus: 30}

# Create reservation, then end it
# main(ReserverEnder)

# Create reservation, then end it
# main(ReserverSingleGetter)

NUMBER_OF_BUILDS_MULTIPLE_EXECUTIONS = [33]

# create reservation, then have a loop that checks if status has changed every two seconds
for itera in NUMBER_OF_BUILDS_MULTIPLE_EXECUTIONS:
    reserve_benchmark_flow = {BenchmarkAgent: 5000}
    main(reserve_benchmark_flow,
         number_of_action_groups=1,
         number_of_actions_per_group=itera,
         sleep_between_groups=0,
         main_loop_iterations=3)
コード例 #2
0
bests = [
    PerformanceCombination(0, 25),
    PerformanceCombination(0, 25),
    PerformanceCombination(30, 20),
    PerformanceCombination(15, 5)
]

for sleep_between_group in sleep_between_groups:
    spg_result = dict()
    for apg in actions_per_group:
        start = time.time()
        reserve_benchmark_flow = {BenchmarkWithoutEndAgent: 5000}
        monitor = BackgroundServerMonitor()
        results = main(reserve_benchmark_flow,
                       number_of_action_groups=100 // apg,
                       number_of_actions_per_group=apg,
                       sleep_between_groups=sleep_between_group,
                       main_loop_iterations=5)
        monitor.stop()
        end = time.time()
        errors = results["total number of errors"]
        elapsed = end - start
        spg_result[apg] = {
            "duration": elapsed,
            "errors": errors,
            "average_cpu_percent": monitor.cpu_percent,
            "memory": monitor.memory
        }
    recommended[sleep_between_group] = spg_result
    with open('optimizer_{0}.json'.format(str(sleep_between_group)),
              'w') as fp:
コード例 #3
0
ファイル: ospf.py プロジェクト: asyre/bachelor_degree
    @node("node5")
    @order(value=2)
    def Node5PingTestCase(self, connection: Connection):
        should_contains(do_ping(connection, "101.0.0.1", "105.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "102.0.0.1", "105.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "103.0.0.1", "105.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "104.0.0.1", "105.0.0.1", 10),
                        "10 packets transmitted")

    @node("node6")
    @order(value=2)
    def Node6PingTestCase(self, connection: Connection):
        should_contains(do_ping(connection, "101.0.0.1", "106.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "102.0.0.1", "106.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "103.0.0.1", "106.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "104.0.0.1", "106.0.0.1", 10),
                        "10 packets transmitted")
        should_contains(do_ping(connection, "105.0.0.1", "106.0.0.1", 10),
                        "10 packets transmitted")


if __name__ == '__main__':
    executor.main()
コード例 #4
0
				"but does not appear in the command.")
		instream = args.instream
	elif "___FILE___" in command:
		#its a mutating filename
		instream = "___FILE___"
	else:
		#default stdin
		instream = "___STDIN___"
	logger.debug("Detected input stream: %s", instream)

	#TODO start afl node, respect instream

	#maybe this isn't required? 
	#for each testcase in queue folder, run executor.main
	regression_tests = []
	for p in os.listdir(args.input_folder):
		p = os.path.join(args.input_folder, p)
		if os.path.isfile(p):
			regression_tests.append(p)

	#TODO loop
	logger.debug("Patching command: %s", command)
	command = shlex.split(command.replace("___FILE___", instream))
	logger.debug("Post patch: %s", command)
	executor.main(
		command, 
		args.corpus, 
		regression_tests[0],
		ld_var,
		instream
	)