[PATCH] glretrace: Don't busy-wait when given the -w option.
Carl Worth
cworth at cworth.org
Wed Sep 5 10:06:58 PDT 2012
It's really not kind to burn 100% of a CPU core just to wait for the
user to get around to pressing a key.
---
Has glretrace really always had this bug? It seems odd that I didn't
notice it before.
Meanwhile, I imagine that usleep() here isn't quite the right
answer. At least, I imagine that we'll want an os::usleep() along with
corresponding code for Windows, (though I don't know what that would
be).
An alternate solution would be to add a new glws function that could
block until an event is ready. That would avoid the need for the
arbitrary sleep time here.
retrace/glretrace_main.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
index e3db0ba..329a14a 100755
--- a/retrace/glretrace_main.cpp
+++ b/retrace/glretrace_main.cpp
@@ -25,6 +25,7 @@
#include <string.h>
+#include <unistd.h>
#include "retrace.hpp"
#include "glproc.hpp"
@@ -437,6 +438,7 @@ retrace::flushRendering(void) {
void
retrace::waitForInput(void) {
while (glws::processEvents()) {
+ usleep(100000);
}
}
--
1.7.10
More information about the apitrace
mailing list