From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id qLaOIcv9wWXc9wAA62LTzQ:P1 (envelope-from ) for ; Tue, 06 Feb 2024 10:37:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id qLaOIcv9wWXc9wAA62LTzQ (envelope-from ) for ; Tue, 06 Feb 2024 10:37:15 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=E5CcDWq1; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707212235; h=from:from:sender:sender:reply-to: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:dkim-signature; bh=qFRa5hZ0urd9j2YhYhgRGC2nhzW3Et/5TupXCPBABp4=; b=sTK1MRS09lXzj2rN/7seSVSkOWEgUfqtmK/N5fVv6Np1LC2sDqNE8yTw/hdhVfxiJ9cILN tXC8sSB0YCLB5eGSfqCmYCN4eQIQIxvItze/mZO5YBxmkdWxTyVLVzkfF8yH+fNfl538lr QWum7bI+j5KsJBZp+a1GSa95V41SVQwwYpHRe9wt/ei0L1D90SkpRthMN1ABZDUG+vlpNn UYBuMod2j/qiLZs4AEkH4ETTMLBZtzxjNp+YwkiE0bC8TNmNCsGQN7B4yvCFatVI1BbSeV YRJ9dqHGgRfLB9QG3geVVLOfoNIAflxMZAL9WadBls4PZ5a/b3nX4ICccQsXWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=E5CcDWq1; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707212235; a=rsa-sha256; cv=none; b=q7jNsZebcu6YC06ZB/aeySm4KnNoPS/Cd/TH5WtRm+LJzESYgWeXKRjmlnGWDx4Oi7MARA VQRYJHBmjZMAi6hgYHVdzVp0+BnIzaKtHVB7x5P+WgyQt+girYpMbj8o5/NX2i/7W2uzgY Mv854duBd7/kKLPspO9SwNHYCHlm3Qxoi6FTmI4sw80IEp9dsGf2cz8mv2FP1STd6kFltP gjjR2pwpVudJS63tDS7n2wmUmDnpygQFpInFUmwOpesQnurkHpsIAzN/LOC2+Nb8dOUjHv ZLSvO15jHbcIr3GL/QOMK9s+PPGAhiLz9uXB1eq/NgrhMhj5XzajwmBKr4TmZQ== 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 5B86E43337 for ; Tue, 6 Feb 2024 10:37:15 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXHst-0008Rw-84; Tue, 06 Feb 2024 04:36:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXHsn-0008Nq-Qj for guix-patches@gnu.org; Tue, 06 Feb 2024 04:36:50 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXHsn-0007HD-4t; Tue, 06 Feb 2024 04:36:49 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXHsz-0006zP-NF; Tue, 06 Feb 2024 04:37:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68876] [PATCH] [PATCH maintenance] doc: guix-days-2024: Add notes from the profiling discussion. References: <20240201171315.16778-1-jonathan.brielmaier@web.de> In-Reply-To: <20240201171315.16778-1-jonathan.brielmaier@web.de> Resent-From: Adriel Dumas--Jondeau Original-Sender: "Debbugs-submit" Resent-CC: jonathan.brielmaier@web.de, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Tue, 06 Feb 2024 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68876 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68876@debbugs.gnu.org Cc: Jonathan Brielmaier , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Jonathan Brielmaier , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 68876-submit@debbugs.gnu.org id=B68876.170721220726844 (code B ref 68876); Tue, 06 Feb 2024 09:37:01 +0000 Received: (at 68876) by debbugs.gnu.org; 6 Feb 2024 09:36:47 +0000 Received: from localhost ([127.0.0.1]:53221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXHsl-0006ys-6Q for submit@debbugs.gnu.org; Tue, 06 Feb 2024 04:36:47 -0500 Received: from layka.disroot.org ([178.21.23.139]:47376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXHsf-0006yg-3j for 68876@debbugs.gnu.org; Tue, 06 Feb 2024 04:36:46 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 667F440C45 for <68876@debbugs.gnu.org>; Tue, 6 Feb 2024 10:36:26 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hqQwMNTMcSKL for <68876@debbugs.gnu.org>; Tue, 6 Feb 2024 10:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1707212185; bh=Al64pd5btgmoY2Y1NVB2qFiF5pQv6akxbMsm05r2xD4=; h=From:To:Subject:Date; b=E5CcDWq1LlaXahbfm+BwiItUQy9E8Xwuf4MB+gKFhjoCzDJdVpIXNBERfc912lDj8 5RyW6idhHOQKxCeul2G3pgJTeg+txAj1A7UpPQy7moBG4qoT36HIiAlVu65gwTNp9R 7E6dGlbGJKz4cVyg9lKWyuvcrQPxXrKOMFvQo2uI2aERZUCQR9hlXnDcjJ002cuoeO DnAelRKfz9Ku3Wpmwdbf6ON/EOh8X2RzNMTscOIklBtUvGvcrds3lJFii0dzfjXpX2 0RLg/DQdQEXk1n597pfCRz3mZ7lNhcxvo2dIKLq0s9r46WBg1p29JrPOyBJrvsClj/ zUo3mj+rWjTlQ== Date: Tue, 6 Feb 2024 10:36:11 +0100 Message-ID: <20e0abfb8d6e7c4584b2c7dea292669f1a63a29f.1707211674.git.leirda@disroot.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: , Reply-to: Adriel Dumas--Jondeau X-ACL-Warn: , Adriel Dumas--Jondeau via Guix-patches From: Adriel Dumas--Jondeau via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.67 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -6.67 X-Migadu-Queue-Id: 5B86E43337 X-TUID: g0eCQBBe0eBU Change-Id: I57abb36cbab43010f43270e626087cb2cb211c14 --- doc/guix-days-2024/profiling.md | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 doc/guix-days-2024/profiling.md Hi o/ Here are the notes (unmodified, but we now know why ~,trace~ doesn't behave the same in a ~guix repl~ than in ~guile~, as it is not the same VM used in both) we've taken during the profiling session. diff --git a/doc/guix-days-2024/profiling.md b/doc/guix-days-2024/profiling.md new file mode 100644 index 0000000000..f484a2ff3c --- /dev/null +++ b/doc/guix-days-2024/profiling.md @@ -0,0 +1,81 @@ +# What is profiling? + +- Have an idea of the execution time of part of code +- Have some kind of flame graph +- What feels slow (not necessarily what is slow) +- Where's RAM most used? + +# What should be profiled? + +- guix authenticate +- guix system/home +- guix pull +- not the compilation itself +- Guix system start time (like ~systemd-analyse~) +- Time of deployments + +# Why? + +- To be able to use Guix on low-end/older devices +- Building a package is long (because of compilation) +- Pulling is slow (because of network) +- Computing Guix derivations (guix system init/reconfigure) +- Authenticating guix commits (especially with many/big commits) + +- It's compelling (for HPC people for instance) + +- To know where there's progress to be made +- ~make~ in the Guix repo is slow so testing is not as immediate as it could be +- As small/fast finale binary as possible +- To get a feel of what specs are needed to do actual stuff + +# How? + +- Guile has ~trace~ / ~profile~ procedure that you could use on Guix procs + - How to make a flame graph from this data or any other format? +- Retrieving some metrics on demand from build systems (via ~guix build~) + - to get logs RAM/space/temporal usage during compilation +- Profiling daemons resources usage from shepherd (exposing those profiling options to users) +- Making shepherd services to profile ~guix shell --container~ + +# Starting point + +``` +$ guix repl +(guix-user)> ,use (guix scripts build) +(guix-user)> ,profile (guix-build "hello") +% cumulative self +time seconds seconds procedure + 24.00 0.16 0.16 put-string + 16.00 0.11 0.11 write + 12.00 0.11 0.08 append + 12.00 0.08 0.08 get-bytevector-n + 4.00 0.05 0.03 guix/gexp.scm:809:0:gexp-attribute + 4.00 0.03 0.03 string->utf8 + 4.00 0.03 0.03 guix/packages.scm:1969:0:package->derivation + 4.00 0.03 0.03 regexp-exec + 4.00 0.03 0.03 cons + 4.00 0.03 0.03 guix/store.scm:1426:4 + 4.00 0.03 0.03 apply-smob/1 + 4.00 0.03 0.03 sort +(guix-user)> ,trace (guix-build "hello") ; doesn't output any trace for some reason +/gnu/store/6fbh8phmp3izay6c0dpggpxhcjn4xlm5-hello-2.12.1 +(guix-user)> ^D +$ guile +(guile-user)> ,use (guix scripts build) +(guile-user)> ,trace (guix-build "hello") ; however it does work +trace: | (guix-build "hello") +trace: | | (_ (guix scripts) #:ensure #f) +trace: | | (_ #) +trace: | | | (lock-mutex #) +... +trace: | | | | | | (fileno #) +trace: | | | | | | 1 +trace: | | | | | | (bytevector->pointer@system/foreign #vu8(0 0 0 0 0 0 0 0)) +trace: | | | | | | (bytevector->pointer #vu8(0 0 0 0 0 0 0 0)) +trace: | | | | | | # +``` + +```sh +$ guix build --verbosity= --debug= +``` base-commit: a4464bd0975c811f18af98f69032b29bddda5b81 prerequisite-patch-id: cefc174692b72660bf5ed4c03442f33dbaf6e784 prerequisite-patch-id: 6b1015959d122056b883e766306b0ff8ba30bde9 prerequisite-patch-id: a3116f7908bc9fdb237e4cde52260856b083596d prerequisite-patch-id: db1d3d945579284d401944b18fcbc506a000714f prerequisite-patch-id: 84bff5e4689979f565315edf96250ccc367f8fb8 prerequisite-patch-id: bd69d4115bc86b7d2739e9890625788f1fa5a006 prerequisite-patch-id: 0834ca6f4e7f1ed91b5dcb679096a953a6e36273 prerequisite-patch-id: 9812bf7906d21768559f10f97d8363d2a18fc7e9 prerequisite-patch-id: 68e70365da7db55420105f7cb12c9fffb80d2415 -- 2.41.0