From patchwork Fri Apr 11 15:29:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880172 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp825998wrq; Fri, 11 Apr 2025 08:31:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVbBDQRwmpqoUWLGDXsO57+7sXyrCs5UF3IM0jNmiN9K7sYeSkQu3mZfqDMdHkfDgjUiYXxYg==@linaro.org X-Google-Smtp-Source: AGHT+IFqdPpTc9I5cf4xQmLKu70jzp+Wzw3tio0qleQdEyC1ADEy2F/QSYZJH0tKNTVkhxFjhd7J X-Received: by 2002:a05:6102:504c:b0:4c1:76a4:aee4 with SMTP id ada2fe7eead31-4c9e4fffa38mr2198042137.19.1744385471024; Fri, 11 Apr 2025 08:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385471; cv=none; d=google.com; s=arc-20240605; b=SMcDH9kpz3W9vQghfvQpHHA4u6Pr66RhZVSCRLVQnhUnGYkx9UE3cK+c2stXJgO9JI H9IroKN/tgPm4orPLSfsNdmY6YjgyBeHick7TAzusj/26YLjxQqQCWCcuPNcA2v1OuEy y05WI011v0/afuZ3Kfh2M9gheoYXVVUAZkYO/FcvrJKeezhDEGXvPtvTET2DPlgcYvlZ 4/+mMWnpMIZquqN+gg/jhUajbSnmF1ox3mbxyPLoA3qQ68AHSce4RZSLK+clk6gdlQ02 EbuybuePPviQICrEHLVHhGcqx3xmK0IlC0hiarqF9naIwL0SHvXTfvNj/vYOmkjy1Ckj 7sHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bWUkHyYtXKAVxk5o1dsv/C0f7Tt7qzeAo8bJPCjh5jU=; fh=hXA4rjmTYcXhZQoCnIF4lWsQAax/XCvrVYdQb8XFLRc=; b=lfDOB83JWgB63DC6pITCheFFhUUTux4fMpT+bykqCMyLXUqr+IfoUQXynbVxDh2pP1 FT+UoBSgzpSc8VNKZL2xscyl4s5+96JWa8C1KargJduSxECuNO6Xl/X2ixjPyfyYxebi MvlrHG6WXPqRVkftTE5BlJ+OXgvQEpArcBDXw7lnBVMJ0Y5ql+Pc3yt5lOVz2fD6J9xt OjjscO38KMrENSwMdwXBTxC8ZGrX89iTAfNUhsPNH5ObR3xlXdJ8nQhkRV0baJhslO/8 w4BOePyNikZg2rwUTyNQZimRSmCfWtYZjWSBGp+uRaWXHaZPoPHg16aDURW4qmsFUwRU h/4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=actg2gtP; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c973d845si2432783137.38.2025.04.11.08.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=actg2gtP; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CAEF284197; Fri, 11 Apr 2025 17:30:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="actg2gtP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 679B384003; Fri, 11 Apr 2025 17:30:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 612DA840D5 for ; Fri, 11 Apr 2025 17:30:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4394a823036so21651255e9.0 for ; Fri, 11 Apr 2025 08:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385456; x=1744990256; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bWUkHyYtXKAVxk5o1dsv/C0f7Tt7qzeAo8bJPCjh5jU=; b=actg2gtPhn4mNarWET+3MAu4krBXHCHKegJzRLQo9ihTqi1F5XUFzs9anykxUxJzJg SZNyDp4zdbDD581MdWbv3pXcwwPkgvBFLHbbLCt/aM0JPn49wC+xLJqPRDv7LJjTxme7 dSLa7rwOpiuiKu5yV7eu8BWrA2H4MQ7/XUm+/xiByPyeREkvKsRSZv+D6zRl9jYevm5m e/6VGahdXTwHpWfiidAItTr/k46FI4tygcmGqEqk/KBbSH7sVFShRsX3HKXhmj4BdBLu QEkhs4sHPY/V9/7rmNb7QfoyJJrf7edwd+om5QTGHpbz/F7mEgCnY0bKrG7yXiBDeTOK 0qYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385456; x=1744990256; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWUkHyYtXKAVxk5o1dsv/C0f7Tt7qzeAo8bJPCjh5jU=; b=p1TIxQdsXF57Qf2nkg9j4SvGV4SE0N8FLpoQOzkqLcZba4+cs6XiDLTXD/G74MEtmV 30qBMtjuEslXxlUGrzSmFPcvzp6kEjCKZ1rX890M99z3cVvQR3UsOi+UMd1HvtrAoitl jGgORaW15aZ++pyW7GoNyHhh6SPqnKFCkL41JU1n5/fWIERpUPlmKbNMhhtq3zcy1Day AjuY63sJOJcxO3mv+v8DnMNfv2tqK/JOLTEFKWRUcaXITt9SQOx9HnWs3NpiqpQChOZP FgbqDw7rRtPkv3UjzDRFcTOND9GOHnnk6l3GZCWI524wgbRwHKaBCH6WLth5Cwo35Auu b2Sw== X-Gm-Message-State: AOJu0Yzl7ZSyKX7vIy78U93EhyHhGaREI4DaZt2Un590JJtifZBNbyAU QDyAlF95qmGD9ZUpOutO2QBxLI5AlBALNLhNlliBPn4qdbiXVJ5+BxSEWdEmSl/VCHdQItb6N/d NpSg= X-Gm-Gg: ASbGnctiNHoJvJ4/3MVXWYB8DEXNFA0nmeEI8RmPzt3BgECcwGAtPu4bcPxszCYfeaH dqaHh5oIRuZJ+aL9og6U+69N6lxn/1GvlMve7Pvno5+sGe6/MV+1ZJtDZJYo1mZz6ZWdCPa8zd+ 8Aq1H07V2ZKjXz5xHH3fag/oT2JdZftnKetfjbxFufmuog3kuf7zmla3Sus7dymjqRje07ysaxu hW9NPyhGabUTOLI2T/p1kIoKPot9fUzAf9mrnFpkEYfXtMEk7RkU9NHquzwSGDPVV2DYyGm7ujJ /xuHKpnhPm3TvIuZXd764DWyAdpdKq4aktCrdKimg0Vxj2oiJQ== X-Received: by 2002:a05:600c:3b19:b0:439:9e13:2dd7 with SMTP id 5b1f17b1804b1-43f3a92568amr33933585e9.2.1744385455671; Fri, 11 Apr 2025 08:30:55 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:55 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Adriano Cordova , Heinrich Schuchardt , Ilias Apalodimas , Janne Grunau , Mattijs Korpershoek , Tom Rini , Yao Zi Subject: [RFC PATCH v1 1/7] efi_loader: make efi_exit_boot_services() call bootstage_report() Date: Fri, 11 Apr 2025 17:29:27 +0200 Message-ID: <20250411153040.1772000-2-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean CONFIG_BOOTSTAGE_REPORT is currently supported in the bootm command only. Add support to the EFI boot. Signed-off-by: Jerome Forissier --- lib/efi_loader/efi_boottime.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c8d9a6037f7..96da279afd4 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -8,6 +8,7 @@ #define LOG_CATEGORY LOGC_EFI #include +#include #include #include #include @@ -2179,6 +2180,12 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, EFI_ENTRY("%p, %zx", image_handle, map_key); +#if !defined(USE_HOSTCC) +#if CONFIG_IS_ENABLED(BOOTSTAGE) + bootstage_report(); +#endif +#endif + /* Check that the caller has read the current memory map */ if (map_key != efi_memory_map_key) { ret = EFI_INVALID_PARAMETER; From patchwork Fri Apr 11 15:29:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880174 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826208wrq; Fri, 11 Apr 2025 08:31:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWXcySb3ewQ4/7P124W+kA5HVoOZcEZ1JuhxJA4WTvRIRBRD1gGDCvCUOhfvzIwb9KuEcoJxw==@linaro.org X-Google-Smtp-Source: AGHT+IF5FQYNDyoY/MTr5iyXLpHF0S7Cm4fDNdNXQw1FuBiOiKQiDpYAevVDQrrUuhtrRpBzEiWz X-Received: by 2002:a05:6122:8d1:b0:520:4fff:4c85 with SMTP id 71dfb90a1353d-527c2e94985mr2405917e0c.2.1744385489149; Fri, 11 Apr 2025 08:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385489; cv=none; d=google.com; s=arc-20240605; b=WTZI84IGkDumVNEssoNY1gc2lhEE4YFxB8X3PRFP7fGPXjDsnEzdr2iwxZ15GTmtgB gAUHGT0eKZ6sI/02CvojoD/YOdPKqZY2bthMnIkyb51qt7OTqxmo/WyE8ILukY0kAJgb w10fc35ObxWIArdD/HwLFz/Gy4TZKsk72ggZTX1C6JbDYBOcu/Qv4ssQJY3mBaN6Rgnz R+3kJtQ3QUNqq0Fj7p9uwrLodh/S4C8cGmuGNYkgHsIW4utdlpYpgBXHJP9h87V4NG8N OhgUDKdZKvApOrPU/QrjetDm5uW+BIJ/DVTzvXeHVtBeU6ZMhp/5YFzR5Hra0kuYgQ3U l3LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rZyn0Y/5DVU3ehrHBzDsZieA14VFSu1fxGrz7553hew=; fh=RXyyIoM5WKmpbEwxOK1iMsqjk8rPMAeEG5QcYeawV84=; b=cwSNrmslWLlK0Ilvm44FawWoqq/GvsJPJNDDZyvhlmhYxlYMgVl5Rv3VWWFhKRUkqv 6zRX/4JaIyBRY8iNHgfyRJwjejRxx71DJ3t04+dMACiolPYzbaEgyZIqV3SZoU145x6e TXxDUmYWpmzyPYzJX3uc0P1EdxLkzVqWbo1j2fz0mw+/zrJEDUTM0EG+W3tTJrqhKWot X5KPnLhI0EC1u6YFKhuVEYV2IBOP58pQQycKCn7wBCytkeWZoEiNsUdiRriGAzUaktnl KgTNc6c7BX8qOwihKOnEb3mDZxEE08bxEIW9vylQYScH7v3oxYXJ2BczA8YfiWuO4n1A YFrQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xUsjJT0h; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 71dfb90a1353d-527abe66781si2319336e0c.165.2025.04.11.08.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xUsjJT0h; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E0778419D; Fri, 11 Apr 2025 17:31:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="xUsjJT0h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36B7582B66; Fri, 11 Apr 2025 17:31:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7413284183 for ; Fri, 11 Apr 2025 17:30:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-43ce71582e9so17988785e9.1 for ; Fri, 11 Apr 2025 08:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385457; x=1744990257; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rZyn0Y/5DVU3ehrHBzDsZieA14VFSu1fxGrz7553hew=; b=xUsjJT0h+ZbKKcQWL/EfhnjcnTFB4fKKDS3KmeG0OdlrQS/+Ufp3IWIXGcXzafiQXb EvBSJh+IyxABdOg5xjox1DsCK3H7lbAPverTSeMP6s/izyfYCCN1ugO+311woeCqOLC7 dZpHhya1DaRMwZgJnaxoSYgj4iqSjCe9BbqFDHAEhdkx2DiaKN4EeuzX3iB66YgjewNv awaDtjqIBuDLVXQXARgTlavhEg+jLJFHmgRlwp6cIu9QrItNbj+zt/oGhJc8RkHM3WKN tVUXUTzTxn8G3NFNRiLXYzgY0dvLN9aZuOYCoqiWABC93iu4Ak7d9X/VWDW+4zTsFG3y 13Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385457; x=1744990257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rZyn0Y/5DVU3ehrHBzDsZieA14VFSu1fxGrz7553hew=; b=CAcAbn7erDA1uuoYRf1k4XrJqPBYHVEen3eBOm0Ybd/C/lfe+mFnVD7vUIYuyyr7B8 BhYAY4UP/ne9vegwXN9Iyonh05/96m+iqpgvKo0Yf2gZ8JsO5ErzL46Rpu0FUo+i6CbX EEVDNIsxl0gH++1ntNkFmJcJr5iGdQ5XHo/zezSjy+hP8uY1mJB+ndWwHZJCdzjI1dDi lx7PDJ5FqsNSVB5hjfxlpkzURWrGHXOpRKasgAZvOGzAvz/OG3eHRSQCuxNepFnv/5BE d/G9qkMcUQN6sBlVvng3pa2Xz/ENIUfqkK9lYJB+I/7IKxB4H0H2AbawxHx+ksfU31YX ZeLA== X-Gm-Message-State: AOJu0YwsCEf9u9CINZGG8jFtSiXVrBaaUQjXwd3FB9vVrkbhKHTgBfcN Ch+DKV8TKWE5q2Y9PS6Z2aKh0LfgCX39uObs49I+lrA2blAkGOUFw61zUfxMmrErIWq8BcM52hg jIbg= X-Gm-Gg: ASbGncvv/CvYMgQkf4EwtbMzPh+tVHplReVy5TM96TdPBQXjsD5kfgD1LjPkiU8RI5k dUwni4vgzOVHfQmInyBWo+fGmlwGwMFNMVMHfSAfs/iZnS+ndlA9LuPQezqW9h0r2OGZ00fSkIK kXp7fmgPFOIuR5P0gcSMDzgE6yejARGEo1qrE46eEGNhthRPnEMMRARB2OOCllkhtvgTeVCkcZn jwkT4tsCqB7W1S+mUlbraqfnLxk5P4EdkBL0xhOSfIpKcKu6cF7iJIkh/9YQLa+77DnsunuIgOg 2NvKTGVgTDj7Y9xuqQWxf2wVanXDsS5cDoCgs7Z/VyMcvZGxSe1eVzkpaXky X-Received: by 2002:a05:600c:5494:b0:43c:f050:fed3 with SMTP id 5b1f17b1804b1-43f3a93d850mr30568155e9.11.1744385456504; Fri, 11 Apr 2025 08:30:56 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:56 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Ilias Apalodimas , Jonas Karlman , Marek Vasut , Mattijs Korpershoek , Michal Simek , Peter Robinson , Richard Weinberger , Simon Glass , Tom Rini Subject: [RFC PATCH v1 2/7] bootstage: add support for reporting in JSON format Date: Fri, 11 Apr 2025 17:29:28 +0200 Message-ID: <20250411153040.1772000-3-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a new Kconfig symbol: BOOTSTAGE_REPORT_JSON to report the bootstage timing information in JSON format in addition to the human-readable text format. JSON is easier to parse by machines and represent graphically. The main goal is to be able to record boot statistics during CI in order to detect performance regressions. Signed-off-by: Jerome Forissier --- boot/Kconfig | 7 ++ common/bootstage.c | 156 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 162 insertions(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig index f101200ba7a..5e90e20141a 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1167,6 +1167,13 @@ config BOOTSTAGE_REPORT 29,916,167 26,005,792 bootm_start 30,361,327 445,160 start_kernel +config BOOTSTAGE_REPORT_JSON + bool "Display boot timing report in JSON format" + depends on BOOTSTAGE_REPORT + help + Enable output of the boot time report in JSON format in addition to + the human-readable text format. + config BOOTSTAGE_RECORD_COUNT int "Number of boot stage records to store" depends on BOOTSTAGE diff --git a/common/bootstage.c b/common/bootstage.c index 4532100acea..1ab55ecbe8f 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -11,6 +11,7 @@ #define LOG_CATEGORY LOGC_BOOT #include +#include #include #include #include @@ -19,6 +20,8 @@ #include #include #include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -324,7 +327,7 @@ int bootstage_fdt_add_report(void) } #endif -void bootstage_report(void) +static void bootstage_report_text(void) { struct bootstage_data *data = gd->bootstage; struct bootstage_record *rec = data->record; @@ -353,6 +356,157 @@ void bootstage_report(void) } } +/** + * Same as get_record_name() but with a % suffix if needed to make the name a + * a unique key. More specifically, where get_record_name() would return "foo" + * twice for two distinct records, this function would return "foo" and "foo%1". + * + * @param buf Buffer to put name if needed + * @param len Length of buffer + * @param rec Boot stage record to get the name from + * Return: pointer to name, either from the record or pointing to buf. + */ +static const char *get_unique_record_name(char *buf, int len, + const struct bootstage_record *rec) +{ + struct bootstage_data *data = gd->bootstage; + const char *name; + char tmpbuf1[20]; + char tmpbuf2[20]; + int idx = 0; + int i; + + name = get_record_name(tmpbuf1, sizeof(tmpbuf1), rec); + + /* Count records with an identical name before @rec in the array */ + for (i = 0; i < data->rec_count; i++) { + struct bootstage_record *irec = data->record + i; + const char *iname = get_record_name(tmpbuf2, sizeof(tmpbuf2), + irec); + + if (irec == rec) + break; + if (!strcmp(name, iname)) + idx++; + } + + if (idx) + snprintf(buf, len, "%s%%%d", name, idx); + else + strlcpy(buf, name, len); + + return buf; +} + +/** + * print_time_record_json() - print a time entry in JSON format for a bootstage + * record or a couple of bootstage records. + * + * The function prints "key_name": value + * + * - If @rec->start_us is non-zero, it means @rec holds accumulated time. In + * this case, key_name is the unique record name and value is @rec->time_us. + * - Otherwise, @rec represents a boot stage with an associated timestamp. The + * key name is obtained by concatenating the previous record name and the + * current record name, separated by a tilda. The value is the elapsed time + * between the two stages, that is: @rec->time_us - @prev->time_us. + * + * @rec: the record to print + * @prev: the previous timestamp record (used as a reference when @rec is a + * timestamp) + * Returns @rec if it is a timestamp, @prev otherwise + */ +static struct bootstage_record * +print_time_record_json(struct bootstage_record *rec, + struct bootstage_record *prev) +{ + char buf1[24]; + char buf2[24]; + + if (rec->start_us) { + /* An "Accumulated time" entry in the text report */ + printf("\"%s\": %lu", + get_unique_record_name(buf1, sizeof(buf1), rec), + rec->time_us); + return prev; + } + + /* Elapsed time between two consecutive stages */ + printf("\"%s~%s\": %lu", + get_unique_record_name(buf1, sizeof(buf1), prev), + get_unique_record_name(buf2, sizeof(buf2), rec), + rec->time_us - prev->time_us); + + return rec; +} + +/** + * print_env_json() - print an environment variable in JSON format + * + * @env: the variable to print + * @cont: true if a continuation comma ', ' should be printed afterwards + */ +static void print_env_json(const char *env, bool cont) +{ + char *val = env_get(env); + + printf("\"%s\": \"%s\"", env, val ? val : ""); + if (cont) + puts(", "); +} + +/** + * bootstage_report_json() - print the JSON bootstage report + */ +static void bootstage_report_json(void) +{ + struct bootstage_data *data = gd->bootstage; + struct bootstage_record *prev = data->record; + struct bootstage_record *rec = data->record; + struct bootstage_record *boot_end = NULL; + bool first = true; + int i; + + puts("=== Begin JSON bootstage report ===\n"); + puts("{ \"u_boot_version\": \"" PLAIN_VERSION "\", "); + puts("\"u_boot_date\": \"" U_BOOT_DATE "\", "); + puts("\"u_boot_time\": \"" U_BOOT_TIME "\", "); + puts("\"u_boot_tz\": \"" U_BOOT_TZ "\", "); + puts("\"env\": { "); + print_env_json("arch", 1); + print_env_json("board", 1); + print_env_json("board_name", 1); + print_env_json("cpu", 1); + print_env_json("vendor", 0); + puts(" }, \"bootstage_data\": { "); + + for (i = 1, rec++; i < data->rec_count; i++, rec++) { + if (rec->id) { + if (!rec->start_us) + boot_end = rec; + if (!first) + puts(", "); + prev = print_time_record_json(rec, prev); + first = false; + } + } + if (boot_end) + printf(", \"total\": %ld", boot_end->time_us); + + puts(" } }\n"); + puts("=== End JSON bootstage report ===\n"); +} + +/** + * bootstage_report() - print the bootstage report(s) + */ +void bootstage_report(void) +{ + bootstage_report_text(); + if (CONFIG_IS_ENABLED(BOOTSTAGE_REPORT_JSON)) + bootstage_report_json(); +} + /** * Append data to a memory buffer * From patchwork Fri Apr 11 15:29:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880173 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826103wrq; Fri, 11 Apr 2025 08:31:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7aMKNGZqJlOXwn6c7kE4vcuUIdNAUX7OxqkuvibHuoWkMvXRB00EfaZM8JN+wEDu2SS7k4A==@linaro.org X-Google-Smtp-Source: AGHT+IEnD622nfBfW6Y5mGnmGz/34nVKhD5d9U6t6hTCoRUPW4QXmHrqNMgfGkNNBdsfPP7Yf0uG X-Received: by 2002:a05:6122:3114:b0:516:230b:eec with SMTP id 71dfb90a1353d-527c34f3b35mr2257238e0c.5.1744385480005; Fri, 11 Apr 2025 08:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385479; cv=none; d=google.com; s=arc-20240605; b=lOWigYsg56t3LfIzZnGYnsAsTJfVeTKavdZ8T7igA3tnrF/6WUWxb6apzTMd2APryS ByYgZ3LD0hDkepdRxLpdieuh90BqTg84xz1MQSX9FaFJeiOPf5TCyfPTSE+wfoDmXSwI exJ3J5Nilh2wsk1HMLaX0kpD+gTbdAdGEwtfZx6dB8dIT45Zs5TtfwuQGhAZvuFLlo87 qXb8hhooZnURnb3OAF5a1jayPdWNP2NLKF19Nz/skJc2TUFDOEAzIsYObLFo5VW9jyBb Yj9eBu6pFRYmfzAkBYvo99taSvDGpzf7/PvWe1MC2xJoXoyWaIWPgoEj+gFO5dN+dF9J Dx4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SN0AdoG0e7dbKQGuC9llAgzmc45S+ohEsodZyUhF9QI=; fh=SBsxzH/dx+vhtWi73tHNQQyNGGj8g+b1JH2Du4UNeks=; b=AvGkaLhETBBsZkg+zupjMWzt334+iffrnWTtLYFsg6WGzcLzG7rYZkF/70xNmNgpLE gHfItYadQGXrdG/wg+seQc1wXcjdj6EX1K4KxGAFbdeSIRbjGm2PMp3F26Ff6BcBDKT3 EPNlbVZIduynN41AuU3TOCwT4oiEZ6wRbiF7/lPDWE1iN7G4i4bWZnhKpV7Te26JhlnE Oi0bf3ScOFq+k/hQBX18m7x4t+gi2jQVB2Wh9as9pu8cll2LNY+7nZRFMwTPlMKnUoUJ zLWbG1ycmD/5DbFm0bgOkA6kz65lQqMLedKgzecGEOJq3QYfQofhQkjdz/MB+fgnh9bF zhTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ruvn1AbW; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 71dfb90a1353d-527abd48e72si2076856e0c.25.2025.04.11.08.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ruvn1AbW; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B78DF8418A; Fri, 11 Apr 2025 17:31:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ruvn1AbW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C1098419E; Fri, 11 Apr 2025 17:31:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4FE9D8418A for ; Fri, 11 Apr 2025 17:30:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43d04ea9d9aso10637405e9.3 for ; Fri, 11 Apr 2025 08:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385457; x=1744990257; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SN0AdoG0e7dbKQGuC9llAgzmc45S+ohEsodZyUhF9QI=; b=ruvn1AbWNdP+MZKlohWGAyYDKgg8Zx3/idQCMI1g14VTsxrNAWfYt2Ax24DtYjXzus CGj1G8FWkx7xPZVkP0arzFkySr+4nhb9XyeXx0iwSHJyl7dKaJA1183YnhkWQxR5tW5N MRIggGrVCQw+4zic+RCdDN2qoypshB0V5b4ESdC3agtRJIRV0dx0MvSwMW6ci1jXszb8 Yc5deJNjAHjiizPUB8Dp6F0YDOQjieYx+cVL+9eiTQ79h/xYho66K7+7hiwDrqH9GIHK 6Nif6fSBX08Ovk3dvxcTi3vP/vRo3dPGX8l+yZn4NRy1naKJt0THNYbB9go6E10ZyElR nsKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385457; x=1744990257; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SN0AdoG0e7dbKQGuC9llAgzmc45S+ohEsodZyUhF9QI=; b=OHm3VriO14usJ7g8elwgf+eKlx5vHqgEzwDs5pb20OI1P8naINXnzvGFISBK3YQV4m WsLt6R8XQBD8p3CU5O18ig9VENz9tjJSJoch/q7vN0Tz5kdj4q05jpdnbNBXa2+L33R2 /Pwj61i0qi+0K9CDJd/y35ano1eB1l4qz3KnwBCkp0hFtJ8069MdhmiWgb6F66U0hSO1 w3W5CIrbqfAfLAZ0RAUlJcbRUJmuugs4dKvq7Z3fI1mSjYYxaR96TXcbeDvwDpcbX7DX yX5az13nYtlAMFvb267HqsgBXDal65fubHlM+TMpEJ/+UhLxrm15/TXLIwSqBKilhtpA X0Nw== X-Gm-Message-State: AOJu0Yzpc0Bqr+0g1NryC+ExDJz1VPP1CmOg9LMXKBXCKsRUcB500bAL ReEWr7BWIy0umbw9km+RR4MrZyTyvwGaqx9lixnu4s17buX1KVJxoh8WB1aN36jXqYMInVvWv1U uqvc= X-Gm-Gg: ASbGncsotyDiZ0o+i4vNZ9hs2+mJKtZFbEArR4OBMEKtdDIaycRVGEA4OnH74JLsc6K 9ZFnJIS6i6NyOaCWVsyT7/Y1cT/7KCqHJZyYxl+mdLsiwBkSeyc8/acOqIHek5FLQBHnRunkSMv l6b8Wxruv4gR1jfeT4+DM9MYDlG0Ul7WYMcrNBazZqjzyKQe5lErGElUMUXEvN3RHEcS54msl0d JccGGmMJ3VxYfYsD7qGVOgmVHY6Hzvwu0suiqI2kQ8kGJfEdpPRqxwpRRXcl70fdnnrw5E7ShZl Ebj8RTq/oWrAo1h9RzkfFGzcV5DHUpjK4Ho45a888zkeeOdYIQ== X-Received: by 2002:a05:600c:1e18:b0:43d:2230:303b with SMTP id 5b1f17b1804b1-43f3a9ab06bmr22978185e9.20.1744385457500; Fri, 11 Apr 2025 08:30:57 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:56 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Love Kumar , Michal Simek , Simon Glass , Tom Rini Subject: [RFC PATCH v1 3/7] test/py/tests/test_bootstage.py: add test for JSON report Date: Fri, 11 Apr 2025 17:29:29 +0200 Message-ID: <20250411153040.1772000-4-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add test for CONFIG_BOOTSTAGE_REPORT_JSON. Signed-off-by: Jerome Forissier --- test/py/tests/test_bootstage.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/py/tests/test_bootstage.py b/test/py/tests/test_bootstage.py index 379c1cae6dd..8d0afe2611b 100644 --- a/test/py/tests/test_bootstage.py +++ b/test/py/tests/test_bootstage.py @@ -30,6 +30,15 @@ def test_bootstage_report(ubman): assert 'Accumulated time:' in output assert 'dm_r' in output +@pytest.mark.buildconfigspec('bootstage') +@pytest.mark.buildconfigspec('cmd_bootstage') +@pytest.mark.buildconfigspec('bootstage_report_json') +def test_bootstage_report_json(ubman): + output = ubman.run_command('bootstage report') + assert '=== Begin JSON bootstage report ===' in output + assert '"dm_r"' in output + assert '"reset~board_init_f"' in output + @pytest.mark.buildconfigspec('bootstage') @pytest.mark.buildconfigspec('cmd_bootstage') @pytest.mark.buildconfigspec('bootstage_stash') From patchwork Fri Apr 11 15:29:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880175 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826305wrq; Fri, 11 Apr 2025 08:31:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQMI74BUwACyRSGkgmS8v5EwK21e4sQALx+T5zjg4Bf4yRCjH3TJ8jImttHXFmBNJyXWC/dA==@linaro.org X-Google-Smtp-Source: AGHT+IGnu/8lI8LrwxSi3zKMRUO1nVNOkomW5PbBEBdmli7SwBLO3jNrExCxVNKkwtfk0BbTiNs4 X-Received: by 2002:a05:6102:1481:b0:4c5:1bff:4589 with SMTP id ada2fe7eead31-4c9e504b8f3mr2282549137.22.1744385497666; Fri, 11 Apr 2025 08:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385497; cv=none; d=google.com; s=arc-20240605; b=G8RbvzfCV01MQb6+ZLEJwVmGtftMI1fx9qRLR5cOggDbI0Dcrzx0f+W5ZqLf8ETVp6 xMroJWBmjTKOd9dAUkNCOz7vFIBUGfX1qBaPejKqWNQ9Sv0QidrOAWbt0/oita3bi0md DE1ChZzUI0DjMdA+0CfYwaMBtexDV3HCovzHpgr07s+oTDEIsL9ZpJp3Sh86e2nYagkU by00d01jwDwpaIpIVR6b18kDN2HwqbrzJulkvl4O/FAo99/bKp4DU5D/UDL07c989QDa px6SpwLedtrR9OcKvoAfV+jXlffV/5phrHOJ/JPu2LJLilWdbr0HOjqR7IeeBh4IelpM f7PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tGMNM6XA8An9WA+DYUWQ0tcHnJe8kJMPt5NMSRCY+hE=; fh=goHJ08R+gD+Jqg9NGHPwbQYrVTP8scMmGuZXW4LpJTo=; b=eKCuNQBeWCng/LZ/S8cdw9H1k6wPSDx1tELLyprelh1Ih/9g4XNrQTGyCsl+KESQrA v0hQSoh1gtDOT4TGA3A0CbFkx9el8zrpXeZOwYiz8DaQix880p2M8Pu5IQeHt6E8KBFg wA1A/v/8H4HmybulLc7pz8dstV6LDA9nfBuorfNwoxAPv9UoNCpBO1RZlJQKc1sb9vYD VNz1QLlmRPuGgWqcycuHiELZRSdDFoLM1YSoscIlJbwEiTS95hYjhXRADLeCWdIw62FT /dU84gsvHEInSszHXnFHdT3zMkkgkwGXuD/JFjIcpNS/61ekoz12NsGxYy4jzfAHK+UD Fusg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ljndL2/T"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c973e66csi1946366137.69.2025.04.11.08.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ljndL2/T"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5342E841B1; Fri, 11 Apr 2025 17:31:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ljndL2/T"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9BA482B66; Fri, 11 Apr 2025 17:31:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3B8DF84003 for ; Fri, 11 Apr 2025 17:30:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-39129fc51f8so1731553f8f.0 for ; Fri, 11 Apr 2025 08:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385458; x=1744990258; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tGMNM6XA8An9WA+DYUWQ0tcHnJe8kJMPt5NMSRCY+hE=; b=ljndL2/T4eYvNUtNaMJBjCMV1sBQyF0WKZCTWRNS3EoBKZ71mXLxtVodUMZkE6oRLs hy1eRiOWogcoTZPtiwQvtVzldZOb2fSFnJLGykFfWC6k5oZqJty5T8Yq/vT0Yzid8GJZ AjJ5bvpCGcjVtaPWqGUGyFCv/mTN17JUZUTjZDFyE1voziKuR5jjM+8DhC4J6zEk+lI7 IlmW7UkA2Ahs/kO9ZfQaZ722T942RSSwtyUnz/ONQixdNIndUzKuwj+mDD4kmm4wGLwo ba0wkkjfEWVPhEl+artip/JRgXJsClUsLQ/ZIic5JbFmvI6ztd75rrdBccNZLzelfYXn XYWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385458; x=1744990258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tGMNM6XA8An9WA+DYUWQ0tcHnJe8kJMPt5NMSRCY+hE=; b=sTtVrtePePLSsH4i82aaPrk7Vb2tS6vwm5w14HINlmT3k078L6N2f8LEhMFBc2nFZN VKAT2rDrkgx+Yl6KPxVnxA0Y4p3Q6P8NLl7o5oHsLYaAiADLk9qkHMc4sfEAhrCPymzF Yskvy6NY0sAWQFsjNPEmyDouXJCOILaTWzUre1ubTjUs7nYIpND7E8rsMBrc16nTE2hu OltFff6N9sSoWoiX2C3W3OP49LIGPFvC5UqSLtMKnUlo9WYnv5F6E1f1eO/I3D6Bvksm Rj2K08QMYgcwRO9lTRK7X+AvO9ANLbvRJcvDQpSgt0izRRl2vO8eY6S+16wBs1NKTXst v2TA== X-Gm-Message-State: AOJu0YxlBR7hzk94aFtHkOynvGxJDDuu6K48l5cdBS0UbMl/xvocvM5p Zz9e/okZIKlY0zLWDAwnB7ig3d6VkIYEvE9KQcLEcQm38SQLxtVmgZR88MWGr8mpwnID9G6mj1W 82J8= X-Gm-Gg: ASbGncuvfLQj7NugNK8GDqpXMg5W+Ew+K7y2B1TAUp3Y6NHj0f3f8VsizxBIekfA4AI aXtUFwUy/6kshuH1Zyz9ZvbwnJkomsDcNcVfhIxdsG+I9DAcWSnMnSQUrs7xAHuBUsy0zMJ2fmr 9IMxe3lVSaWeo3fXaeL0QcuNft5uUlvTYU98Zr1hLSG/5mQ7I7EAJ2GjUzjyVI9nw/c/dIqescC rudIhDF8buEQztt/D5v7NydyVobS+fV5e8aSBjx0HaKjE9nh6U6Z98rzOjO4X2mO+9OeAMUBLno zTwHAJgGts1dPebunNYe6/Cdp2DUZ14Bt06TYI5dmfGUxYQnzQ== X-Received: by 2002:a05:6000:144f:b0:39c:cc7:3c62 with SMTP id ffacd0b85a97d-39eaaecaddamr3067054f8f.51.1744385458381; Fri, 11 Apr 2025 08:30:58 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:58 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Ilias Apalodimas , Jonas Karlman , Marek Vasut , Mattijs Korpershoek , Peter Robinson , Richard Weinberger , Simon Glass , Tom Rini Subject: [RFC PATCH v1 4/7] bootstage: add support for reporting in InfluxDB v2 line format Date: Fri, 11 Apr 2025 17:29:30 +0200 Message-ID: <20250411153040.1772000-5-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add a new Kconfig symbol: BOOTSTAGE_REPORT_INFLUXDB to report the bootstage timing information in InfluxDB v2 line protocol format in addition to the human-readable text format. InfluxDB provides an easy way to record boot statistics during CI in order to detect performance regressions. [1] https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/ Signed-off-by: Jerome Forissier --- boot/Kconfig | 10 ++++ common/bootstage.c | 133 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/boot/Kconfig b/boot/Kconfig index 5e90e20141a..6249f3bb0c9 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1174,6 +1174,16 @@ config BOOTSTAGE_REPORT_JSON Enable output of the boot time report in JSON format in addition to the human-readable text format. +config BOOTSTAGE_REPORT_INFLUXDB + bool "Display boot timing report in InfluxDB v2 line protocol" + depends on BOOTSTAGE_REPORT + help + Enable output of the boot time report in InfluxDB v2 line protocol + format in addition to the human-readable text format. + The report may be uploaded to the InfluxDB Cloud via an HTTPS POST. + See https://docs.influxdata.com/influxdb/v2/reference/syntax/line-protocol/ + and https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/api/. + config BOOTSTAGE_RECORD_COUNT int "Number of boot stage records to store" depends on BOOTSTAGE diff --git a/common/bootstage.c b/common/bootstage.c index 1ab55ecbe8f..9009882ef73 100644 --- a/common/bootstage.c +++ b/common/bootstage.c @@ -497,6 +497,137 @@ static void bootstage_report_json(void) puts("=== End JSON bootstage report ===\n"); } +/** + * puts_influxdb_escape() - Print a string, escaping the characters that have a + * special meaning in the InfluxDB v2 line protocol + * + * @str: the string to print + */ +static void puts_influxdb_escape(const char *str) +{ + const char *p = str; + + while (p && *p) { + if (*p == ' ' || *p == ',' || *p == '=') + putc('\\'); + putc(*p); + p++; + } +} + +/** + * print_time_record_influxdb() - print a time entry in InfluxDB v2 line + * protocolformat for a bootstage record or a couple of bootstage records. + * + * The function prints [,]key_name=value + * + * - If @rec->start_us is non-zero, it means @rec holds accumulated time. In + * this case, key_name is the unique record name and value is @rec->time_us. + * - Otherwise, @rec represents a boot stage with an associated timestamp. The + * key name is obtained by concatenating the previous record name and the + * current record name, separated by a tilda. The value is the elapsed time + * between the two stages, that is: @rec->time_us - @prev->time_us. + * + * @rec: the record to print + * @prev: the previous timestamp record (used as a reference when @rec is a + * timestamp) + * @is_first: true if this is the first reported data (won't print a + * continuation comma first ',') + * Returns @rec if it is a timestamp, @prev otherwise + */ +static struct bootstage_record * +print_time_record_influxdb(struct bootstage_record *rec, + struct bootstage_record *prev, bool is_first) +{ + char buf1[24]; + char buf2[24]; + + if (!is_first) + puts(","); + if (rec->start_us) { + /* An "Accumulated time" entry in the text report */ + printf("%s=%lu", + get_unique_record_name(buf1, sizeof(buf1), rec), + rec->time_us); + return prev; + } + + /* Elapsed time between two consecutive stages */ + printf("%s~%s=%lu", + get_unique_record_name(buf1, sizeof(buf1), prev), + get_unique_record_name(buf2, sizeof(buf2), rec), + rec->time_us - prev->time_us); + + return rec; +} + +/** + * print_env_influxdb() - print an environment variable in InfluxDB v2 line + * protocol format + * + * @env: the variable to print + * @cont: true if a continuation comma ', ' should be printed afterwards + */ +static void print_env_influxdb(const char *env, bool cont) +{ + char *val = env_get(env); + + puts("env_"); + puts(env); + puts("=\""); + if (val) + puts_influxdb_escape(val); + puts("\""); + if (cont) + puts(","); +} + +/** + * bootstage_report_influxdb() - print the InfluxDB bootstage report + */ +static void bootstage_report_influxdb(void) +{ + struct bootstage_data *data = gd->bootstage; + struct bootstage_record *prev = data->record; + struct bootstage_record *rec = data->record; + struct bootstage_record *boot_end = NULL; + bool is_first = true; + int i; + + puts("=== Begin InfluxDB v2 bootstage report ===\n"); + puts("u-boot_bootstage_report,"); + puts("u_boot_version=\""); + puts_influxdb_escape(PLAIN_VERSION); + puts("\","); + puts("u_boot_date=\""); + puts_influxdb_escape(U_BOOT_DATE); + puts("\","); + puts("u_boot_time=\""); + puts_influxdb_escape(U_BOOT_TIME); + puts("\","); + puts("u_boot_tz=\""); + puts_influxdb_escape(U_BOOT_TZ); + puts("\","); + print_env_influxdb("arch", 1); + print_env_influxdb("board", 1); + print_env_influxdb("board_name", 1); + print_env_influxdb("cpu", 1); + print_env_influxdb("vendor", 0); + puts(" "); + for (i = 1, rec++; i < data->rec_count; i++, rec++) { + if (rec->id) { + if (!rec->start_us) + boot_end = rec; + prev = print_time_record_influxdb(rec, prev, is_first); + is_first = false; + } + } + if (boot_end) + printf(",total=%ld", boot_end->time_us); + puts("\n"); + puts("=== End InfluxDB v2 bootstage report ===\n"); +} + /** * bootstage_report() - print the bootstage report(s) */ @@ -505,6 +636,8 @@ void bootstage_report(void) bootstage_report_text(); if (CONFIG_IS_ENABLED(BOOTSTAGE_REPORT_JSON)) bootstage_report_json(); + if (CONFIG_IS_ENABLED(BOOTSTAGE_REPORT_INFLUXDB)) + bootstage_report_influxdb(); } /** From patchwork Fri Apr 11 15:29:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880176 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826367wrq; Fri, 11 Apr 2025 08:31:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWjmz0VLeameCxk06d7jLjAUc6EyKToUb7IY2qL9d0hR8WNjUL/v8g+52THgBHxRzP+KRc6TQ==@linaro.org X-Google-Smtp-Source: AGHT+IHGSpLMXTomSbHxko8Y6OoA0dXmk0NQGurVhF7D803FsMkVraQLvqFAeUTK0BQ8DkgSaNtn X-Received: by 2002:a05:6102:3ece:b0:4bb:c490:7d6c with SMTP id ada2fe7eead31-4c9e4ef15fdmr2342364137.9.1744385506808; Fri, 11 Apr 2025 08:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385506; cv=none; d=google.com; s=arc-20240605; b=Nl9OGGMfFAcpzFgASEYHQu48+3Fe/oORafRw3ghPC2CLOOzdRbsVS2KjNvXK1h/QA3 +l8rY0M0xBlEfxXzrP7xVuVYDj23ovAWW5UrUsJQbYNOL94IL+iMcAIXuyT+I0DBSrDh W0nasFbsyz/jQ782qh5sOHrb6lpRfSDAKb8xXHNOBfwJf68lZm8vHdhOntPik/Q0/JsI 9uv/cEmGAjF3L5NRQy5Z59mj4z7d4CMtEhSdAhFKLNMCo8zBi8fCstFtP/ZYhg3V05Y1 4uBGE1zj3Bm2XpuV1fKJLF+PWM9cjl/Nd3YRHDrmeVgPQODyQ6GtxApxNyOXx53s34Vd 8bjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DMgY9ksSmExFbWzvay4LioQwsmmTDVnEOWiIAKfLOIM=; fh=SBsxzH/dx+vhtWi73tHNQQyNGGj8g+b1JH2Du4UNeks=; b=T2YbdANf2aW4ATQ2chhfslgOvR6w3CdOwOPesTXPuEF7S2KF6ao9ED5oKiuZ1ieSas p+5hksDjbuBeamNtVeCbqcU6vpb9KTLQw+VEnm/d7qV0A+kj3J/AZeFAdw2zpxkLmii2 FthJ4cDRUl/aifUFYkLmiVQ4ftsEHv3diJUhUsSfAVH0piaxeFNjEXyO4EQUKyT4UObq AVNMlF8wtst0NQa7O7RQLI5YBA3JwQpKIE3nHWR55qeylbYai7H8QwbuDB8EXHu5mXHS HMaKdLo9odw2PxhLeIe+27XDYjc2zzxbscD1tovZ/tvBgV08j+V0GIkv5Zr6vqGZ83lv xwcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mAVgtpci; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c989114bsi1963136137.231.2025.04.11.08.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:46 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mAVgtpci; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 65551841B9; Fri, 11 Apr 2025 17:31:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mAVgtpci"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB6D484003; Fri, 11 Apr 2025 17:31:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 04AB78419C for ; Fri, 11 Apr 2025 17:31:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43d0782d787so14558835e9.0 for ; Fri, 11 Apr 2025 08:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385459; x=1744990259; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DMgY9ksSmExFbWzvay4LioQwsmmTDVnEOWiIAKfLOIM=; b=mAVgtpcifJQo8VIbVXhnPk4e1Upm2dmX3etyvEJ7VrD2CUD+yUbbkLjXIol8jjI+pM JKcIsCjRnSZIBs8LwYsnyFnw/cG7itqDthHdc6ckgHdHGWgYVkCdCMAhBCVH8ExGnVQL n5RlYx8B8ijnzAzVgkA7/75xh4mOtri3SkZ71179Co4CkFYsWsNpYs73mQKhlJ8Y+cp5 vcEzz0aNxSzThX4grndvR30ZiJhrbrcU1fe1pWCN+I0Lzh5XyRyWFl9YeE5KGUwQcMqw 7DeeIilcxHjgr4ssUTcULBSX4s5k+nu8XcXYQlDXDf7D+6otzzKlJyuEDylM/4/kMjKQ A1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385459; x=1744990259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DMgY9ksSmExFbWzvay4LioQwsmmTDVnEOWiIAKfLOIM=; b=nOpmDwCiG18uLMFtHMw0kDimLXpm6wlpcrp91+fWO0jhrIJ90n7sS/eIvfEUdd0+Kr NpjFwMxfzt4Nx2Ds59OlhrzzF6Ssg91Yrhn4gIMkyS06QRASAiSk8bdvxSRTLdlwgoyS gVz+uxon1Z+cdATTLKSH58l/9n1JEUdPj8/DuO/QtF5RaIgXgvNs/AE/kNdCe2dBOMdc bQ/TvsO+IbyitMuuuohRnf6plXInnYJje3uEBb7GhFYq8ruGrcGWbPiOaiIRFJnCuefB 39Bp7+5hpTeE/+tTaKMNbl7QjI/8avgnuSWo1TpuH5t+GxgNI7DSDo1FVTr8U618wS4/ LqMQ== X-Gm-Message-State: AOJu0YxGlxRiA28wBHr0QS1ZX1ToKwdhDTkgtijVnTfzNnQeBzfikY4Z YKeaAQpjUkB4PfDeX3i2speEWBtPWRUfQ33V71fFE5nWKBbO0FSTlHDVDqQ35veloOAWWH2CsjY vgR8= X-Gm-Gg: ASbGncugLwEllL5EN7KWp/MDJ4ImqqKUUUfUxkt5eJ5676QdQuTSTubEwR2wZhjlxs6 LXgPcB46PuX0Pe5pSimCdSPwp2AbCKh7xM2x4i83ZuykAzSFv79bP/xldXcZuJ4cV3PxMJuOp+Q PhSH/AZEuH+3958wWRHHmYyDCRIxIPRiPWMzaCcAQzvExzfYmhpVCRTT1o0urkGvdUbUeCAYDhC JVlj5460Ia+vKk5IsVQ0YfObZbO7pgXwZnIdioSWs+DhbKZTepA0/OqxKTX0lkNfhFbaK0cHkq0 kSrws4Nx6AW06n1n7ylOCsAkI3IDcOT3+36Y6VPGCg5mt3aKPQ== X-Received: by 2002:a05:600c:1c91:b0:43c:f64c:447f with SMTP id 5b1f17b1804b1-43f3a9b4870mr24355425e9.29.1744385459256; Fri, 11 Apr 2025 08:30:59 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:58 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Love Kumar , Michal Simek , Simon Glass , Tom Rini Subject: [RFC PATCH v1 5/7] test/py/tests/test_bootstage.py: add test for InfluxDB report Date: Fri, 11 Apr 2025 17:29:31 +0200 Message-ID: <20250411153040.1772000-6-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add test for CONFIG_BOOTSTAGE_REPORT_INFLUXDB. Signed-off-by: Jerome Forissier --- test/py/tests/test_bootstage.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/py/tests/test_bootstage.py b/test/py/tests/test_bootstage.py index 8d0afe2611b..5619eaf4676 100644 --- a/test/py/tests/test_bootstage.py +++ b/test/py/tests/test_bootstage.py @@ -39,6 +39,17 @@ def test_bootstage_report_json(ubman): assert '"dm_r"' in output assert '"reset~board_init_f"' in output +@pytest.mark.buildconfigspec('bootstage') +@pytest.mark.buildconfigspec('cmd_bootstage') +@pytest.mark.buildconfigspec('bootstage_report_influxdb') +def test_bootstage_report_influxdb(ubman): + output = ubman.run_command('bootstage report') + assert '=== Begin InfluxDB v2 bootstage report ===' in output + assert 'u-boot_bootstage_report,' in output + assert 'u_boot_version=' in output + assert 'dm_r=' in output + assert 'reset~board_init_f=' in output + @pytest.mark.buildconfigspec('bootstage') @pytest.mark.buildconfigspec('cmd_bootstage') @pytest.mark.buildconfigspec('bootstage_stash') From patchwork Fri Apr 11 15:29:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880177 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826439wrq; Fri, 11 Apr 2025 08:31:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVi1BoklrzRlhOeOvR/HfQFJax5355RzHyutYykQPcxfeAjMSeo8Jhymjf5SNPLKv8K8U2plQ==@linaro.org X-Google-Smtp-Source: AGHT+IG8vsKVNHfynHl6gKGaQymQlKAijKWv0FDNBTPOyE8/MMTHMLGpjIFd0SpjbB+lL+8WpDaa X-Received: by 2002:a05:6830:61cd:b0:72b:9387:84c7 with SMTP id 46e09a7af769-72e862d7672mr2309235a34.2.1744385515715; Fri, 11 Apr 2025 08:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385515; cv=none; d=google.com; s=arc-20240605; b=Swg8oELkepU+hm8hCa16Lwg030K9t2+zahcpgNKC4Tle/W7cI79WZ+5Ia0RpMni9t0 Q4CmXttVJHfCtaNEPe4BSrGcU86ZCHLAWBtHCqispYpQXcNoBjAB7CIyca9x2shFM3+5 4MOq0qsyFZ9VwPBKH2TuPwElN+FM0bQFl3VQX+1jT4Q/AauVjSnlATlw6DgvfR4puBCB 2sYS4xJLwXL5FoCkCpXBmEhxop1Hf00Yz5hv4yToH301+2C8f9uzmZSJ5KLD4PyCU9bi vgsa1nokQp5T14uT7Pha2VVg+7Jpl6T2NvGPhC5hKJBU+GH7/S6wgszTgq71LL+woxko mNZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+kFFsVYgIy4+Sawto1O49iXalaUGkgNmp2yrRqQpTYM=; fh=qcPmmLZUShj+iDM7ZMhd7lpdk404TPY7gzJiGTqjwII=; b=LasJiTuCY1qsvuf+bg+Alto2cG10uB/nNxlaysdBHqUi1WOra6K7wCuPUqXeajPHGn oA0HpvtlAxtFzu2kilKr57w5xbdLgUvfi2dTnIGOOIi8763bVy9uBaW4FSr4vVJDMVTh ZosUZuDS8xe4eCOaviii/X6/Lr1e/APUVQdY8SCcjyj2N/wKR4jx2Gg0GWrD2HGx9Z72 9DI7C9OgRGma843fqEIXAdnZgnKeZg/HXUqBJXYRdyETC+4l7Yr8h+UZobNlrhy84xFu fP8dGZnFmrl32y1cAoSEGsCzQ/lD99rnJ110DzLNGVa6NGLyXF9vYHSSNR6rKmN0D4GH Cvcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="V+liYRb/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c98fd071si2177609137.612.2025.04.11.08.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="V+liYRb/"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ACDEC841C2; Fri, 11 Apr 2025 17:31:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="V+liYRb/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3CFC5841A9; Fri, 11 Apr 2025 17:31:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BCD0A841AB for ; Fri, 11 Apr 2025 17:31:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4394a823036so21651985e9.0 for ; Fri, 11 Apr 2025 08:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385460; x=1744990260; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+kFFsVYgIy4+Sawto1O49iXalaUGkgNmp2yrRqQpTYM=; b=V+liYRb/+C4QuXwCRLwG7wEiC9h0KAcH9GfoZLV59YXHBNkUkSMZB2qZDKiGq7uWrj LK95io9FPVLDH+ge4cXZldISknjG63m741tZZiC6uO8XJ/q8qLhb9W20WSjRZc87rVgz UOsksMmXtPpvm/9b+DCX7VKfnZt50SEn9yhoXicXwqc/ml/ELfUKNST6JVJUs0hkbA1Q wio5Q1yMhs78rtjZjOXReL1jEp+1ybXtzmVoY85qtuuJNHcaB3IwhjZJb4vyjOaV5wUc Zxq80ZCmj1rk7wCpnLWs5VPUAnTz44CaDSEnttK8a8fwhMSRqbp3+Aq8Nf7lHnJ7wHVl KaCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385460; x=1744990260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+kFFsVYgIy4+Sawto1O49iXalaUGkgNmp2yrRqQpTYM=; b=Ar+LypT9BBvE/eKPmrpSI4mQOtnUqU5NLY62KXXe5hzvPSv4LwqKzgq66l95KCmEdE C8somiabtrmyI19LioisyfqdkrbzpF2wRvYl/xHB/Fh4daPeXBfAsrpVjsN2tJ4Pujrc fqgIiJIV5GpWd4Xed6diQ7V2D7HcC23Ul7SLeSJcS4GZde1m8Gfc9ZFCPeiLAZ51cHQQ PoLxa9cVZqOfvHUs06k19RVdOP5Km1EJoscl078ZI3Un/VkzwvceFe1iUCfrcoCC5z2e t0MyBbvHvhzh2OYf/sZndkX452amYq/zKeCW0DIvIiCEDYPn4iHPH85D1ZnRF8uX4fGk zEtg== X-Gm-Message-State: AOJu0YxBnSfaZRp1PWSvLMaRHubzdUQ+XvSc9T0C+L3oX5N6FrgS2zFC t4IyFXtaATGJv7X0oEtM8bRpYJ3nSLHsy8X8dLws/gPfWKcykwxFU3jc+E7s+Zgl0prqd/0RRes y9vw= X-Gm-Gg: ASbGncvTwE0Nex2o8+9OqN1xFR0hGXNtfAx/FEXgJvgDQP8G/PxDgMcpfPXFzEa2Mzo dYPDUzwyAAR9TrlgiYBSyw9QKsu9Fo+z22Cy69NBVH3/zdbbM5mdtpREqu9wGq5Nv3txzmMXaR+ GwbShc2Mg7L8vzuL8oQL+H/unkg4WPt8gXoSxAY/dwvpp8RZ4OXMbTxs5WgCyn78F2rwY4XfC/h m2ZulqybwdjsoTAUvCffs8LCAaGhLpS4xT4b5TyuEaFK/iE6otSbw2zBegzLUGFQRVisWtdXaZo H2CEqrDAI23B1OdqW820OWFGlQjvCcE/1iq9vXanwVhas+ziKQ== X-Received: by 2002:a05:600c:4e13:b0:43d:4686:5cfb with SMTP id 5b1f17b1804b1-43f3a9add63mr33398905e9.27.1744385459966; Fri, 11 Apr 2025 08:30:59 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:30:59 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Dmitry Rokosov , Ilias Apalodimas , Mario Six , Mattijs Korpershoek , Simon Glass , Sughosh Ganu , Tom Rini Subject: [RFC PATCH v1 6/7] sandbox64_defconfig: enable bootstage report in JSON and InfluxDB formats Date: Fri, 11 Apr 2025 17:29:32 +0200 Message-ID: <20250411153040.1772000-7-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Enable the bootstage report in JSON and InfluxDB formats. This also enables the unit tests (test_bootstage_report_json() and test_bootstage_report_influxdb() in test/py/tests/test_bootstage.py). Signed-off-by: Jerome Forissier --- configs/sandbox64_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 1236ce474a6..c006a3300cd 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -20,6 +20,8 @@ CONFIG_FIT_VERBOSE=y CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_BOOTSTAGE=y CONFIG_BOOTSTAGE_REPORT=y +CONFIG_BOOTSTAGE_REPORT_JSON=y +CONFIG_BOOTSTAGE_REPORT_INFLUXDB=y CONFIG_BOOTSTAGE_FDT=y CONFIG_BOOTSTAGE_STASH=y CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 From patchwork Fri Apr 11 15:29:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 880178 Delivered-To: patch@linaro.org Received: by 2002:a5d:4882:0:b0:38f:210b:807b with SMTP id g2csp826526wrq; Fri, 11 Apr 2025 08:32:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXGMxEgDZ4b3wX0mgKAn4ytIZximdpPUbE7Eq5n6QK1kzU8Z8L72UeAPZwJbnM+nwzl468CFw==@linaro.org X-Google-Smtp-Source: AGHT+IFpbw1yWtMsk5FgKZ/GmEos7wMM5lHDuQj9+xcpp1MedPFmN36eBK3EVFdrT8SRwB1wkxJI X-Received: by 2002:a05:6102:5486:b0:4c1:85d9:5641 with SMTP id ada2fe7eead31-4c9e4f1171bmr2433883137.11.1744385524642; Fri, 11 Apr 2025 08:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744385524; cv=none; d=google.com; s=arc-20240605; b=VZM9z2IT6NbNAv+kMa1GKZQe6gWyBRbOhGv/DnTRoxG4X9jz5N3iscNJZ8cYOLIp2y 8Dy+tNJMwQx4iNURw97UtAS1TH/wBNzYU09DqudaPgLqIQQGrTto7vifGH3cgUit/y+R uBMl+kDJ/K2xHowrH9RxzVWpLAXJy+ShgdHuHv6VgjwmgGzacjk23ti30U+N2c1mje1w bihUSrSnJcDSULhk1bmTogvEl+CwKG6b4bq9mF6dVPAQ5+MG6zF8h7EgP7HGrqVaWSbM vPx6QAZneAMk4vO1ME9kr3fDDXjbQB7OmGIokcidf8sJnm6M3cgOk6FMVQesNg5ZfpA0 2FFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PgDg8SGREcusCzA799DzdciEfX+rtGREryDUTR6SsJs=; fh=o2dvvc6rMzKVfKrrmGcjle5jsSjmTYbtMl1G5/og2G0=; b=NZlfADbEp/SNyH209COyvkkbwuHJ5rQDdrw7TT+tWu+lS8jmhiEoUoXePjKioxPMY7 ssso13vKYw7vwPahMuTeT8dGLGp8LEzOf12x424/EcBqCkAysOULJQ5mkTWZe9rXuc+Y 85TzhhI1x/PjISQuh0cgYnsvq00+NNy7IAs42yOa7Ns3IErG8iZKi7g1q4rrN0K8CTXr ysK1thd2bmgJIlwLO0jgklq8XOFTwC32f7xLioxTTHVl4M2eqidyqMT1EXa4wwDBsJRJ qbUEAPTqtp/JLx8U4WxGBBYiPEEQuY0uUZ7/w9XFaoPAML2QJsVx9T7Boa1cF2nLhJbs InvQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X3aN3yeq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id ada2fe7eead31-4c9c976e56asi1962827137.161.2025.04.11.08.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X3aN3yeq; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 014F7841A9; Fri, 11 Apr 2025 17:31:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="X3aN3yeq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 644D684199; Fri, 11 Apr 2025 17:31:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CD4B784183 for ; Fri, 11 Apr 2025 17:31:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-43edecbfb94so22877925e9.1 for ; Fri, 11 Apr 2025 08:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744385461; x=1744990261; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PgDg8SGREcusCzA799DzdciEfX+rtGREryDUTR6SsJs=; b=X3aN3yeqMbCChKynpBShZsg6YbO6XNoDwB7uXDbF4HWA12537cLjR68cPrEa7uiUYI cmgTVu6ZSCuxEryKI6d5i5ji3fCBoJ9VkrNx1NeX0bujV+ZxvBw5hrDEsbkKS4HHIqrX 18D4/BhT15zbiko5d4dMLS8pWMo4u/wqWvoyp57sh2CyEJbOMkuuZahM3xv8js0l3RC6 IlvAW8xqoOx4YWTqy+4pL3CBdr4DTLGJoexF9GNADG3ytJGApdvgZxbSWYYjsrZvMJuY 9f81Yrid63dNJOaBrujp1Ux8L5QjQ3sTheiMRI/aRemdrguLqdVECoPT8HM+xpJd7tZs E+Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744385461; x=1744990261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PgDg8SGREcusCzA799DzdciEfX+rtGREryDUTR6SsJs=; b=sQfsriAObqyIsV/ONmk1xXhuU7Ge8g7huT7d0zXnSujkEg+1+dEK9hqxSea+Z3/5Gg BqIh2AJRyfwBEmvcMzvjBGM1/0QbBfIMv5bpFM/3lrShfoKsR71vCKQrMlzC2EfJEM6w zYKNn9OLNGznRdh7IJTwqxb3+RMUrivyOC108VjMYVMzKRmakPvL346R5jRa59CruiMb hssBpP/nc/ci4qa8HVUhiVt4T9UDvxJt++d7OnuhKbC9knZ4j80O9CkVdehtc0YLMyBR CbtLZ4TQz0mO8fD6CIbU3FH9jE2uhly2hVumenArCmbSPHyoS4GLvDZiqhN6k7BBj+qn r1rg== X-Gm-Message-State: AOJu0Yxl3H1Zz6gi6qik5Y7EjcFlgfizXMvgmG1sf9dkJxA0tTLmOI+m xhuZUKLk6wOOSYDkd2X7P90z/vkKgoN4gt3bMMkFm2h42EODUiLwa3ZikaijPnXe94PTVNOq/Yd UVHk= X-Gm-Gg: ASbGnctToLfB3+GxOlqDvckXkNVexoVJLAJXQa6/Rk8zCWenWExPon35teHmTX0wdBE 9qR63LoIT5iyezO2Md50xg8f4Gab+HwlmgnWQh4OF6DmH1WvW480P2rvmgAMVVx+VdyrWsuUYt3 qc1n8NwutGQmIRdQiekn8leYl3KFmmShyVaWCRiJ+j7/8ZbONqXNrrJmGYOuW4+9rT4i8p9w66z olKPLfG4cIvpAO590w+shV1Q0kC3VzXRBpgpgDqzjQlmEOs12VXc1pOlwWRk9OrY72PRIgCB/6x 4IcpbpYox58pq0mtH3DLrFLfRXCKZ8mty4ptYWN9MhrAvGRvStl4Of52UEzo X-Received: by 2002:a05:600c:4f10:b0:43d:878c:7c40 with SMTP id 5b1f17b1804b1-43f3a94c657mr39427465e9.10.1744385460688; Fri, 11 Apr 2025 08:31:00 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:94cf:dbda:d223:8de8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f205ecf30sm90337355e9.1.2025.04.11.08.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:31:00 -0700 (PDT) From: Jerome Forissier To: U-Boot mailing list Cc: Jerome Forissier , Love Kumar , Marek Vasut , Michal Simek , Simon Glass , Tom Rini Subject: [RFC PATCH v1 7/7] test/py/tests/test_bootstage.py: upload bootstage data to InfluxDB cloud Date: Fri, 11 Apr 2025 17:29:33 +0200 Message-ID: <20250411153040.1772000-8-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250411153040.1772000-1-jerome.forissier@linaro.org> References: <20250411153040.1772000-1-jerome.forissier@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean If the BOOTSTAGE_INFLUXDB_URI and BOOTSTAGE_INFLUXDB_TOKEN environment variables are set, the bootstage test will upload the timing information to the specified InfluxDB instance. This is meant to be used in CI to publish results for a particular board/build for later analysis. Note: use "precision=us" in the URI, not "precision=ns" as shown in most examples in the InfluxDB documentation. For details see [1]. [1] https://docs.influxdata.com/influxdb/v2/write-data/developer-tools/api Signed-off-by: Jerome Forissier --- test/py/requirements.txt | 1 + test/py/tests/test_bootstage.py | 39 ++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/test/py/requirements.txt b/test/py/requirements.txt index 804a427b351..dba380809a9 100644 --- a/test/py/requirements.txt +++ b/test/py/requirements.txt @@ -3,3 +3,4 @@ pycryptodomex==3.21.0 pytest==6.2.5 pytest-xdist==2.5.0 FATtools==1.0.42 +requests=2.32.3 diff --git a/test/py/tests/test_bootstage.py b/test/py/tests/test_bootstage.py index 5619eaf4676..efb27d51663 100644 --- a/test/py/tests/test_bootstage.py +++ b/test/py/tests/test_bootstage.py @@ -1,7 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 # (C) Copyright 2023, Advanced Micro Devices, Inc. +import os import pytest +import requests """ Test the bootstage command. @@ -40,15 +42,50 @@ def test_bootstage_report_json(ubman): assert '"reset~board_init_f"' in output @pytest.mark.buildconfigspec('bootstage') + +# Extract the text string between two delimiters +def extract_between(text, start_delimiter, end_delimiter): + startp = text.find(start_delimiter) + if startp == -1: + return None + startp += len(start_delimiter) + endp = text.find(end_delimiter, startp) + if endp == -1: + return None + return text[startp:endp].strip() + +def send_data_to_influxdb(data): + uri = os.environ.get("BOOTSTAGE_INFLUXDB_URI") + token = os.environ.get("BOOTSTAGE_INFLUXDB_TOKEN") + if not uri or not token: + print("Warning: BOOTSTAGE_INFLUXDB_URI or BOOTSTAGE_INFLUXDB_TOKEN " + "not set, cannot send bootstage data") + return + headers = { + "Authorization": f"Token {token}", + "Content-Type": "text/plain;charset=utf-8" + } + try: + rsp = requests.post(uri, headers= headers, data=data.encode('utf-8')) + rsp.raise_for_status() + print(f"Data succcessfully sent to {uri}") + except requests.exceptions.RequestException as e: + print(f"Error sending data to {uri}: {e}") + @pytest.mark.buildconfigspec('cmd_bootstage') @pytest.mark.buildconfigspec('bootstage_report_influxdb') def test_bootstage_report_influxdb(ubman): output = ubman.run_command('bootstage report') - assert '=== Begin InfluxDB v2 bootstage report ===' in output + start_delimiter = '=== Begin InfluxDB v2 bootstage report ===' + end_delimiter = '=== End InfluxDB v2 bootstage report ===' + assert start_delimiter in output assert 'u-boot_bootstage_report,' in output assert 'u_boot_version=' in output assert 'dm_r=' in output assert 'reset~board_init_f=' in output + data = extract_between(output, start_delimiter, end_delimiter) + if data: + send_data_to_influxdb(data) @pytest.mark.buildconfigspec('bootstage') @pytest.mark.buildconfigspec('cmd_bootstage')