summaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authormichele papalini <micpapal@cisco.com>2020-01-22 14:26:48 +0100
committerMichele Papalini <micpapal@cisco.com>2020-01-22 13:37:59 +0000
commitf3fc65def1f771f48cc7edc26eb48de2d0096fbd (patch)
tree0dc6660729d010f5aea2b53ac7df81fd3a0545a7 /hicn-light
parent30cfeb43a0fda6ddcee3c9875bf67cbddd62b7f3 (diff)
[HICN-483] log strategy decisions using hicn-light log
Signed-off-by: michele papalini <micpapal@cisco.com> Change-Id: I70959ca8b534aea4682175cd755523201a5dc51b
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/hicn/core/logger.c1
-rw-r--r--hicn-light/src/hicn/core/logger.h1
-rw-r--r--hicn-light/src/hicn/strategies/lowLatency.c54
3 files changed, 34 insertions, 22 deletions
diff --git a/hicn-light/src/hicn/core/logger.c b/hicn-light/src/hicn/core/logger.c
index 43740f73b..0b9bb264c 100644
--- a/hicn-light/src/hicn/core/logger.c
+++ b/hicn-light/src/hicn/core/logger.c
@@ -49,6 +49,7 @@ static const struct facility_to_string {
{.facility = LoggerFacility_IO, .string = "IO"},
{.facility = LoggerFacility_Message, .string = "Message"},
{.facility = LoggerFacility_Processor, .string = "Processor"},
+ {.facility = LoggerFacility_Strategy, .string = "Strategy"},
{.facility = 0, .string = NULL}};
const char *logger_FacilityString(LoggerFacility facility) {
diff --git a/hicn-light/src/hicn/core/logger.h b/hicn-light/src/hicn/core/logger.h
index c46a87097..8ab741f40 100644
--- a/hicn-light/src/hicn/core/logger.h
+++ b/hicn-light/src/hicn/core/logger.h
@@ -50,6 +50,7 @@ typedef enum {
LoggerFacility_IO,
LoggerFacility_Processor,
LoggerFacility_Message,
+ LoggerFacility_Strategy,
LoggerFacility_END // sentinel value
} LoggerFacility;
diff --git a/hicn-light/src/hicn/strategies/lowLatency.c b/hicn-light/src/hicn/strategies/lowLatency.c
index e1d16b39d..c9e491860 100644
--- a/hicn-light/src/hicn/strategies/lowLatency.c
+++ b/hicn-light/src/hicn/strategies/lowLatency.c
@@ -434,30 +434,40 @@ static void strategyLowLatency_SelectBestFaces(StrategyLowLatency *ll,
}
NEW_ROUND:
-#if 0
- if(ll->use2paths){
- printf("use 2 paths. rtt face %d = %f queue = %f is_lossy = %d,"
- "rtt face %d = %f queue = %f is_lossy = %d\n",
- strategyNexthopStateLL_GetFaceId(ll->bestFaces[0]),
- strategyNexthopStateLL_GetRTTLive(ll->bestFaces[0]),
- strategyNexthopStateLL_GetQueuing(ll->bestFaces[0]),
- strategyNexthopStateLL_IsLossy(ll->bestFaces[0]),
- strategyNexthopStateLL_GetFaceId(ll->bestFaces[1]),
- strategyNexthopStateLL_GetRTTLive(ll->bestFaces[1]),
- strategyNexthopStateLL_GetQueuing(ll->bestFaces[1]),
- strategyNexthopStateLL_IsLossy(ll->bestFaces[1]));
- }else{
- if(ll->bestFaces[0] != NULL){
- printf("use 1 path. rtt face %d = %f is_lossy = %d (avoid multipath = %d)\n",
- strategyNexthopStateLL_GetFaceId(ll->bestFaces[0]),
- strategyNexthopStateLL_GetRTTLive(ll->bestFaces[0]),
- strategyNexthopStateLL_IsLossy(ll->bestFaces[0]),
- ll->avoid_multipath);
- }else{
- printf("no face to use!\n");
+ {
+ Logger * log = forwarder_GetLogger(ll->forwarder);
+ if(log != NULL &&
+ logger_IsLoggable(log, LoggerFacility_Strategy, PARCLogLevel_Info)){
+ if(ll->use2paths){
+ logger_Log(log, LoggerFacility_Strategy, PARCLogLevel_Info,
+ __func__, "use 2 paths. rtt face %d = %f queue = %f is_lossy = %d,"
+ "rtt face %d = %f queue = %f is_lossy = %d\n",
+ strategyNexthopStateLL_GetFaceId(ll->bestFaces[0]),
+ strategyNexthopStateLL_GetRTTLive(ll->bestFaces[0]),
+ strategyNexthopStateLL_GetQueuing(ll->bestFaces[0]),
+ strategyNexthopStateLL_IsLossy(ll->bestFaces[0]),
+ strategyNexthopStateLL_GetFaceId(ll->bestFaces[1]),
+ strategyNexthopStateLL_GetRTTLive(ll->bestFaces[1]),
+ strategyNexthopStateLL_GetQueuing(ll->bestFaces[1]),
+ strategyNexthopStateLL_IsLossy(ll->bestFaces[1]));
+ }else{
+ if(ll->bestFaces[0] != NULL){
+ logger_Log(log, LoggerFacility_Strategy,
+ PARCLogLevel_Info, __func__,
+ "use 1 path. rtt face %d = %f is_lossy = %d ",
+ "(avoid multipath = %d)\n",
+ strategyNexthopStateLL_GetFaceId(ll->bestFaces[0]),
+ strategyNexthopStateLL_GetRTTLive(ll->bestFaces[0]),
+ strategyNexthopStateLL_IsLossy(ll->bestFaces[0]),
+ ll->avoid_multipath);
+ }else{
+ logger_Log(log, LoggerFacility_Strategy, PARCLogLevel_Info,
+ __func__, "no face to use!\n");
+ }
+ }
}
}
-#endif
+
//update the round only at the end for all the faces
if(new_round){
PARCIterator * iterator = parcHashMap_CreateKeyIterator(ll->strategy_state);