From 61d1fbcc8c193568b4a7728d25be565ac761ea6f Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Wed, 17 Oct 2018 12:47:16 +0200 Subject: [PATCH] pipelimit: allow to disable fetching cpu and network load - prevent usage of high cpu when related algoritms are not used - can be controlled via load_fetch parameter - GH #1675 --- src/modules/pipelimit/pipelimit.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/pipelimit/pipelimit.c b/src/modules/pipelimit/pipelimit.c index 7aff8219304..46e3a45b7ee 100644 --- a/src/modules/pipelimit/pipelimit.c +++ b/src/modules/pipelimit/pipelimit.c @@ -113,6 +113,7 @@ static int pl_timer_mode = 0; int _pl_cfg_setpoint = 0; /* desired load, used when reading modparams */ /* === */ +static int pl_load_fetch = 1; /** module functions */ static int mod_init(void); @@ -150,6 +151,7 @@ static param_export_t params[]={ {"plp_limit_column", PARAM_STR, &rlp_limit_col}, {"plp_algorithm_column", PARAM_STR, &rlp_algorithm_col}, {"hash_size", INT_PARAM, &pl_hash_size}, + {"load_fetch", INT_PARAM, &pl_load_fetch}, {0,0,0} }; @@ -727,13 +729,15 @@ static int fixup_pl_check3(void** param, int param_no) static void pl_timer_refresh(void) { - switch (*load_source) { - case LOAD_SOURCE_CPU: - update_cpu_load(); - break; - } + if(pl_load_fetch!=0) { + switch (*load_source) { + case LOAD_SOURCE_CPU: + update_cpu_load(); + break; + } - *network_load_value = get_total_bytes_waiting(); + *network_load_value = get_total_bytes_waiting(); + } pl_pipe_timer_update(pl_timer_interval, *network_load_value); }