[2] | 1 | #ifdef STATISTICS |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Generic/Group/include/Statistics.h" |
---|
| 10 | #include "Behavioural/src/Statistics_test_if_save.cpp" |
---|
| 11 | #include "Behavioural/src/Statistics_save.cpp" |
---|
| 12 | #include <sstream> |
---|
| 13 | using namespace std; |
---|
| 14 | |
---|
| 15 | namespace morpheo { |
---|
| 16 | namespace behavioural { |
---|
| 17 | namespace generic { |
---|
| 18 | namespace group { |
---|
| 19 | |
---|
| 20 | // Explicite instanciation |
---|
| 21 | template void behavioural::Statistics::test_if_save<behavioural::generic::group::Counters, |
---|
| 22 | behavioural::generic::group::Parameters> |
---|
| 23 | (behavioural::generic::group::Counters ** &, |
---|
| 24 | behavioural::generic::group::Parameters); |
---|
| 25 | |
---|
| 26 | template void behavioural::Statistics::save <behavioural::generic::group::Counters, |
---|
| 27 | behavioural::generic::group::Parameters> |
---|
| 28 | (behavioural::generic::group::Counters ** &, |
---|
| 29 | behavioural::generic::group::Parameters); |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | void Statistics::add (uint32_t nb_use) |
---|
| 33 | { |
---|
| 34 | test_if_save<Counters,Parameters>(_counters,_parameters); |
---|
| 35 | |
---|
| 36 | if (_nb_statistics>0) |
---|
| 37 | { |
---|
| 38 | int i = _nb_statistics-1; |
---|
| 39 | _counters[i]->_nb_use += nb_use; |
---|
| 40 | |
---|
| 41 | if (nb_use == 0) |
---|
| 42 | _counters[i]->_nb_cycle_none_use ++; |
---|
| 43 | else |
---|
| 44 | if (nb_use == _parameters._nb_elt) |
---|
| 45 | _counters[i]->_nb_cycle_full_use ++; |
---|
| 46 | else |
---|
| 47 | _counters[i]->_nb_cycle_normal_use ++; |
---|
| 48 | } |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | }; // end namespace group |
---|
| 52 | }; // end namespace generic |
---|
| 53 | }; // end namespace behavioural |
---|
| 54 | }; // end namespace morpheo |
---|
| 55 | #endif |
---|