[Pkg-wmaker-commits] [wmbubble] 50/207: remove rounding error on profiling FPS calculation
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 04:18:01 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbubble.
commit 970176e4cef80e8b15727a600b40211cef0706b9
Author: Robert Jacobs <rnjacobs at mit.edu>
Date: Sat Jul 30 22:48:02 2011 -0700
remove rounding error on profiling FPS calculation
---
bubblemon.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/bubblemon.c b/bubblemon.c
index 7f62585..833ff58 100644
--- a/bubblemon.c
+++ b/bubblemon.c
@@ -50,6 +50,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
+#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
@@ -321,7 +322,7 @@ int main(int argc, char **argv) {
time_t last_time;
#endif
#if defined(PRO) && PRO > 0
- time_t start, end;
+ struct timeval start, end;
int cnt = PRO;
#endif
XEvent event;
@@ -369,7 +370,7 @@ int main(int argc, char **argv) {
make_new_bubblemon_dockapp();
#ifdef PRO
- start = time(NULL);
+ gettimeofday(&start,NULL);
#endif
while (
#ifdef PRO
@@ -464,8 +465,10 @@ int main(int argc, char **argv) {
roll_history();
}
#ifdef PRO
- end=time(NULL);
- fprintf(stderr,"%d redraws in %d seconds = %f fps\n",PRO,end-start,(float)PRO/(end-start));
+ gettimeofday(&end,NULL);
+ end.tv_sec -= start.tv_sec;
+ end.tv_usec -= start.tv_usec;
+ fprintf(stderr,"%d redraws in %f seconds = %f fps\n",PRO,end.tv_sec+end.tv_usec/1000000.0,(float)PRO/(end.tv_sec+end.tv_usec/1000000.0));
#endif
return 0;
} /* main */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbubble.git
More information about the Pkg-wmaker-commits
mailing list