average estimated time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
while ( nummessage > 0)
{
// start time
ptime t1 = boost::posix_time::second_clock::local_time();
// function
Readlogs(start,incrementer,h,m_pathname);
// end time
ptime t2 = boost::posix_time::second_clock::local_time();
time_duration td = t2 - t1;
// time it takes to process 1 message
double time_for_one_message = td.total_microseconds() / 8;
// time remaining
double remaining_time = time_for_one_message * nummessage;
// display time
time_duration remaining_td(0,0,(remaining_time/1000000));
}
|
for the most part its quite accurate.
how would i take an average measurement of the process above inside the loop to make my output more stable?
sometimes it jumps from 1:00 to 0:00.
Store the last X times in a deque or circular_buffer and take the average every time.
Topic archived. No new replies allowed.