From: Joel Rosdahl Date: Fri, 29 Jul 2016 16:24:28 +0000 (+0200) Subject: Fix regression in b81df8bf of "cache hit rate" statistics output X-Git-Tag: v3.3~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4946e771ea20790bbb97d4292700eccc1804f91;p=thirdparty%2Fccache.git Fix regression in b81df8bf of "cache hit rate" statistics output --- diff --git a/stats.c b/stats.c index 3a69ddb29..6eff3e1ec 100644 --- a/stats.c +++ b/stats.c @@ -305,15 +305,11 @@ stats_summary(struct conf *conf) printf("%8u\n", counters->data[stat]); } - unsigned direct = 0; - unsigned preprocessed = 0; - if (stat == STATS_CACHEHIT_DIR) { - direct = counters->data[stat]; - } else if (stat == STATS_CACHEHIT_CPP) { - preprocessed = counters->data[stat]; - } else if (stat == STATS_TOCACHE) { - unsigned miss = counters->data[stat]; + if (stat == STATS_TOCACHE) { + unsigned direct = counters->data[STATS_CACHEHIT_DIR]; + unsigned preprocessed = counters->data[STATS_CACHEHIT_CPP]; unsigned hit = direct + preprocessed; + unsigned miss = counters->data[STATS_TOCACHE]; unsigned total = hit + miss; double percent = total > 0 ? (100.0f * hit) / total : 0.0f; printf("cache hit rate %6.2f %%\n", percent);