本文整理汇总了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;
}
}