Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / performance-tests / CSD_Strategy / TestServant / Foo_Statistics.cpp
blob043d87e48f5e930d5eb41d9dbddc10e6443093b7
1 #include "Foo_Statistics.h"
2 #include "Foo_ClientEngine.h"
5 Foo_Statistics::Foo_Statistics()
6 : num_clients_(0),
7 num_loops_(0)
9 for (unsigned i = 0; i < 5; i++)
11 this->expected_[i] = 0;
12 this->actual_[i] = 0;
17 Foo_Statistics::~Foo_Statistics()
22 void
23 Foo_Statistics::init(unsigned num_clients, unsigned num_loops)
25 this->num_clients_ = num_clients;
26 this->num_loops_ = num_loops;
30 void
31 Foo_Statistics::expected(unsigned op_num, unsigned count)
33 this->expected_[op_num-1] = count * this->num_clients_ * this->num_loops_;
37 void
38 Foo_Statistics::actual(unsigned op_num, unsigned count)
40 this->actual_[op_num-1] += count;
44 bool
45 Foo_Statistics::actual_vs_expected()
47 for (unsigned i = 0; i < 5; i++)
49 if (this->expected_[i] != this->actual_[i])
51 ACE_DEBUG((LM_DEBUG,
52 "Actual vs. Expected Results Failure: "
53 "op%d() expected: %d, got: %d\n",
54 i, this->expected_[i], this->actual_[i]));
55 return false;
59 return true;
63 unsigned
64 Foo_Statistics::total() const
66 unsigned t = 0;
68 for (unsigned i = 0 ; i < 5; i++)
70 t += this->expected_[i];
73 return t;