本文整理汇总了C++中ACE_High_Res_Timer::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_High_Res_Timer::reset方法的具体用法?C++ ACE_High_Res_Timer::reset怎么用?C++ ACE_High_Res_Timer::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_High_Res_Timer
的用法示例。
在下文中一共展示了ACE_High_Res_Timer::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: svc
int MyTask::svc (void)
{
ACE_hthread_t thr_handle;
ACE_Thread::self (thr_handle);
ACE_DEBUG ((LM_DEBUG, "(%t|%T): task activated\n"));
ACE_ASSERT (dispatcher_ != 0);
(void) dispatcher_->schedule (guid_, qos_);
barrier_.wait ();
long prime_number = 9619899;
ACE_High_Res_Timer timer;
ACE_Time_Value elapsed_time;
ACE_Time_Value seconds_tracker(0,0);
ACE_Time_Value one_second (1,0);
ACE_Time_Value compute_count_down_time (exec_duration_, 0);
ACE_Countdown_Time compute_count_down (&compute_count_down_time);
timer.start ();
while (compute_count_down_time > ACE_Time_Value::zero)
{
ACE::is_prime (prime_number,
2,
prime_number / 2);
compute_count_down.update ();
timer.stop ();
timer.elapsed_time (elapsed_time);
seconds_tracker += elapsed_time;
if (seconds_tracker >= one_second)
{
seconds_tracker.set (0,0);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) Currently running guid=%d")
ACE_TEXT (", qos_.importance=%d\n"),
guid_, qos_.importance_));
}
timer.reset ();
timer.start ();
}
dispatcher_->cancel_schedule (this->guid_);
return 0;
}
示例2: allocator
static int
speed_test (ACE_UINT32 loops)
{
double tt = 0.0,
ut = 0.0,
utus = 0.0,
speed = 0.0;
ACE_Time_Value tc;
void *ptr = 0;
ACE_UINT32 i = loops;
size_t n_chunks = 10;
size_t chunk_size = 8;
ACE_DEBUG ((LM_INFO,
ACE_TEXT (" (%t) ACE_Dynamic_Cached_Allocator ")
ACE_TEXT ("speed test...\n")));
DYNAMIC_ALLOCATOR allocator (n_chunks, chunk_size);
ACE_High_Res_Timer timer;
timer.reset ();
timer.start ();
while (i--)
{
ptr = allocator.malloc (chunk_size);
allocator.free (ptr);
}
timer.stop ();
timer.elapsed_time (tc);
ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Iterations : %d\n"), loops));
tt = tc.sec () + tc.usec ()*1.0e-6;
ut = tt/loops;
utus = ut*1.0e6;
speed = loops/tt;
ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Total time : %.6g [s]\n"), tt));
ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Unit time : %.6g [us]\n"), utus));
ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Speed : %.6g [1/s]\n"), speed));
return 0;
}