added built-in timer around Scene::render() call

git-svn-id: svn://anubis/fart/trunk@195 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-03-08 22:51:47 +00:00
1 parent db72b5ba82
commit 09e97510d8
2 files changed
+13 -1

No files matched your search

+13
View File
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <sys/time.h> /* gettimeofday() */
#include <string>
#include <map>
#include "Scene.h"
@@ -77,5 +78,17 @@ int main(int argc, char * argv[])
Scene scene(scene_options, argv[optind]);
struct timeval before, after;
gettimeofday(&before, NULL); /* start timing */
scene.render();
gettimeofday(&after, NULL); /* stop timing */
double time_before = before.tv_sec + before.tv_usec / 1000000.0;
double time_after = after.tv_sec + after.tv_usec / 1000000.0;
double diff = time_after - time_before;
cout << "Elapsed time: " << diff << " seconds." << endl;
return 0;
}