From: Joel Rosdahl Date: Thu, 10 Sep 2020 08:56:47 +0000 (+0200) Subject: Replace stats_update with incrementing counters directly X-Git-Tag: v4.0~110 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=477fe49bc5e4dcc2f331342ebf0cae531b028747;p=thirdparty%2Fccache.git Replace stats_update with incrementing counters directly --- diff --git a/src/ccache.cpp b/src/ccache.cpp index 5e0d349fb..d6370504e 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1950,11 +1950,11 @@ cache_compilation(int argc, const char* const* argv) try { Statistic statistic = do_cache_compilation(*ctx, argv); - stats_update(*ctx, statistic); + ctx->counter_updates[statistic] += 1; return EXIT_SUCCESS; } catch (const Failure& e) { if (e.statistic() != Statistic::none) { - stats_update(*ctx, e.statistic()); + ctx->counter_updates[e.statistic()] += 1; } if (e.exit_code()) { diff --git a/src/stats.cpp b/src/stats.cpp index 8b8a5a1ef..c25ebf934 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -332,14 +332,6 @@ stats_flush(Context& ctx) stats_flush_to_file(ctx.config, ctx.stats_file(), ctx.counter_updates); } -// Update a normal statistics counter. -void -stats_update(Context& ctx, Statistic statistic) -{ - assert(statistic > Statistic::none && statistic < Statistic::END); - ctx.counter_updates[statistic] += 1; -} - // Sum and display the total stats for all cache dirs. void stats_summary(const Context& ctx) diff --git a/src/stats.hpp b/src/stats.hpp index a7a13c117..b970440a9 100644 --- a/src/stats.hpp +++ b/src/stats.hpp @@ -66,7 +66,6 @@ enum class Statistic { END }; -void stats_update(Context& ctx, Statistic statistic); void stats_flush(Context& ctx); void stats_flush_to_file(const Config& config, const std::string& sfile,