From: Joel Rosdahl Date: Mon, 16 Aug 2021 19:17:16 +0000 (+0200) Subject: feat(tracing): Add more trace points X-Git-Tag: v4.4~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=923b71c290cfebad6aa0546c208a6a4025092b52;p=thirdparty%2Fccache.git feat(tracing): Add more trace points --- diff --git a/src/ccache.cpp b/src/ccache.cpp index bc52fee62..1d73e4dc0 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -2194,6 +2194,7 @@ do_cache_compilation(Context& ctx, const char* const* argv) result_key = *digest; if (ctx.config.direct_mode()) { ASSERT(manifest_key); + MTR_SCOPE("cache", "update_manifest"); update_manifest_file(ctx, *manifest_key, *result_key); } diff --git a/src/storage/Storage.cpp b/src/storage/Storage.cpp index 85c0a6da9..7c2d0dff8 100644 --- a/src/storage/Storage.cpp +++ b/src/storage/Storage.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -229,6 +230,8 @@ Storage::finalize() nonstd::optional Storage::get(const Digest& key, const core::CacheEntryType type) { + MTR_SCOPE("storage", "get"); + const auto path = primary.get(key, type); primary.increment_statistic(path ? core::Statistic::primary_storage_hit : core::Statistic::primary_storage_miss); @@ -290,6 +293,8 @@ Storage::put(const Digest& key, const core::CacheEntryType type, const storage::EntryWriter& entry_writer) { + MTR_SCOPE("storage", "put"); + const auto path = primary.put(key, type, entry_writer); if (!path) { return false; @@ -318,6 +323,8 @@ Storage::put(const Digest& key, void Storage::remove(const Digest& key, const core::CacheEntryType type) { + MTR_SCOPE("storage", "remove"); + primary.remove(key, type); remove_from_secondary_storage(key); } @@ -452,6 +459,8 @@ Storage::get_backend(SecondaryStorageEntry& entry, nonstd::optional> Storage::get_from_secondary_storage(const Digest& key) { + MTR_SCOPE("secondary_storage", "get"); + for (const auto& entry : m_secondary_storages) { auto backend = get_backend(*entry, key, "getting from", false); if (!backend) { @@ -491,6 +500,8 @@ Storage::put_in_secondary_storage(const Digest& key, const std::string& value, bool only_if_missing) { + MTR_SCOPE("secondary_storage", "put"); + for (const auto& entry : m_secondary_storages) { auto backend = get_backend(*entry, key, "putting in", true); if (!backend) { @@ -518,6 +529,8 @@ Storage::put_in_secondary_storage(const Digest& key, void Storage::remove_from_secondary_storage(const Digest& key) { + MTR_SCOPE("secondary_storage", "remove"); + for (const auto& entry : m_secondary_storages) { auto backend = get_backend(*entry, key, "removing from", true); if (!backend) { diff --git a/src/storage/primary/PrimaryStorage.cpp b/src/storage/primary/PrimaryStorage.cpp index 175285135..bbe4d53f1 100644 --- a/src/storage/primary/PrimaryStorage.cpp +++ b/src/storage/primary/PrimaryStorage.cpp @@ -181,6 +181,8 @@ PrimaryStorage::finalize() nonstd::optional PrimaryStorage::get(const Digest& key, const core::CacheEntryType type) const { + MTR_SCOPE("primary_storage", "get"); + const auto cache_file = look_up_cache_file(key, type); if (!cache_file.stat) { LOG("No {} in primary storage", key.to_string()); @@ -200,6 +202,8 @@ PrimaryStorage::put(const Digest& key, const core::CacheEntryType type, const storage::EntryWriter& entry_writer) { + MTR_SCOPE("primary_storage", "put"); + const auto cache_file = look_up_cache_file(key, type); switch (type) { case core::CacheEntryType::manifest: @@ -246,6 +250,8 @@ PrimaryStorage::put(const Digest& key, void PrimaryStorage::remove(const Digest& key, const core::CacheEntryType type) { + MTR_SCOPE("primary_storage", "remove"); + const auto cache_file = look_up_cache_file(key, type); if (cache_file.stat) { Util::unlink_safe(cache_file.path);