From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MIGYEDuGuGDyVQAAgWs5BA (envelope-from ) for ; Thu, 03 Jun 2021 09:35:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0HDlCzuGuGBhMQAAbx9fmQ (envelope-from ) for ; Thu, 03 Jun 2021 07:35:23 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 709BD1507B for ; Thu, 3 Jun 2021 09:35:22 +0200 (CEST) Received: from localhost ([::1]:46816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lohsv-0004vb-F4 for larch@yhetil.org; Thu, 03 Jun 2021 03:35:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lohsd-0004ei-LI for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58711) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lohsd-0001ul-CO for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lohsd-0001Wj-9z for guix-patches@gnu.org; Thu, 03 Jun 2021 03:35:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48806] [PATCH 3/7] grafts: Record cache lookups for profiling. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Jun 2021 07:35:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48806 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48806@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 48806-submit@debbugs.gnu.org id=B48806.16227056855781 (code B ref 48806); Thu, 03 Jun 2021 07:35:03 +0000 Received: (at 48806) by debbugs.gnu.org; 3 Jun 2021 07:34:45 +0000 Received: from localhost ([127.0.0.1]:42011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lohsL-0001V5-CZ for submit@debbugs.gnu.org; Thu, 03 Jun 2021 03:34:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lohsJ-0001UQ-Vh for 48806@debbugs.gnu.org; Thu, 03 Jun 2021 03:34:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60212) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lohsE-0001X5-Oi; Thu, 03 Jun 2021 03:34:38 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57488 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lohsE-0005sA-BL; Thu, 03 Jun 2021 03:34:38 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 3 Jun 2021 09:33:57 +0200 Message-Id: <20210603073401.13629-3-ludo@gnu.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603073401.13629-1-ludo@gnu.org> References: <20210603073401.13629-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622705723; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=ODFl4r/uenTR6ijnRxFXr0mWT2WF1n69waHRi57n4A0=; b=qPtO2ECReiO6fODDPkLliwjqJ9+kmnhd7MhPA42iWx9M17Pwmx/p2dswTepzT+AnIX3s+i WYv786/Wel2+4HU1/8f64sQfsJ64QCESUjkD3RJWPc2XTHaRG3oNhMU1AoOLRafSNkHIWw rjAhtdMkqgQeLB2gYSEY6c1l2PK8UAI+7mM6dPv0Xhg31akC03JOyNJBU/hwkSuMtXwPbb aluWPN5BwydFREehBfcvYzKS4DjfzCni6IOzNlPAVK/jPdZWRtKLzz9TBRswOtsQ1N9xmW n3qmHrR8BVOjORLwk/fKhXapSCEOv/6eTNDZpySzTJcVIfB2t+EJj3HdGirSvg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622705723; a=rsa-sha256; cv=none; b=OG/XHcxWzyFjibFH1WF82chkYRZDYGXr9szQSV9xCb16gneYKlMF8DSHiEpq69igJie/8/ Rh6Nr1Zvc8cc8+l8vIYcNgUw6JtMp5hsexWG3Jer33tkawVuqKS4xXqdkx1D+ZmVygjsg1 Cm5462GmOwbhYI+REQ1nllu7F13JtVaGm7mwF3aTvaU1x5wVEAM5qjPtxJ+kNEoPXDTe13 7onhGGuNcS68r/gmbxRutiYzH0+vwMtoYfvLyB0n2QxaojaPYDVKFpkwZtzJiagsVFmryN V+RyKXZFEq5VuPnlsaA8qIFStlQPbuQVLWDZdV/3N9aGofm+eklYv20jCvJheQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.07 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 709BD1507B X-Spam-Score: 2.07 X-Migadu-Scanner: scn1.migadu.com X-TUID: ikZBNYKKQSBV * 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