X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=blobdiff_plain;f=drl%2Festimate.c;h=e55639bfd96b6bc521d809c240f50f88d87639e1;hp=ed08447b1b378413532acc2b5bf1427ae8f213d0;hb=72b9872d1025afa4e1db53b6bc0d4a00a5afd123;hpb=19bf89f36a91be2fdd4a0b6c7099f7515507e1e1 diff --git a/drl/estimate.c b/drl/estimate.c index ed08447..e55639b 100644 --- a/drl/estimate.c +++ b/drl/estimate.c @@ -20,6 +20,7 @@ static int underlimit_flowcount_count = 0; static int underlimit_normal_count = 0; +extern uint8_t system_loglevel; /** * Called for each identity each estimate interval. Uses flow table information @@ -228,8 +229,10 @@ static uint32_t allocate_fps(identity_t *ident, double total_weight) { printlog(LOG_DEBUG, "%.3f %.3f IdealUnd IdealOve\n",ideal_under,ideal_over); - printf("local_rate: %d, idealweight: %.3f, localweight: %.3f, total_weight: %.3f\n", + if (system_loglevel == LOG_DEBUG) { + printf("local_rate: %d, idealweight: %.3f, localweight: %.3f, total_weight: %.3f\n", local_rate, idealweight, ident->localweight, total_weight); + } //printf("Dampen: %d, dampen_increase: %d, peer_weights: %.3f, regime: %d\n", // dampen, dampen_increase, peer_weights, regime); @@ -260,8 +263,10 @@ static double allocate_grd(identity_t *ident, double aggdemand) { dropprob = 0.0; } - printf("local rate: %d, aggregate demand: %.3f, drop prob: %.3f\n", + if (system_loglevel == LOG_DEBUG) { + printf("local rate: %d, aggregate demand: %.3f, drop prob: %.3f\n", ident->common.rate, aggdemand, dropprob); + } return dropprob; } @@ -358,7 +363,9 @@ static void enforce(limiter_t *limiter, identity_t *ident) { ident->locallimit = limiter->nodelimit; } - printf("FPS: Setting local limit to %d\n", ident->locallimit); + if (system_loglevel == LOG_DEBUG) { + printf("FPS: Setting local limit to %d\n", ident->locallimit); + } printlog(LOG_DEBUG, "%d Limit ID:%d\n", ident->locallimit, ident->id); snprintf(cmd, CMD_BUFFER_SIZE,