1 #include "Foo_Statistics.h"
2 #include "Foo_ClientEngine.h"
5 Foo_Statistics::Foo_Statistics()
9 for (unsigned i
= 0; i
< 5; i
++)
11 this->expected_
[i
] = 0;
17 Foo_Statistics::~Foo_Statistics()
23 Foo_Statistics::init(unsigned num_clients
, unsigned num_loops
)
25 this->num_clients_
= num_clients
;
26 this->num_loops_
= num_loops
;
31 Foo_Statistics::expected(unsigned op_num
, unsigned count
)
33 this->expected_
[op_num
-1] = count
* this->num_clients_
* this->num_loops_
;
38 Foo_Statistics::actual(unsigned op_num
, unsigned count
)
40 this->actual_
[op_num
-1] += count
;
45 Foo_Statistics::actual_vs_expected()
47 for (unsigned i
= 0; i
< 5; i
++)
49 if (this->expected_
[i
] != this->actual_
[i
])
52 "Actual vs. Expected Results Failure: "
53 "op%d() expected: %d, got: %d\n",
54 i
, this->expected_
[i
], this->actual_
[i
]));
64 Foo_Statistics::total() const
68 for (unsigned i
= 0 ; i
< 5; i
++)
70 t
+= this->expected_
[i
];