当前位置: 首页>>代码示例>>C++>>正文


C++ ProjectInfo::dump方法代码示例

本文整理汇总了C++中ProjectInfo::dump方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectInfo::dump方法的具体用法?C++ ProjectInfo::dump怎么用?C++ ProjectInfo::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectInfo的用法示例。


在下文中一共展示了ProjectInfo::dump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

void MPIWorkerMaster::run()
{
	Profiler::getInstance().setEnabled(true);

	CriticalDegree degree;
	//FlightDataReader reader("c:\\basic1.txt");
	FlightDataReader reader("c:\\basic2.txt");
	//FlightDataReader reader("c:\\big1.txt");
	//FlightDataReader reader("c:\\big2.txt");

	echo(MakeString() << "Load data... (" << reader.getFileName() << ")");
	reader.open();
	reader.readHeader();

	Profiler::getInstance().start("1. Read flights data");
	// 1. Read flights data
	std::vector<Flight> flights = reader.readFlights();
	Profiler::getInstance().finish();

 	ProjectInfo projectInfo = reader.getProjectInfo();
	echo(MakeString() << "Project info: " << projectInfo.dump().str());

	//Init available slaves (if any) with project info (mSlaveQueue)
	initSlaves(projectInfo);

	// 2. Build flight paths
	// OpenMP splitted by number of flights ()
	buildFlightsPathsParallel(projectInfo, flights);

	// Calculate total number of project spaces to be processed
	int numOfTasks = calcNumberOfTasks(projectInfo);
	echo(MakeString() << "Max number of threads: " << omp_get_max_threads());		
	echo(MakeString() << "Total number of tasks: " << numOfTasks);
	echo("Processing...");

	int progress = 1;
	Profiler::getInstance().start("Process project spaces");
	ProjectSpaceBuilder builder(projectInfo, flights);
	// 3. Calculate Critical Degree
	while(builder.nextTime()) {
		ProjectSpace projectSpace = builder.build();

		// LB - Have free workers send more tasks
		if (mSlaveQueue.size() > 0) {
			sendTask(projectSpace);
		} else { 
			CriticalLevel level = executeTask(projectSpace);
			degree.addCriticalLevel(level);
		}

		collectSlaveResults(degree);

		if (progress % 10000 == 0) {
			echo (MakeString() << " Progress: " << progress);
		}
		progress++;
	}
	Profiler::getInstance().finish();

	echo("Collect results from still running slaves.");
	while(mSlaveRunningTasks > 0) {
		collectSlaveResults(degree);
	}
	sendSlavesFinishSignal();
	
	printResult(degree);
}
开发者ID:anod,项目名称:CriticalLevelCalculation,代码行数:67,代码来源:MPIWorkerMaster.cpp


注:本文中的ProjectInfo::dump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。