| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Thibaut Oprinsen | ||
| 3 | Mail : thibaut.oprinsen@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "StatManager_override.h" | ||
| 8 | #include "phoenix_check.h" | ||
| 9 | #include "Representation.h" | ||
| 10 | |||
| 11 | /// Default constructor of StatManagerOverride | ||
| 12 | 1 | StatManagerOverride::StatManagerOverride() | |
| 13 | 1 | :StatDaemonManager<DaemonBackend>() | |
| 14 | { | ||
| 15 | 1 | initialisationStatManagerOverride(); | |
| 16 | 1 | } | |
| 17 | |||
| 18 | /// Destructor of StatManagerOverride | ||
| 19 | 1 | StatManagerOverride::~StatManagerOverride(){} | |
| 20 | |||
| 21 | ///Check that the stats received are correct | ||
| 22 | 1 | size_t checkCommunicationStat(MapDaemonStat & mapStats, const PString & senderName, const PString & receiverName){ | |
| 23 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | MapDaemonStat::iterator it(mapStats.find(senderName)); |
| 24 |
4/4✓ Branch 0 (5→6) taken 1 times.
✓ Branch 2 (8→9) taken 1 times.
✓ Branch 4 (11→12) taken 1 times.
✓ Branch 6 (14→15) taken 1 times.
|
5 | phoenix_assert(it != mapStats.end()); |
| 25 |
2/2✓ Branch 0 (22→23) taken 1 times.
✓ Branch 2 (23→24) taken 1 times.
|
1 | std::map<PString, std::map<PString, VecStat>> mapStatCommunication = it->second.getMapStatCommunication(); |
| 26 |
1/1✓ Branch 0 (24→25) taken 1 times.
|
1 | std::map<PString, std::map<PString, VecStat>>::iterator statIt(mapStatCommunication.find(receiverName)); |
| 27 |
4/4✓ Branch 0 (27→28) taken 1 times.
✓ Branch 2 (30→31) taken 1 times.
✓ Branch 4 (33→34) taken 1 times.
✓ Branch 6 (36→37) taken 1 times.
|
5 | phoenix_assert(statIt != mapStatCommunication.end()); |
| 28 |
2/2✓ Branch 0 (44→45) taken 1 times.
✓ Branch 2 (45→46) taken 1 times.
|
1 | std::map<PString, VecStat>::iterator statIt2 = statIt->second.find("Shadok"); |
| 29 |
4/4✓ Branch 0 (49→50) taken 1 times.
✓ Branch 2 (52→53) taken 1 times.
✓ Branch 4 (55→56) taken 1 times.
✓ Branch 6 (59→60) taken 1 times.
|
5 | phoenix_assert(statIt2 != statIt->second.end()); |
| 30 | 1 | const VecStat & vecStat = statIt2->second; | |
| 31 |
1/1✓ Branch 0 (67→68) taken 1 times.
|
2 | return vecStat.getNbEvent().front(); |
| 32 | 1 | } | |
| 33 | |||
| 34 | ///Check that the stats received are correct | ||
| 35 | 1 | size_t checkComputingStat(MapDaemonStat & mapStats, const PString & name){ | |
| 36 |
1/1✓ Branch 0 (2→3) taken 1 times.
|
1 | MapDaemonStat::iterator it(mapStats.find(name)); |
| 37 |
4/4✓ Branch 0 (5→6) taken 1 times.
✓ Branch 2 (8→9) taken 1 times.
✓ Branch 4 (11→12) taken 1 times.
✓ Branch 6 (14→15) taken 1 times.
|
5 | phoenix_assert(it != mapStats.end()); |
| 38 |
2/2✓ Branch 0 (22→23) taken 1 times.
✓ Branch 2 (23→24) taken 1 times.
|
1 | std::map<PString, VecStat > mapStatComputing = it->second.getMapStatComputing(); |
| 39 |
2/2✓ Branch 0 (24→25) taken 1 times.
✓ Branch 2 (25→26) taken 1 times.
|
1 | std::map<PString, VecStat>::iterator statIt = mapStatComputing.find("Shadok"); |
| 40 |
4/4✓ Branch 0 (29→30) taken 1 times.
✓ Branch 2 (32→33) taken 1 times.
✓ Branch 4 (35→36) taken 1 times.
✓ Branch 6 (38→39) taken 1 times.
|
5 | phoenix_assert(statIt != mapStatComputing.end()); |
| 41 | 1 | const VecStat & vecStat = statIt->second; | |
| 42 |
1/1✓ Branch 0 (46→47) taken 1 times.
|
2 | return vecStat.getNbEvent().front(); |
| 43 | 1 | } | |
| 44 | |||
| 45 | ///@brief Wait to receive stats from the two daemons and then stop | ||
| 46 | 163 | void StatManagerOverride::extraLoopProcessing(){ | |
| 47 | // Check if stats have been received from both daemons | ||
| 48 | 163 | p_nb_stats = getStatsCount(); | |
| 49 |
2/2✓ Branch 0 (3→4) taken 1 times.
✓ Branch 1 (3→78) taken 162 times.
|
163 | if (p_nb_stats == 2){ |
| 50 |
1/1✓ Branch 0 (5→6) taken 1 times.
|
1 | MapDaemonStat mapStats = getMapDaemonStat(); |
| 51 |
4/4✓ Branch 0 (8→9) taken 1 times.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 4 (14→15) taken 1 times.
✓ Branch 6 (16→17) taken 1 times.
|
5 | phoenix_assert(mapStats.size() == 2lu); |
| 52 |
3/3✓ Branch 0 (23→24) taken 1 times.
✓ Branch 2 (24→25) taken 1 times.
✓ Branch 4 (25→26) taken 1 times.
|
1 | size_t nb_msg_recv = checkCommunicationStat(mapStats, "sender", "receiver"); |
| 53 |
6/6✓ Branch 0 (30→31) taken 1 times.
✓ Branch 2 (33→34) taken 1 times.
✓ Branch 4 (36→37) taken 1 times.
✓ Branch 6 (39→40) taken 1 times.
✓ Branch 8 (40→41) taken 1 times.
✓ Branch 10 (41→42) taken 1 times.
|
7 | phoenix_assert(phoenix_check("StatManagerOverride::extraLoopProcessing(): nb_msg_recv", nb_msg_recv, 5lu)); |
| 54 |
2/2✓ Branch 0 (50→51) taken 1 times.
✓ Branch 2 (51→52) taken 1 times.
|
1 | size_t nb_msg_computed = checkComputingStat(mapStats, "receiver"); |
| 55 |
6/6✓ Branch 0 (55→56) taken 1 times.
✓ Branch 2 (58→59) taken 1 times.
✓ Branch 4 (61→62) taken 1 times.
✓ Branch 6 (64→65) taken 1 times.
✓ Branch 8 (65→66) taken 1 times.
✓ Branch 10 (66→67) taken 1 times.
|
7 | phoenix_assert(phoenix_check("StatManagerOverride::extraLoopProcessing(): nb_msg_computed", nb_msg_computed, 5lu)); |
| 56 |
1/1✓ Branch 0 (75→76) taken 1 times.
|
1 | stop(); |
| 57 |
1/2✗ Branch 0 (78→79) not taken.
✓ Branch 1 (78→96) taken 162 times.
|
163 | }else if(p_nb_stats > 2){ |
| 58 | ✗ | phoenix_assert(false); | |
| 59 | } | ||
| 60 | 163 | } | |
| 61 | |||
| 62 | ///@brief Initialise member variables | ||
| 63 | 1 | void StatManagerOverride::initialisationStatManagerOverride(){ | |
| 64 | 1 | p_nb_stats = 0; | |
| 65 | 1 | } | |
| 66 | |||
| 67 |