[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#48806] [PATCH 3/7] grafts: Record cache lookups for profiling.
From: |
Ludovic Courtès |
Subject: |
[bug#48806] [PATCH 3/7] grafts: Record cache lookups for profiling. |
Date: |
Thu, 3 Jun 2021 09:33:57 +0200 |
* guix/grafts.scm (record-cache-lookup!): New procedure.
(with-cache): Use it.
---
guix/grafts.scm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/guix/grafts.scm b/guix/grafts.scm
index fd8a108092..dff3d75b8b 100644
--- a/guix/grafts.scm
+++ b/guix/grafts.scm
@@ -172,10 +172,16 @@ references."
items))))
(remove (cut member <> self) refs)))
+(define record-cache-lookup!
+ (cache-lookup-recorder "derivation-graft-cache"
+ "Derivation graft cache"))
+
(define-syntax-rule (with-cache key exp ...)
"Cache the value of monadic expression EXP under KEY."
- (mlet %state-monad ((cache (current-state)))
- (match (vhash-assoc key cache)
+ (mlet* %state-monad ((cache (current-state))
+ (result -> (vhash-assoc key cache)))
+ (record-cache-lookup! result cache)
+ (match result
((_ . result) ;cache hit
(return result))
(#f ;cache miss
--
2.31.1
- [bug#48806] [PATCH 0/7] Generalized cache support and improved graft caching, Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 1/7] store: Support dynamic allocation of per-connection caches., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 2/7] store: Generalize cache lookup recording., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 3/7] grafts: Record cache lookups for profiling.,
Ludovic Courtès <=
- [bug#48806] [PATCH 5/7] store: Remove 'references/substitutes'., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 6/7] store: 'references/cached' now uses a per-session cache., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 4/7] grafts: Use SRFI-71 instead of SRFI-11., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 7/7] grafts: Cache the derivation/graft mapping for the whole session., Ludovic Courtès, 2021/06/03
- [bug#48806] [PATCH 0/7] Generalized cache support and improved graft caching, Lars-Dominik Braun, 2021/06/03