本文整理汇总了C++中Stopwatch::time方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::time方法的具体用法?C++ Stopwatch::time怎么用?C++ Stopwatch::time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch::time方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: walk_tree
void walk_tree()
{
static Stopwatch timer;
timer.start();
scale_factor = sqrt(2.0*pow(((double)width/(bbmax-bbmin).max()), 2.0));
vert_ls splats = sphere_tree->recurseToDepth(recursion_depth);
splats.sort(testSize);
maxSplatSize = scale_factor * (splats.front()->size - splats.back()-> size)/2.0;
fastSplats.clear();
fastSplats.reserve(splats.size());
for (vert_it it = splats.begin(); it != splats.end(); it++)
{
fastSplats.push_back(**it);
}
splatParts.clear();
splatSizes.clear();
partitionSizes(fastSplats.begin(), fastSplats.end(), 5);
splatParts.push_back(fastSplats.end());
cout << splatSizes.size() << endl;
timer.stop();
printf("Recursed to depth %u in %f seconds\n", recursion_depth, timer.time());
printf("Displaying %lu splats, with %lu sizes\n", splats.size(), splatSizes.size() );
timer.reset();
}
示例2: main
int main() {
printf("c++\n");
int n = 1001;
double maxtime = 2.0;
float a = 0.99f;
float* x = new float[n];
float* y = new float[n];
for (int i=0; i<n; ++i) x[i]=0;
x[0] = x[n/2] = x[n-1] = 1;
int nsmooth;
Stopwatch sw;
Dsp dsp;
sw.start();
for (nsmooth=0; sw.time()<maxtime; ++nsmooth)
dsp.smooth(a,x,y,n);
sw.stop();
printf("nsmooth = %d\n", nsmooth);
printf(" mean = %12.8f\n", dsp.mean(y,n));
printf(" time = %12.8f\n", sw.time());
printf(" mflops = %d\n", (int)(6.0e-6*n*nsmooth/sw.time()));
return 0;
}
示例3: doScanMatchTiming
void doScanMatchTiming(
SemiDeterministicRetriever &sdr, double &assocTotalTime, double &scanTotalTime) {
static QMutex perche;
perche.lock();
S matcher;
sdr.stopwatch.reset();
Stopwatch scanTotal;
scanTotal.start();
matcher.setRetriever(sdr);
matcher.run();
scanTotal.stop();
assocTotalTime += sdr.stopwatch.time();
scanTotalTime += scanTotal.time();
perche.unlock();
}
示例4: main
GLint main(int argc, char **argv)
{
// need this call to initialize glut/GL -- don't execute any OpenGL code before this call!
glutInit(&argc,argv);
// size and placement hints to the window system
glutInitWindowSize(width,height);
glutInitWindowPosition(10,10);
// double buffered, RGB color mode, use depth buffer
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
// create a GLUT window (not drawn until glutMainLoop() is entered)
// wid is the window ID
wid = glutCreateWindow("QSplat Implementation");
// time to register callbacks
// window size changes
glutReshapeFunc(reshape);
// keypress handling when the current window has input focus
glutKeyboardFunc(keyboard);
// mouse event handling
glutMouseFunc(mouse_button); // button press/release
glutMotionFunc(button_motion); // mouse motion w/ button down
// function to draw contents of our window --
// this is where most of your work will focus!
glutDisplayFunc(draw);
// read the input mesh
if (argc<2)
{
cout << "Use mesh name as the command line argument" << endl;
return 0;
}
ifstream ifs(argv[1]);
if (!ifs)
{
cout << "Can't open " << argv[1] << endl;
return 0;
}
Stopwatch timer;
timer.start();
read_mesh(ifs);
build_sphere_tree();
timer.stop();
printf("\nProcessed the mesh in %f seconds\n\n", timer.time() );
walk_tree();
create_menu();
// this is the event loop entry:
// take event off the queue, call the handler, repeat
glutMainLoop();
return 0;
}
示例5: LogBuffer
Ref<Image> Image::load_from_data (const Ptr<IData> data) {
static Stopwatch t;
static unsigned count = 0; ++count;
Ref<Image> loaded_image;
Shared<Buffer> buffer;
t.start();
buffer = data->buffer();
switch (buffer->mimetype()) {
case IMAGE_JPEG:
loaded_image = load_jpeg_image(data);
break;
case IMAGE_PNG:
loaded_image = load_png_image(data);
break;
//case Data::IMAGE_DDS:
// loaded_image = load_ddsimage(data);
default:
logger()->log(LOG_ERROR, "Could not load image: Unsupported image format.");
}
t.pause();
logger()->log(LOG_INFO, LogBuffer() << "*** Total time to load " << count << " images: " << t.time() << "s");
return loaded_image;
}