aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/speedometer.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/tests/speedometer.cpp b/src/tests/speedometer.cpp
new file mode 100644
index 0000000..4532f59
--- /dev/null
+++ b/src/tests/speedometer.cpp
@@ -0,0 +1,51 @@
1#include <bu/sio.h>
2#include <bu/speedometer.h>
3#include <bu/thread.h>
4
5#include <unistd.h>
6
7class Report : public Bu::Thread
8{
9public:
10 Report() :
11 sKeys( 500, 8 )
12 {
13 }
14
15 ~Report()
16 {
17 }
18
19 Bu::Speedometer sKeys;
20 bool bRunning;
21
22protected:
23 virtual void run()
24 {
25 bRunning = true;
26 while( bRunning )
27 {
28 usleep( 500000 );
29// Bu::println("Speed: %1 - %2 k/s").arg( sKeys.getTotalEvents() ).
30// arg( sKeys.getSpeed() );
31 }
32 }
33};
34
35int main( int argc, char *argv[] )
36{
37 Report r;
38
39 r.start();
40
41 for(;;)
42 {
43 getchar();
44 r.sKeys.addEvent();
45 r.sKeys.debug();
46 }
47
48
49 return 0;
50}
51