]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Print statistics IDs instead of descriptions to debug log
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 15 Aug 2021 19:41:03 +0000 (21:41 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 16 Aug 2021 18:12:03 +0000 (20:12 +0200)
This is in preparation for future statistics counters that won’t have
human-readable descriptions. (The statistics IDs are human-readable
enough.)

src/ccache.cpp
src/core/Statistics.cpp
src/core/Statistics.hpp
test/suites/base.bash
unittest/test_core_Statistics.cpp

index 309a7f91c7d963c015f898736e25d58231943167..8eec88487109d2d985696845b7136cea47a6ca39 100644 (file)
@@ -1856,7 +1856,7 @@ log_result_to_debug_log(Context& ctx)
   }
 
   core::Statistics statistics(ctx.storage.primary.get_statistics_updates());
-  for (const auto& message : statistics.get_statistics_messages()) {
+  for (const auto& message : statistics.get_statistics_ids()) {
     LOG("Result: {}", message);
   }
 }
index 04f67897df9755da605fd90783355e6911bb21be..10ad98d1a0f0576fc81a04536cf41783368ac1d5 100644 (file)
@@ -189,12 +189,6 @@ Statistics::get_statistics_ids() const
   return get_statistics_fields(m_counters, true);
 }
 
-std::vector<std::string>
-Statistics::get_statistics_messages() const
-{
-  return get_statistics_fields(m_counters, false);
-}
-
 std::string
 Statistics::format_config_header(const Config& config)
 {
index 39ccbbe28bdbb84c3e9e91dc87b5bf05041486a5..568023be02eb810fd84dc1758f9cade517981d77 100644 (file)
@@ -36,9 +36,6 @@ public:
   // Return machine-readable strings representing the statistics counters.
   std::vector<std::string> get_statistics_ids() const;
 
-  // Return human-readable strings representing the statistics counters.
-  std::vector<std::string> get_statistics_messages() const;
-
   // Format config header in human-readable format.
   static std::string format_config_header(const Config& config);
 
index 61a854b58d04661b6e9d32b45e4672b5878741eb..a9839009d526160e13eab3e2ab287b1b247d5454 100644 (file)
@@ -374,7 +374,7 @@ fi
     TEST "CCACHE_DEBUGDIR"
 
     CCACHE_DEBUG=1 CCACHE_DEBUGDIR=debugdir $CCACHE_COMPILE -c test1.c
-    expect_contains debugdir"$(pwd -P)"/test1.o.ccache-log "Result: cache miss"
+    expect_contains debugdir"$(pwd -P)"/test1.o.ccache-log "Result: cache_miss"
 
     # -------------------------------------------------------------------------
     TEST "CCACHE_DISABLE"
index 2a8620e98987d70476425b69131a7569e3f8e478..39262596bcab145cd0f400aafce5c2fe23230922 100644 (file)
@@ -47,19 +47,4 @@ TEST_CASE("get_statistics_ids")
   CHECK(Statistics(counters).get_statistics_ids() == expected);
 }
 
-TEST_CASE("get_statistics_messages")
-{
-  TestContext test_context;
-
-  StatisticsCounters counters;
-  counters.increment(Statistic::cache_size_kibibyte);
-  counters.increment(Statistic::cache_miss);
-  counters.increment(Statistic::direct_cache_hit);
-  counters.increment(Statistic::autoconf_test);
-
-  std::vector<std::string> expected = {
-    "autoconf compile/link", "cache hit (direct)", "cache miss"};
-  CHECK(Statistics(counters).get_statistics_messages() == expected);
-}
-
 TEST_SUITE_END();