summaryrefslogtreecommitdiff
path: root/ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp')
-rw-r--r--ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp b/ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp
new file mode 100644
index 00000000000..6fe6e95fcff
--- /dev/null
+++ b/ACE/TAO/performance-tests/CSD_Strategy/TestServant/Foo_Statistics.cpp
@@ -0,0 +1,75 @@
+// $Id$
+#include "Foo_Statistics.h"
+#include "Foo_ClientEngine.h"
+
+
+Foo_Statistics::Foo_Statistics()
+ : num_clients_(0),
+ num_loops_(0)
+{
+ for (unsigned i = 0; i < 5; i++)
+ {
+ this->expected_[i] = 0;
+ this->actual_[i] = 0;
+ }
+}
+
+
+Foo_Statistics::~Foo_Statistics()
+{
+}
+
+
+void
+Foo_Statistics::init(unsigned num_clients, unsigned num_loops)
+{
+ this->num_clients_ = num_clients;
+ this->num_loops_ = num_loops;
+}
+
+
+void
+Foo_Statistics::expected(unsigned op_num, unsigned count)
+{
+ this->expected_[op_num-1] = count * this->num_clients_ * this->num_loops_;
+}
+
+
+void
+Foo_Statistics::actual(unsigned op_num, unsigned count)
+{
+ this->actual_[op_num-1] += count;
+}
+
+
+bool
+Foo_Statistics::actual_vs_expected()
+{
+ for (unsigned i = 0; i < 5; i++)
+ {
+ if (this->expected_[i] != this->actual_[i])
+ {
+ ACE_DEBUG((LM_DEBUG,
+ "Actual vs. Expected Results Failure: "
+ "op%d() expected: %d, got: %d\n",
+ i, this->expected_[i], this->actual_[i]));
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+unsigned
+Foo_Statistics::total() const
+{
+ unsigned t = 0;
+
+ for (unsigned i = 0 ; i < 5; i++)
+ {
+ t += this->expected_[i];
+ }
+
+ return t;
+}