MTR_END("main", "find_compiler");
const auto result = do_cache_compilation(ctx, argv);
- const auto& counters = result ? *result : result.error().counters();
- ctx.storage.local.increment_statistics(counters);
+ ctx.storage.local.increment_statistics(result ? *result
+ : result.error().counters());
+ const auto& counters = ctx.storage.local.get_statistics_updates();
+
+ if (counters.get(Statistic::cache_miss) > 0) {
+ if (!ctx.config.remote_only()) {
+ ctx.storage.local.increment_statistic(Statistic::local_storage_miss);
+ }
+ if (ctx.storage.has_remote_storage()) {
+ ctx.storage.local.increment_statistic(Statistic::remote_storage_miss);
+ }
+ } else if ((counters.get(Statistic::direct_cache_hit) > 0
+ || counters.get(Statistic::preprocessed_cache_hit) > 0)
+ && counters.get(Statistic::remote_storage_hit) > 0
+ && !ctx.config.remote_only()) {
+ ctx.storage.local.increment_statistic(Statistic::local_storage_miss);
+ }
+
if (!result) {
if (result.error().exit_code()) {
return *result.error().exit_code();
backend->url_for_logging,
ms);
local.increment_statistic(core::Statistic::remote_storage_read_miss);
- if (type == core::CacheEntryType::result) {
- local.increment_statistic(core::Statistic::remote_storage_miss);
- } else if (m_config.depend_mode()) {
- // With the depend mode enabled, a missing manifest means that we can't
- // even try to look up a result, so note the miss already now.
- ASSERT(type == core::CacheEntryType::manifest);
- local.increment_statistic(core::Statistic::remote_storage_miss);
- }
}
}
}
increment_statistic(return_value ? core::Statistic::local_storage_read_hit
: core::Statistic::local_storage_read_miss);
- if (type == core::CacheEntryType::result) {
- increment_statistic(return_value ? core::Statistic::local_storage_hit
- : core::Statistic::local_storage_miss);
- } else if (m_config.depend_mode() && !return_value) {
- // With the depend mode enabled, a missing manifest means that we can't even
- // try to look up a result, so note the miss already now.
- ASSERT(type == core::CacheEntryType::manifest);
- increment_statistic(core::Statistic::local_storage_miss);
+ if (return_value && type == core::CacheEntryType::result) {
+ increment_statistic(core::Statistic::local_storage_hit);
}
return return_value;
unset CCACHE_NODIRECT
export CCACHE_REMOTE_STORAGE="file:$PWD/remote"
- generate_code 1 test.c
+ touch test.h
+ echo '#include "test.h"' >test.c
+ backdate test.h
}
SUITE_remote_file() {
expect_stat direct_cache_hit 2
expect_stat cache_miss 1
expect_stat local_storage_hit 1
- expect_stat local_storage_miss 3
+ expect_stat local_storage_miss 2
expect_stat local_storage_read_hit 2
expect_stat local_storage_read_miss 3
expect_stat local_storage_write 4
expect_stat remote_storage_read_miss 1
expect_stat remote_storage_write 2 # result + manifest
+ # Remote cache read hit for the manifest but no manifest entry matches.
+ $CCACHE -C >/dev/null
+ echo 'int x;' >>test.h
+ backdate test.h
+ $CCACHE_COMPILE -MMD -c test.c
+ expect_stat direct_cache_hit 2
+ expect_stat cache_miss 2
+ expect_stat local_storage_hit 1
+ expect_stat local_storage_miss 3
+ expect_stat local_storage_read_hit 2
+ expect_stat local_storage_read_miss 4 # one manifest read miss
+ expect_stat local_storage_write 7 # download+store manifest, update+store manifest, write result
+ expect_stat remote_storage_hit 1
+ expect_stat remote_storage_miss 2
+ expect_stat remote_storage_read_hit 3
+ expect_stat remote_storage_read_miss 1 # original manifest didn't match -> no read
+ expect_stat remote_storage_write 4
+
# -------------------------------------------------------------------------
TEST "umask"