vector<Thread*> File_System_With_Noise::generate() {

	long log_space_per_thread = max_lba / 4;
	long max_file_size = log_space_per_thread / 8;

	Simple_Thread* seq = new Asynchronous_Sequential_Writer(0, log_space_per_thread * 2);

	Simple_Thread* t1 = new Asynchronous_Random_Writer(0, log_space_per_thread * 2, 35722);
	Simple_Thread* t2 = new Asynchronous_Random_Reader(0, log_space_per_thread * 2, 3456);
	Thread* t3 = new File_Manager(log_space_per_thread * 2 + 1, log_space_per_thread * 4, INFINITE, max_file_size, 713);
	//Thread* t4 = new File_Manager(log_space_per_thread * 3 + 1, log_space_per_thread * 4, INFINITE, max_file_size, 5);

	seq->add_follow_up_thread(t1);
	//seq->add_follow_up_thread(t2);
	seq->add_follow_up_thread(t3);

	vector<Thread*> threads;
	threads.push_back(seq);
	//threads.push_back(t4);

	Individual_Threads_Statistics::init();
	Individual_Threads_Statistics::register_thread(seq, "Asynchronous Sequential Writer Thread");
	Individual_Threads_Statistics::register_thread(t1, "Asynchronous Random Thread Reader");
	Individual_Threads_Statistics::register_thread(t2, "Asynchronous Random Thread Writer");
	Individual_Threads_Statistics::register_thread(t3, "File Manager 1");
	//Individual_Threads_Statistics::register_thread(t4, "File Manager 2");

	return threads;
}
Beispiel #2
0
vector<Thread*> Example_Workload::generate() {

	// This workload begins with a large sequential write of the entire logical address space.
	Simple_Thread* init_write = new Synchronous_No_Collision_Random_Writer(min_lba, max_lba, 135);
	//Simple_Thread* init_write = new Synchronous_Sequential_Writer(min_lba, max_lba);
	init_write->set_io_size(1);
	init_write->set_num_ios(NUMBER_OF_ADDRESSABLE_PAGES() * OVER_PROVISIONING_FACTOR);
	vector<Thread*> starting_threads;
	starting_threads.push_back(init_write);

	//init_write->set_num_ios(10000);

	// Once the sequential write above is finished, two threads start.
	// One performs random writes across the logical address space. The other performs random reads.
	// These workloads are synchronous. This means they operate with IO depth 1. The next IO is submitted to the IO
	// queue only once the previously subitted IO has finished.
	//
	// Each thread has an array of threads that it can invoke once it has finished executing all of its IOs.
	// This allows creating sophisticated workloads in a modular fashion.
	// The method add_follow_up_thread simply makes the init_write thread invoke the two other threads once it has finished.
	// The set_num_ios method is just the number of IOs each thread submits before they stop.
	// In this case, we let the threads continue submitting IOs indefinitely.
	// Nevertheless, in the main method below, we set the number of IOs that are allowed to occur before EagleTree shuts down
	// and prints statistics.
	int seed1 = 13515;
	int seed2 = 264;
	Simple_Thread* writer = new Synchronous_Random_Writer(min_lba, max_lba, seed1);
	Simple_Thread* reader = new Synchronous_Random_Reader(min_lba, max_lba, seed2);
	init_write->add_follow_up_thread(reader);
	init_write->add_follow_up_thread(writer);
	writer->set_num_ios(INFINITE);
	reader->set_num_ios(INFINITE);

	return starting_threads;
}
vector<Thread*> Random_Workload::generate() {
	Simple_Thread* init_write = new Asynchronous_Sequential_Writer(min_lba, max_lba);
	for (int i = 0; i < num_threads; i++) {
		int seed = 23621 * i + 62;
		Simple_Thread* writer = new Synchronous_Random_Writer(min_lba, max_lba, seed);
		Simple_Thread* reader = new Synchronous_Random_Reader(min_lba, max_lba, seed * 136);
		init_write->add_follow_up_thread(reader);
		init_write->add_follow_up_thread(writer);
		writer->set_num_ios(INFINITE);
		reader->set_num_ios(INFINITE);
	}
	vector<Thread*> threads(1, init_write);
	return threads;
}