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


C++ Profiler::printSummary方法代码示例

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


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

示例1: measurements

void I2D_CoreFMM_AggressiveVel::solve(const Real theta, const Real inv_scaling, BlockInfo * dest, const int nblocks, VelocitySourceParticle * srcparticles, const int nparticles)
{
	Profiler profiler;
	
	_THETA = theta;
	
	tBox * rootBox=new tBox;
	tick_count start_before_tree = tick_count::now ();
	profiler.push_start("tree");
	tBoxBuilder::buildBoxes(srcparticles, nparticles, rootBox);
	profiler.pop_stop();
	
	tick_count start_before_expansions = tick_count::now ();
	profiler.push_start("expansions");
	tBoxBuilder::generateExpansions(rootBox);
	profiler.pop_stop();
	
	tick_count start_before_evaluations = tick_count::now ();
	profiler.push_start("evaluations");
	Measurements measurements (nblocks);
	VelocityEvaluator evaluator(rootBox, inv_scaling, measurements);
	evaluator.destblocks = dest;
	tbb::parallel_for(blocked_range<int>(0, nblocks), evaluator, auto_partitioner());
	profiler.pop_stop();
	tick_count end = tick_count::now ();

	if (timestamp++ % 5 == 0) profiler.printSummary();
	
	if (b_verbose) {
	
		const double tree_wallclock_time = (start_before_expansions - start_before_tree).seconds();
		const double evaluations_wallclock_time = (end - start_before_evaluations).seconds();
		const double expansions_wallclock_time = (start_before_evaluations - start_before_expansions).seconds();

		const double num_effective_interactions = (double)nparticles*nblocks*_BLOCKSIZE_*_BLOCKSIZE_;

		double effective_direct_gflops, effective_indirect_gflops, effective_total_gflops;
		double actual_direct_gflops, actual_indirect_gflops, actual_total_gflops;

		double num_direct_evals, num_indirect_evals;
		num_direct_evals = num_indirect_evals = 0;
		for (int i=0; i<nblocks; ++i) {
			num_direct_evals += (double)measurements.num_direct_evals[i];
			num_indirect_evals += (double)measurements.num_indirect_evals[i] ;
		}

		effective_direct_gflops = num_direct_evals * 11./1e9;
		actual_direct_gflops = num_direct_evals * 15./1e9;
		effective_indirect_gflops = num_indirect_evals * (16 + 14*_ORDER_) * 1./1e9;
		actual_indirect_gflops = num_indirect_evals * (20 + 14*_ORDER_) * 1./1e9;

		effective_total_gflops = effective_direct_gflops + effective_indirect_gflops;
		actual_total_gflops = actual_direct_gflops + actual_indirect_gflops;

		//Write data for break even plot
		std::fstream file;


		file.open ("measurements.txt",  std::fstream::app | std::fstream::out);
		file << setprecision (6) << scientific << num_effective_interactions << "\t" << effective_total_gflops << "\t" \
				<< actual_total_gflops << "\t" << evaluations_wallclock_time << "\t" << \
				expansions_wallclock_time << "\t" << tree_wallclock_time << "\n";
		file.close ();


	}
	delete rootBox;
}
开发者ID:BijanZarif,项目名称:MRAG-I2D,代码行数:68,代码来源:I2D_CoreFMM_AggressiveVel.cpp


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