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


C++ TIMER::check_timers_off方法代码示例

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


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

示例1: execute

	virtual void execute(TIMER& timer){

		mpi_reduce_timers(timer); // Reduce timers to server master.

		// Print from the server master.
		if (SIPMPIAttr::get_instance().is_company_master()){

			std::cout << "Timers for Program " << GlobalState::get_program_name() << std::endl;

			long long * timers = timer.get_timers();
			long long * timer_counts = timer.get_timer_count();
			const int LW = 10;	// Line num
			const int CW = 15;	// Time
			const int SW = 20;	// String

			assert(timer.check_timers_off());
			std::cout<<"Timers"<<std::endl
				<<std::setw(LW)<<std::left<<"Line"
				<<std::setw(SW)<<std::left<<"Type"
				<<std::setw(CW)<<std::left<<"Avg"
				<<std::setw(CW)<<std::left<<"AvgBlkWait"
				<<std::setw(CW)<<std::left<<"AvgDiskRead"
				<<std::setw(CW)<<std::left<<"AvgDiskWrite"
				<<std::setw(CW)<<std::left<<"Tot"
				<<std::endl;

			for (int i=1; i<sialx_lines_; i++){

				int tot_time_offset = i + static_cast<int>(ServerTimer::TOTALTIME) * sialx_lines_;
				if (timer_counts[tot_time_offset] > 0L){
					double tot_time = timer.to_seconds(timers[tot_time_offset]);	// Microsecond to second
					double avg_time = tot_time / timer_counts[tot_time_offset];

					double tot_blk_wait = 0;
					double avg_blk_wait = 0;
					double tot_disk_read = 0;
					double avg_disk_read = 0;
					double tot_disk_write = 0;
					double avg_disk_write = 0;

					int blk_wait_offset = i + static_cast<int>(ServerTimer::BLOCKWAITTIME) * sialx_lines_;
					if (timer_counts[blk_wait_offset] > 0L){
						tot_blk_wait = timer.to_seconds(timers[blk_wait_offset]);
						avg_blk_wait = tot_blk_wait / timer_counts[blk_wait_offset];
					}

					int read_timer_offset = i + static_cast<int>(ServerTimer::READTIME) * sialx_lines_;
					if (timer_counts[read_timer_offset] > 0L){
						tot_disk_read = timer.to_seconds(timers[read_timer_offset]);
						avg_disk_read = tot_disk_read / timer_counts[read_timer_offset];
					}

					int write_timer_offset = i + static_cast<int>(ServerTimer::WRITETIME) * sialx_lines_;
					if (timer_counts[write_timer_offset] > 0L){
						tot_disk_write = timer.to_seconds(timers[write_timer_offset]);
						avg_disk_write = tot_disk_write / timer_counts[write_timer_offset];
					}

					std::cout<<std::setw(LW)<<std::left << i
							<< std::setw(SW)<< std::left << line_to_str_.at(i)
							<< std::setw(CW)<< std::left << avg_time
							<< std::setw(CW)<< std::left << avg_blk_wait
							<< std::setw(CW)<< std::left << avg_disk_read
							<< std::setw(CW)<< std::left << avg_disk_write
							<< std::setw(CW)<< std::left << tot_time
							<< std::endl;
				}
			}
			std::cout<<std::endl;
		}
	}
开发者ID:BB-Goldstein,项目名称:aces4,代码行数:71,代码来源:server_timer.cpp


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