本文整理汇总了C++中SimpleTimer::ElapsedMilliseconds方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleTimer::ElapsedMilliseconds方法的具体用法?C++ SimpleTimer::ElapsedMilliseconds怎么用?C++ SimpleTimer::ElapsedMilliseconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTimer
的用法示例。
在下文中一共展示了SimpleTimer::ElapsedMilliseconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTest
void doTest(const int numThreads, std::thread* threads, const bool stest, const bool locking)
{
iterations = 1;
do
{
SimpleTimer timer;
timer.Start();
//initialize testing threads, then wait for all threads to finish
if(stest)
{
for(int i = 0; i < numThreads; ++i)
{
threads[i] = std::thread(StackSThread);
}
}
else
{
for(int i = 0; i < numThreads; ++i)
{
threads[i] = std::thread(StackTThread);
}
}
for(int i = 0; i < numThreads; ++i)
{
threads[i].join();
}
timer.Stop();
while(!stack->IsEmpty())
{
delete (stack->Pop());
}
std::cout << (locking ? "Locking " : "LockFree ") << (stest ? "STest " : "TTest ") <<
iterations << " inner iterations with " <<
numThreads << " threads: " << timer.ElapsedMilliseconds() << std::endl;
std::ofstream outfile;
outfile.open(OUTPUT_FILE, std::ios_base::app);
outfile << (locking ? "L," : "F,") << (stest ? "S," : "T,") << iterations << "," << numThreads << "," << timer.ElapsedMilliseconds() << std::endl;
outfile.close();
iterations = iterations << 1;
}
while(iterations < MAX_INNER_ITERATIONS);
}