aboutsummaryrefslogtreecommitdiff
path: root/src/tests/speedometer.cpp
blob: 4532f597fefba195cc85fe5732cda2f387ba4884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <bu/sio.h>
#include <bu/speedometer.h>
#include <bu/thread.h>

#include <unistd.h>

class Report : public Bu::Thread
{
public:
    Report() :
        sKeys( 500, 8 )
    {
    }

    ~Report()
    {
    }

    Bu::Speedometer sKeys;
    bool bRunning;

protected:
    virtual void run()
    {
        bRunning = true;
        while( bRunning )
        {
            usleep( 500000 );
//            Bu::println("Speed: %1 - %2 k/s").arg( sKeys.getTotalEvents() ).
//                arg( sKeys.getSpeed() );
        }
    }
};

int main( int argc, char *argv[] )
{
    Report r;

    r.start();

    for(;;)
    {
        getchar();
        r.sKeys.addEvent();
        r.sKeys.debug();
    }


    return 0;
}