24 |
* Written by Tuomas J. Lukka |
* Written by Tuomas J. Lukka |
25 |
*/ |
*/ |
26 |
|
|
27 |
|
#include <boost/format.hpp> |
28 |
|
|
29 |
#include <vob/Debug.hxx> |
#include <vob/Debug.hxx> |
30 |
#include <vob/stats/Stats.hxx> |
#include <vob/stats/Stats.hxx> |
31 |
|
|
32 |
namespace Vob { |
namespace Vob { |
33 |
namespace Stats { |
namespace Stats { |
34 |
DBGVAR(dbg, "Stats"); |
DBGVAR(dbg, "Stats"); |
35 |
|
using boost::format; |
36 |
|
|
37 |
Statistics::Statistics() { |
Statistics::Statistics() { |
38 |
first = 0; |
first = 0; |
46 |
} |
} |
47 |
|
|
48 |
void Statistics::triggered(Collector *c) { |
void Statistics::triggered(Collector *c) { |
49 |
|
DBG(dbg) << format("Triggered: %x %d %x %x\n") |
50 |
|
% c % c->onList % first % c->next; |
51 |
if(!c->onList) { |
if(!c->onList) { |
52 |
// XXX Asserts |
// XXX Asserts |
53 |
c->next = first; |
c->next = first; |
57 |
} |
} |
58 |
|
|
59 |
void Statistics::toBeDeleted(Collector *c) { |
void Statistics::toBeDeleted(Collector *c) { |
60 |
|
DBG(dbg) << format("ToBeDeleted: %x %x\n") % first % c; |
61 |
if(c->onList) { |
if(c->onList) { |
62 |
if(first == c) |
if(first == c) |
63 |
first = c->next; |
first = c->next; |
73 |
} |
} |
74 |
} |
} |
75 |
void Statistics::clear() { |
void Statistics::clear() { |
76 |
|
DBG(dbg) << format("Clear: %x\n") % first; |
77 |
for(Collector *i = first; i != 0; i = i->next) { |
for(Collector *i = first; i != 0; i = i->next) { |
78 |
i->clear(); |
i->clear(); |
79 |
} |
} |
84 |
first = 0; |
first = 0; |
85 |
} |
} |
86 |
void Statistics::call(void *u) { |
void Statistics::call(void *u) { |
87 |
|
DBG(dbg) << format("Call: %x\n") % first; |
88 |
for(Collector *i = first; i != 0; i = i->next) { |
for(Collector *i = first; i != 0; i = i->next) { |
89 |
|
DBG(dbg) << format("Calling: %x") % i; |
90 |
i->call(u); |
i->call(u); |
91 |
} |
} |
92 |
} |
} |