diff --git a/include/proto/server.h b/include/proto/server.h index d19c6ac9f..9c1dbf7fb 100644 --- a/include/proto/server.h +++ b/include/proto/server.h @@ -64,6 +64,20 @@ void srv_dump_kws(char **out); */ void server_recalc_eweight(struct server *sv); +/* returns the current server throttle rate between 0 and 100% */ +static inline unsigned int server_throttle_rate(struct server *sv) +{ + struct proxy *px = sv->proxy; + + /* when uweight is 0, we're in soft-stop so that cannot be a slowstart, + * thus the throttle is 100%. + */ + if (!sv->uweight) + return 100; + + return 100U * (px->lbprm.wmult * sv->eweight + px->lbprm.wdiv - 1) / (px->lbprm.wdiv * sv->uweight); +} + /* * Parses weight_str and configures sv accordingly. * Returns NULL on success, error message string otherwise. diff --git a/src/dumpstats.c b/src/dumpstats.c index e23a766aa..99d16d7d8 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -2326,12 +2326,8 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in chunk_appendf(&trash, "