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 2009-03-08 22:51:47 +00:00
parent db72b5ba82
commit 09e97510d8
2 changed files with 13 additions and 1 deletions

1
.todo
View File

@ -1,4 +1,3 @@
FART To-Do List FART To-Do List
=============== ===============
- Test subtractions of subtractions - Test subtractions of subtractions
- Add built-in timing around Scene::render()

View File

@ -4,6 +4,7 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
#include <sys/time.h> /* gettimeofday() */
#include <string> #include <string>
#include <map> #include <map>
#include "Scene.h" #include "Scene.h"
@ -77,5 +78,17 @@ int main(int argc, char * argv[])
Scene scene(scene_options, argv[optind]); Scene scene(scene_options, argv[optind]);
struct timeval before, after;
gettimeofday(&before, NULL); /* start timing */
scene.render(); 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;
} }