From patchwork Tue Jan 23 00:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 190543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp43208dyi; Mon, 22 Jan 2024 16:37:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyviDi1BzBFcoiB/kRiPVXpDFgen440DE0o3H0qvpKNdiklLsk8QEMuDnfddRxYYrcUVu0 X-Received: by 2002:a17:902:7047:b0:1d7:396a:2188 with SMTP id h7-20020a170902704700b001d7396a2188mr1773279plt.12.1705970228044; Mon, 22 Jan 2024 16:37:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705970228; cv=pass; d=google.com; s=arc-20160816; b=cm6bTVX4PDyaZtTwUDQ4/MsA/EaYvdS3QVLiEx2e5f+UFMDZnWRtsOlVGoSK4DVp5Y PDqCPcALTRnDWMiI1hVs7DBApbOrNbJ8K6x38zI+MDpAPJrjp3mFlSlZzANNQK4pIDUI gOjcWrkmMBmjPIMvi+mZC6QSJCiiXB4XQl3j2QAnhO4VPniZZJnQodQHFMohOWhZwBax l0K4lIS/cX1xYL7GTzTFVJ+iY8I3OOwzv0m67rrR8SPrbf6neNb2bBU38AvbsEw9CZhv +y1LxPIgov1CQKEim+U4jI8kx2wXx8o2KFGG9GwpI/UfQNgVPSzoQdH6DPQZCglk0vQ2 jqMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=v3mpNhly1K/FvbNZbxoXHC3VDHfIYZfutn2fVhIXUKE=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=kA6PVVIYwB+qtNhTGdHdkE2xvXSY6UhX8eHumtZlpvFWbXGAifBomI67OxAwMrAOoT Y+XFd4YisMJ588mgNS22sGRiSApxb4PhePrJQESIVzOX6wAcmNloMWhnBTPbxX9C/TYY b57RidyfOnilTYG1EK1MQ2YVB7SutTfpvX5gxXepBTrK6hvygfeETprrFahBN5dmsJba 3+r09tpVAIy4sxpucQB2T4Vv9mRsqoXGjhDruhadEcZL80RutgB7PjewfrjSGpUatkSV XzSfsmTXQqHbEOqTXvh794ThXrFPVOzzVdHGh+6es9Bwhk1qe/plHy6q8dbSZVPIYC/q 5sFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="pv40Lpp/"; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34436-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b12-20020a170903228c00b001d70c272ccesi8161864plh.409.2024.01.22.16.37.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:37:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="pv40Lpp/"; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34436-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B7BA28A29D for ; Tue, 23 Jan 2024 00:27:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16A5A146908; Tue, 23 Jan 2024 00:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pv40Lpp/" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14804145B30 for ; Tue, 23 Jan 2024 00:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968376; cv=none; b=kQQpUFi417CKBx6uI0AdeEoz4Uk86TuVxk+QpCNC5LHsHOtwZXz/PcOklEGiSjpquYyhoES3ECk+nUmlTTpcU/bxdlAHO6rFeXjWQxvzVGW1ItGOI/Lu32hz0Ygkgmzn/8H5odarjgwZTJc4M5fe3wor685d5/NUC8+rCSuZ/Wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968376; c=relaxed/simple; bh=2Mcju2GLkOcjIP4VmHebW0u9y/4mznKlV2xvs1tiG0E=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=P0y/TGOh+hZB0NCh/L3A4iIXL/uHK0wCp8o9QucKOVlsPxN5K0ZYH8jXidWNK+OJiockrSFLkXmGRKNnW5XB4I/d1qOyi6/l7WO+9yMZlTO4U769zPRt7x1swnsGSKzbZ/X1k4UCeeDVvIGyrcB08AhS6k8Uxt0AnxU+v+iy3WQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pv40Lpp/; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5ff93902762so57691247b3.2 for ; Mon, 22 Jan 2024 16:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968374; x=1706573174; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=v3mpNhly1K/FvbNZbxoXHC3VDHfIYZfutn2fVhIXUKE=; b=pv40Lpp/n6yPN3Jz8ClUDW3t63AozyP4SRlbgC9zaXuXXJLf2XZvSs1BRiSRM3Aj8u s/exOBEDYj+40H/xlYV3PwZzoSdGTLlmPKKJ2Fkis4r1qUtQ/AtB2SQhB90VznqqE/Em NIR2VPswNSCQ/rKuhJpq7i/cXFlHamW9YJUXdBv1weHY9hh++yJEsPT/xrJxwHrbydT6 C45nTaq1UUNHF/M7qK7i1e43m4KtXuz9/2InR56vI0bxK0DpYJx/ipLvYFha97dF4dYC ZXlf8f9lZNaa+wg/qrcDOOCubN3EQe/ceuB6jNB9C0XaESgjnga/RN/JVyevbjOwKxj8 rOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968374; x=1706573174; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=v3mpNhly1K/FvbNZbxoXHC3VDHfIYZfutn2fVhIXUKE=; b=njhszlAh6SAGGOcxZ0XFq87KJUbYrxrP3D5Fs8cgTUAGokPY2rlXPB1Za1NyAHbRR3 uQ1szkDLtcPEx9quolonI5GbBArSTmHYci76UBnZ/t1pGYsMDZh+KjMDxsyfI8Wsg6cD b6Uq2qCbP5ixgHgFm/YLIlm1DFxuDHviPDiFN8nDJeLjxSyQvJUA5oBVfPoZvZ2giCBL p1+0nNe7cVpxvYuKwMM5INEJpqK8Jl4YBgBUH9CnY1ULO0BcTFBjFoBzz5wFPDL1YBy/ 9hMGXX7teo+k9u/+lmxTY0bI8uO/lW+UL3h/j0AS8H4Z0hTX4fdE2cMB3xwt4axYjpqy 8ROA== X-Gm-Message-State: AOJu0YxQBjnciDuqqvhUejVpgYZZ0lH7CMwT8duVPIMu4gpS2iP/tiqz Te8hJOPZO221e2wc7uoYPhMqKLuTw+BIf2WAxCr4cbMIYq/zQY3061k3DBDvnIvr+ml71l8hhoO ncn3JHw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a81:4c88:0:b0:5d8:4274:bae2 with SMTP id z130-20020a814c88000000b005d84274bae2mr2333638ywa.6.1705968374141; Mon, 22 Jan 2024 16:06:14 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:00 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-2-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 1/5] perf list: Switch error message to pr_err From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788839437939820930 X-GMAIL-MSGID: 1788839437939820930 Using printf can interrupt perf list output, use pr_err which can respect debug settings and the debug file. Signed-off-by: Ian Rogers --- tools/perf/util/print-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/print-events.c b/tools/perf/util/print-events.c index b0fc48be623f..9e47712507cc 100644 --- a/tools/perf/util/print-events.c +++ b/tools/perf/util/print-events.c @@ -66,7 +66,7 @@ void print_tracepoint_events(const struct print_callbacks *print_cb __maybe_unus put_tracing_file(events_path); if (events_fd < 0) { - printf("Error: failed to open tracing events directory\n"); + pr_err("Error: failed to open tracing events directory\n"); return; } From patchwork Tue Jan 23 00:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 190561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp46080dyi; Mon, 22 Jan 2024 16:46:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbCvK4gVCpGOVuJV7SGhZGRV+hv1uUnL840B9i37/im52mCJUZcKY84lxxt8RqK8rCzj0V X-Received: by 2002:a17:902:e882:b0:1d7:61fb:1c53 with SMTP id w2-20020a170902e88200b001d761fb1c53mr2000176plg.54.1705970767173; Mon, 22 Jan 2024 16:46:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705970767; cv=pass; d=google.com; s=arc-20160816; b=mqnuQ7m0EWuZSBs/mcyfr6DRHPP8fHZ0gJsrkl3rFqUZ6qCJgeTil0bZGqXitdnJke GLi0QqwfVjR8qGrMhd9KAVbqUF6j12CAdwUgqrLZT2c+T2QUDTsb9t1eWM6qN/g75y/i rErlRy7WaKjlc57Vh3SYi7Msc/dzRmuQwBSFA4XB9pu7DuSpsjDSw5jrObtoRMQ4usKg khNKpqJD6OdNx3VDsOIVcnaxITVzMEyIG3IY95HWIwd+u9nxfkER0Qc90HSjOXPRssZ7 qo4aYFJx9/gSit8qeq5H0upJWMiagBziRhW3NMuZ5zou1hnz86FgxUUF6C5dgXByIKci 52vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=dwOTolb94//HSm3DPw2galb3SBW/iq3bnifLRUsxAiA=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=uXY4qADKgsIP305y++aoaMHYOPOwWjplUro/RXrtk+qLWs8kAcQRvCvwJxO+Z9m4gw XfCUjnTrU3pxQqOcTLFG9uSsqYZMRsrlMU11hYPBDX2g6aZvFLNUv+I7FhHYVZcuaKtH JQ7nIfhzcYf5WGF3hV5N/EHvWP3QU+DyTZnpGj9luu/dzLzpejvpgk2/VH1jcz+kGmJO MazS4pi4j5goNFE8pkc85mwpRWqoNQjYidzMCwUiFDTt4cm9OmgS5yh2IxKWEMMVR7E1 qTFT6CI1IJI8IAWYtAfqhtvgXDB3CLDv6fHDwjZohC/n7O7BY4GICa0GwDUkgIAXXJZs 0DOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=b4ubij68; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34437-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q18-20020a170902b11200b001d75dfebd47si1516110plr.2.2024.01.22.16.46.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:46:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=b4ubij68; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34437-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34437-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B1EC5B277C8 for ; Tue, 23 Jan 2024 00:28:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92BAC1474DD; Tue, 23 Jan 2024 00:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b4ubij68" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47C951468F0 for ; Tue, 23 Jan 2024 00:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968379; cv=none; b=cX/1ocKZhVyTo3AetWoQKl2pnG8WJ5Fwex2e5uUFmbZ/INh+N5UVGDRLIssP5qqVRoNmjU1TATJ9PeNqmXks1WhdwatiDl798ydi/Oo6l0yt6gDNO526dqqAwCTFl1/2VK0BZyPzaIq1j3mVSV/2IW4GMy1Za5HpmAG80QseA/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968379; c=relaxed/simple; bh=0g/j+czwZZZV0jyeUsBRsvNrDyJWksVMiiivTFDmwII=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=o4lYhbRH93OvtQWC+BnLVHZoeIGV3+DSLhDVT2AHVk1I1RRb5zyUlTHDH+48Lt3TKRci4AJ4yJmTwcYqH2z8KhuHO1F8Uqs2BwbcZunxbdNplXAjcTGUZp5cb/CN+CtomImccdOfGCfA/Nq1e3vdP+/IN2ouagnnAnUeo/tpKCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=b4ubij68; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc21b7f41a1so4778377276.2 for ; Mon, 22 Jan 2024 16:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968376; x=1706573176; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=dwOTolb94//HSm3DPw2galb3SBW/iq3bnifLRUsxAiA=; b=b4ubij68NPzkF6MY3Za9q5X3+bKIUGc18rpKpBTKKs+2COWOwBcVTNnXJShPNpQwMu nyhgnpKyzIcMrr9fWTGKIYpRXy1lmzxV1foqyo54bZEkx8tX68+SDnpzwYIcdR3mVBfa AvhN7gE4rra1om/Ql1NkDttHuhui7wXTWoYaKG5vLbuBInEmbSm7AWkKRuMPI/7kAFxl rDzWpdPx7t1QpIBfGmwEP4PkJk7Q1IkHTGU5ytUFPMrZPYSnVvh6mHpoN1LDcfbRBFnn oAo2zqjePkEa0lpZtuOzjJVHGRhriFtKX68f0rGzHNQaBEYnwzWTmi/hbdtRHuvtD6Lo mJOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968376; x=1706573176; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dwOTolb94//HSm3DPw2galb3SBW/iq3bnifLRUsxAiA=; b=j3nKHqFTh6ljq9hN0x1JWsvFmmLNhYambadlGtoBRFIGvJT4Aie8RzWW5p+vcPDbAp Ueylu9tqocXJIJBV8LNUHFeBKHU+9S3DeQgQMqEMOrggTnSwrHgDdMUHaD7J/PPPsHuZ lJ9EAGIvIfNxFGod2jqWInQWBvd602RCr/uzCa323HFSbOoCntfn+QzEyNG1qAf5ik+a DvUZsENdOPGF51dqdvU6erCijYV1HkYV+aKBWyPqct/yYza9d398UbMLPpSrkwqPZGqj WO4X4LFS4y1JcpnFFGc0zwFeI6L0gzCs0lWUOmIYOD1DW0qk2QBRbiwNHCdnA+XTo62z JI/A== X-Gm-Message-State: AOJu0Ywb7kW3dGYjSVBYVxNFFHXdIz07y5qiQxiNq9eEoBE9jbC+7HQN sB45aBEIAJ8KaPSPFPyu7SwlxDu27sRxKaX178HVq4ITVE4aw6cCoHbwG4S1HBQuBrnCxD0c8YE 5Ap4abQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a25:df84:0:b0:dc2:6605:f6ba with SMTP id w126-20020a25df84000000b00dc26605f6bamr370734ybg.2.1705968376320; Mon, 22 Jan 2024 16:06:16 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:01 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 2/5] perf list: Add output file option From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788840003268131803 X-GMAIL-MSGID: 1788840003268131803 Add an option to write the perf list output to a specific file. This can avoid issues with debug output being written into the output stream. Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-list.txt | 4 + tools/perf/builtin-list.c | 211 +++++++++++++++---------- 2 files changed, 133 insertions(+), 82 deletions(-) diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 1b90575ee3c8..3b12595193c9 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -47,6 +47,10 @@ Print PMU events and metrics limited to the specific PMU name. --json:: Output in JSON format. +-o:: +--output=:: + Output file name. By default output is written to stdout. + [[EVENT_MODIFIERS]] EVENT MODIFIERS --------------- diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 61c2c96cc070..e27a1b1288c2 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -30,6 +30,8 @@ * functions. */ struct print_state { + /** @fp: File to write output to. */ + FILE *fp; /** * @pmu_glob: Optionally restrict PMU and metric matching to PMU or * debugfs subsystem name. @@ -66,13 +68,15 @@ static void default_print_start(void *ps) { struct print_state *print_state = ps; - if (!print_state->name_only && pager_in_use()) - printf("\nList of pre-defined events (to be used in -e or -M):\n\n"); + if (!print_state->name_only && pager_in_use()) { + fprintf(print_state->fp, + "\nList of pre-defined events (to be used in -e or -M):\n\n"); + } } static void default_print_end(void *print_state __maybe_unused) {} -static void wordwrap(const char *s, int start, int max, int corr) +static void wordwrap(FILE *fp, const char *s, int start, int max, int corr) { int column = start; int n; @@ -82,10 +86,10 @@ static void wordwrap(const char *s, int start, int max, int corr) int wlen = strcspn(s, " \t\n"); if ((column + wlen >= max && column > start) || saw_newline) { - printf("\n%*s", start, ""); + fprintf(fp, "\n%*s", start, ""); column = start + corr; } - n = printf("%s%.*s", column > start ? " " : "", wlen, s); + n = fprintf(fp, "%s%.*s", column > start ? " " : "", wlen, s); if (n <= 0) break; saw_newline = s[wlen] == '\n'; @@ -104,6 +108,7 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi { struct print_state *print_state = ps; int pos; + FILE *fp = print_state->fp; if (deprecated && !print_state->deprecated) return; @@ -119,30 +124,30 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi if (print_state->name_only) { if (event_alias && strlen(event_alias)) - printf("%s ", event_alias); + fprintf(fp, "%s ", event_alias); else - printf("%s ", event_name); + fprintf(fp, "%s ", event_name); return; } if (strcmp(print_state->last_topic, topic ?: "")) { if (topic) - printf("\n%s:\n", topic); + fprintf(fp, "\n%s:\n", topic); zfree(&print_state->last_topic); print_state->last_topic = strdup(topic ?: ""); } if (event_alias && strlen(event_alias)) - pos = printf(" %s OR %s", event_name, event_alias); + pos = fprintf(fp, " %s OR %s", event_name, event_alias); else - pos = printf(" %s", event_name); + pos = fprintf(fp, " %s", event_name); if (!topic && event_type_desc) { for (; pos < 53; pos++) - putchar(' '); - printf("[%s]\n", event_type_desc); + fputc(' ', fp); + fprintf(fp, "[%s]\n", event_type_desc); } else - putchar('\n'); + fputc('\n', fp); if (desc && print_state->desc) { char *desc_with_unit = NULL; @@ -155,22 +160,22 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi ? "%s. Unit: %s" : "%s Unit: %s", desc, pmu_name); } - printf("%*s", 8, "["); - wordwrap(desc_len > 0 ? desc_with_unit : desc, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, desc_len > 0 ? desc_with_unit : desc, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); free(desc_with_unit); } long_desc = long_desc ?: desc; if (long_desc && print_state->long_desc) { - printf("%*s", 8, "["); - wordwrap(long_desc, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, long_desc, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); } if (print_state->detailed && encoding_desc) { - printf("%*s", 8, ""); - wordwrap(encoding_desc, 8, pager_get_columns(), 0); - putchar('\n'); + fprintf(fp, "%*s", 8, ""); + wordwrap(fp, encoding_desc, 8, pager_get_columns(), 0); + fputc('\n', fp); } } @@ -184,6 +189,7 @@ static void default_print_metric(void *ps, const char *unit __maybe_unused) { struct print_state *print_state = ps; + FILE *fp = print_state->fp; if (print_state->event_glob && (!print_state->metrics || !name || !strglobmatch(name, print_state->event_glob)) && @@ -192,27 +198,27 @@ static void default_print_metric(void *ps, if (!print_state->name_only && !print_state->last_metricgroups) { if (print_state->metricgroups) { - printf("\nMetric Groups:\n"); + fprintf(fp, "\nMetric Groups:\n"); if (!print_state->metrics) - putchar('\n'); + fputc('\n', fp); } else { - printf("\nMetrics:\n\n"); + fprintf(fp, "\nMetrics:\n\n"); } } if (!print_state->last_metricgroups || strcmp(print_state->last_metricgroups, group ?: "")) { if (group && print_state->metricgroups) { if (print_state->name_only) - printf("%s ", group); + fprintf(fp, "%s ", group); else if (print_state->metrics) { const char *gdesc = describe_metricgroup(group); if (gdesc) - printf("\n%s: [%s]\n", group, gdesc); + fprintf(fp, "\n%s: [%s]\n", group, gdesc); else - printf("\n%s:\n", group); + fprintf(fp, "\n%s:\n", group); } else - printf("%s\n", group); + fprintf(fp, "%s\n", group); } zfree(&print_state->last_metricgroups); print_state->last_metricgroups = strdup(group ?: ""); @@ -223,53 +229,59 @@ static void default_print_metric(void *ps, if (print_state->name_only) { if (print_state->metrics && !strlist__has_entry(print_state->visited_metrics, name)) { - printf("%s ", name); + fprintf(fp, "%s ", name); strlist__add(print_state->visited_metrics, name); } return; } - printf(" %s\n", name); + fprintf(fp, " %s\n", name); if (desc && print_state->desc) { - printf("%*s", 8, "["); - wordwrap(desc, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, desc, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); } if (long_desc && print_state->long_desc) { - printf("%*s", 8, "["); - wordwrap(long_desc, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, long_desc, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); } if (expr && print_state->detailed) { - printf("%*s", 8, "["); - wordwrap(expr, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, expr, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); } if (threshold && print_state->detailed) { - printf("%*s", 8, "["); - wordwrap(threshold, 8, pager_get_columns(), 0); - printf("]\n"); + fprintf(fp, "%*s", 8, "["); + wordwrap(fp, threshold, 8, pager_get_columns(), 0); + fprintf(fp, "]\n"); } } struct json_print_state { + /** @fp: File to write output to. */ + FILE *fp; /** Should a separator be printed prior to the next item? */ bool need_sep; }; -static void json_print_start(void *print_state __maybe_unused) +static void json_print_start(void *ps) { - printf("[\n"); + struct json_print_state *print_state = ps; + FILE *fp = print_state->fp; + + fprintf(fp, "[\n"); } static void json_print_end(void *ps) { struct json_print_state *print_state = ps; + FILE *fp = print_state->fp; - printf("%s]\n", print_state->need_sep ? "\n" : ""); + fprintf(fp, "%s]\n", print_state->need_sep ? "\n" : ""); } -static void fix_escape_printf(struct strbuf *buf, const char *fmt, ...) +static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, ...) { va_list args; @@ -318,7 +330,7 @@ static void fix_escape_printf(struct strbuf *buf, const char *fmt, ...) } } va_end(args); - fputs(buf->buf, stdout); + fputs(buf->buf, fp); } static void json_print_event(void *ps, const char *pmu_name, const char *topic, @@ -330,60 +342,71 @@ static void json_print_event(void *ps, const char *pmu_name, const char *topic, { struct json_print_state *print_state = ps; bool need_sep = false; + FILE *fp = print_state->fp; struct strbuf buf; strbuf_init(&buf, 0); - printf("%s{\n", print_state->need_sep ? ",\n" : ""); + fprintf(fp, "%s{\n", print_state->need_sep ? ",\n" : ""); print_state->need_sep = true; if (pmu_name) { - fix_escape_printf(&buf, "\t\"Unit\": \"%S\"", pmu_name); + fix_escape_fprintf(fp, &buf, "\t\"Unit\": \"%S\"", pmu_name); need_sep = true; } if (topic) { - fix_escape_printf(&buf, "%s\t\"Topic\": \"%S\"", need_sep ? ",\n" : "", topic); + fix_escape_fprintf(fp, &buf, "%s\t\"Topic\": \"%S\"", + need_sep ? ",\n" : "", + topic); need_sep = true; } if (event_name) { - fix_escape_printf(&buf, "%s\t\"EventName\": \"%S\"", need_sep ? ",\n" : "", - event_name); + fix_escape_fprintf(fp, &buf, "%s\t\"EventName\": \"%S\"", + need_sep ? ",\n" : "", + event_name); need_sep = true; } if (event_alias && strlen(event_alias)) { - fix_escape_printf(&buf, "%s\t\"EventAlias\": \"%S\"", need_sep ? ",\n" : "", - event_alias); + fix_escape_fprintf(fp, &buf, "%s\t\"EventAlias\": \"%S\"", + need_sep ? ",\n" : "", + event_alias); need_sep = true; } if (scale_unit && strlen(scale_unit)) { - fix_escape_printf(&buf, "%s\t\"ScaleUnit\": \"%S\"", need_sep ? ",\n" : "", - scale_unit); + fix_escape_fprintf(fp, &buf, "%s\t\"ScaleUnit\": \"%S\"", + need_sep ? ",\n" : "", + scale_unit); need_sep = true; } if (event_type_desc) { - fix_escape_printf(&buf, "%s\t\"EventType\": \"%S\"", need_sep ? ",\n" : "", - event_type_desc); + fix_escape_fprintf(fp, &buf, "%s\t\"EventType\": \"%S\"", + need_sep ? ",\n" : "", + event_type_desc); need_sep = true; } if (deprecated) { - fix_escape_printf(&buf, "%s\t\"Deprecated\": \"%S\"", need_sep ? ",\n" : "", - deprecated ? "1" : "0"); + fix_escape_fprintf(fp, &buf, "%s\t\"Deprecated\": \"%S\"", + need_sep ? ",\n" : "", + deprecated ? "1" : "0"); need_sep = true; } if (desc) { - fix_escape_printf(&buf, "%s\t\"BriefDescription\": \"%S\"", need_sep ? ",\n" : "", - desc); + fix_escape_fprintf(fp, &buf, "%s\t\"BriefDescription\": \"%S\"", + need_sep ? ",\n" : "", + desc); need_sep = true; } if (long_desc) { - fix_escape_printf(&buf, "%s\t\"PublicDescription\": \"%S\"", need_sep ? ",\n" : "", - long_desc); + fix_escape_fprintf(fp, &buf, "%s\t\"PublicDescription\": \"%S\"", + need_sep ? ",\n" : "", + long_desc); need_sep = true; } if (encoding_desc) { - fix_escape_printf(&buf, "%s\t\"Encoding\": \"%S\"", need_sep ? ",\n" : "", - encoding_desc); + fix_escape_fprintf(fp, &buf, "%s\t\"Encoding\": \"%S\"", + need_sep ? ",\n" : "", + encoding_desc); need_sep = true; } - printf("%s}", need_sep ? "\n" : ""); + fprintf(fp, "%s}", need_sep ? "\n" : ""); strbuf_release(&buf); } @@ -394,43 +417,53 @@ static void json_print_metric(void *ps __maybe_unused, const char *group, { struct json_print_state *print_state = ps; bool need_sep = false; + FILE *fp = print_state->fp; struct strbuf buf; strbuf_init(&buf, 0); - printf("%s{\n", print_state->need_sep ? ",\n" : ""); + fprintf(fp, "%s{\n", print_state->need_sep ? ",\n" : ""); print_state->need_sep = true; if (group) { - fix_escape_printf(&buf, "\t\"MetricGroup\": \"%S\"", group); + fix_escape_fprintf(fp, &buf, "\t\"MetricGroup\": \"%S\"", group); need_sep = true; } if (name) { - fix_escape_printf(&buf, "%s\t\"MetricName\": \"%S\"", need_sep ? ",\n" : "", name); + fix_escape_fprintf(fp, &buf, "%s\t\"MetricName\": \"%S\"", + need_sep ? ",\n" : "", + name); need_sep = true; } if (expr) { - fix_escape_printf(&buf, "%s\t\"MetricExpr\": \"%S\"", need_sep ? ",\n" : "", expr); + fix_escape_fprintf(fp, &buf, "%s\t\"MetricExpr\": \"%S\"", + need_sep ? ",\n" : "", + expr); need_sep = true; } if (threshold) { - fix_escape_printf(&buf, "%s\t\"MetricThreshold\": \"%S\"", need_sep ? ",\n" : "", - threshold); + fix_escape_fprintf(fp, &buf, "%s\t\"MetricThreshold\": \"%S\"", + need_sep ? ",\n" : "", + threshold); need_sep = true; } if (unit) { - fix_escape_printf(&buf, "%s\t\"ScaleUnit\": \"%S\"", need_sep ? ",\n" : "", unit); + fix_escape_fprintf(fp, &buf, "%s\t\"ScaleUnit\": \"%S\"", + need_sep ? ",\n" : "", + unit); need_sep = true; } if (desc) { - fix_escape_printf(&buf, "%s\t\"BriefDescription\": \"%S\"", need_sep ? ",\n" : "", - desc); + fix_escape_fprintf(fp, &buf, "%s\t\"BriefDescription\": \"%S\"", + need_sep ? ",\n" : "", + desc); need_sep = true; } if (long_desc) { - fix_escape_printf(&buf, "%s\t\"PublicDescription\": \"%S\"", need_sep ? ",\n" : "", - long_desc); + fix_escape_fprintf(fp, &buf, "%s\t\"PublicDescription\": \"%S\"", + need_sep ? ",\n" : "", + long_desc); need_sep = true; } - printf("%s}", need_sep ? "\n" : ""); + fprintf(fp, "%s}", need_sep ? "\n" : ""); strbuf_release(&buf); } @@ -449,8 +482,12 @@ static bool default_skip_duplicate_pmus(void *ps) int cmd_list(int argc, const char **argv) { int i, ret = 0; - struct print_state default_ps = {}; - struct print_state json_ps = {}; + struct print_state default_ps = { + .fp = stdout, + }; + struct print_state json_ps = { + .fp = stdout, + }; void *ps = &default_ps; struct print_callbacks print_cb = { .print_start = default_print_start, @@ -461,6 +498,7 @@ int cmd_list(int argc, const char **argv) }; const char *cputype = NULL; const char *unit_name = NULL; + const char *output_path = NULL; bool json = false; struct option list_options[] = { OPT_BOOLEAN(0, "raw-dump", &default_ps.name_only, "Dump raw events"), @@ -471,6 +509,7 @@ int cmd_list(int argc, const char **argv) "Print longer event descriptions."), OPT_BOOLEAN(0, "details", &default_ps.detailed, "Print information on the perf event names and expressions used internally by events."), + OPT_STRING('o', "output", &output_path, "file", "output file name"), OPT_BOOLEAN(0, "deprecated", &default_ps.deprecated, "Print deprecated events."), OPT_STRING(0, "cputype", &cputype, "cpu type", @@ -497,6 +536,11 @@ int cmd_list(int argc, const char **argv) argc = parse_options(argc, argv, list_options, list_usage, PARSE_OPT_STOP_AT_NON_OPTION); + if (output_path) { + default_ps.fp = fopen(output_path, "w"); + json_ps.fp = default_ps.fp; + } + setup_pager(); if (!default_ps.name_only) @@ -618,5 +662,8 @@ int cmd_list(int argc, const char **argv) free(default_ps.last_topic); free(default_ps.last_metricgroups); strlist__delete(default_ps.visited_metrics); + if (output_path) + fclose(default_ps.fp); + return ret; } From patchwork Tue Jan 23 00:06:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 190560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp46042dyi; Mon, 22 Jan 2024 16:45:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFhnly+5soZQii9R+c+4dD9PfEwVcZF0euKQh+8J3/ff9yC9ygUCS9KmavuQUNMWwVZ2PMO X-Received: by 2002:a05:6a20:bca6:b0:198:fbc4:87fa with SMTP id fx38-20020a056a20bca600b00198fbc487famr4881582pzb.94.1705970757058; Mon, 22 Jan 2024 16:45:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705970757; cv=pass; d=google.com; s=arc-20160816; b=I9G9hkBH4EdA6DwvySSrytuxQBspOwpkKDRoRDNGNCGzaKWVeki3HokvB1nm6Dd/6Y eW+fSAsj7y1WAJJv8sChqsejSK7ocNWoWJCayTSUUgZ0Safp+xKSh277RX1Y+8azYX7v QsHktuWmp0U5TJb7yamZ1snP7W3Ywwb+VOGOOJn5vLCR3j/6KWlrbMM6T8m6VVtkq9No cYFQoFFS/s15DIvAKfxFB8xouTPPQX47rX56LYg4q2NvkIe2oqT8R43sn4gWsl4kSbY9 uFFejR53HejedLj+auf2diTzsW8nMrMcNvK/njXBBsgph3QqP+25nU5Zk7PHPuAYy/Ee 9sxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=FbGGf59DA5QM5LIqtEUDehzpONrkGjjAENgF7jFRKl8=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=GadHJYySjwq0jPwK66QdecRQ1XBQauv3HfYkj51zFCxz5CoBQrTgGBcx6JdNS1H7kO NEBjG5UvgRvx7AjqNWom3FwpfmQd0bIFxwR74PBQdQ4PoDNNfMiEEM1CE8O6HP9/6qjy yXeHEVR1UjzRYCILlPGwydyOVwc+6RayaPHR8/0bwcgOaI9Yf6/zL2aYqGmC1t9Bl9kW ZfLBhj05Jq2SMfZQazrxz5jIiKSo6ag+pxmCn+AtsblqAWCNO3Pk+yoQ4yVPg/OabIsE n5HtovJcDpo9uRuDSqtbEwscAcjeaHzQs1pSGxo7GHoD0deLwhqN+FLnigGZXo47ltQ8 jjpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UpPC+nHC; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34438-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h22-20020a17090acf1600b0029045eb77a0si7063816pju.150.2024.01.22.16.45.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:45:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34438-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UpPC+nHC; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34438-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34438-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 19B2EB27701 for ; Tue, 23 Jan 2024 00:28:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75B6E1474C6; Tue, 23 Jan 2024 00:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UpPC+nHC" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7753114690C for ; Tue, 23 Jan 2024 00:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968380; cv=none; b=FC5yszm/DV/tuKA5BoSFkcSstQ1bKiQmwZkJTBLf2SohmACx1laHPCp31AdgNxdGOS9Lr4htE1BBAzOjHhRkEXTvPJderQABWW0h9FddBmIHAwBdbWGeVDLR0WtTPjP3x04urR8BvEog/gAYhT+hw2wf0ex8jm4wMvtKCY5QNnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968380; c=relaxed/simple; bh=QSzzoS14vis9dIlzEyaQe1hPLIfMWnirr9zB3yUAZLk=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=oB6CLx0pABUfqsYadZkbcKJlJqfK2qhZGgkGs2OmRpYr09cUMa+waPc87CjOe68mxo8Znysi2dWGrVhfZJBWz47bugNrlLYCYwEKMzIaFCm9xoy/VAEYKHDE32C1h5vB46hFSYnDO1LC1I7/4k+mwV0rjs1Dq38SDg4f3qaFwM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UpPC+nHC; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5e73bd9079eso61260357b3.2 for ; Mon, 22 Jan 2024 16:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968378; x=1706573178; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=FbGGf59DA5QM5LIqtEUDehzpONrkGjjAENgF7jFRKl8=; b=UpPC+nHCQdCOlLooBJLVq3GMj0wxnKG3qiQ6zlfCVZIFwzTFOSEW1bSV7kZYOttOK4 euGBwpgbe+ZzkNc6JImgQYqk+uQ837CIq75cqeU6EqmSkmVSnJZr/m+WxQn2KJr95KPB xijjmiPBPiaz8Vp4jHeB/BRxgPcCq/CtCEqxl7wTJkFNMfoP+hJ4IlhzyzgIIkS7hQpz g945mKYkZa+6DRZ+P+D17CiFlrzSvv0v89lEkA4KVJAcROd7CwZ+rQ4MPBV2w/2oCOsm xpc+hPzL3Y3/0NTfTvV9vBb76Q/k09RZEItKDjRi31allhCr6uLu1M5dG6Ioo323tp3a ddtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968378; x=1706573178; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FbGGf59DA5QM5LIqtEUDehzpONrkGjjAENgF7jFRKl8=; b=EANp0bELlB1uURupFGFrbzkvy9GnuyGrqdtzIs/xbwCL6caG5tgICi9zRecmcZok74 8p5tpkSFRLcZBoGPvjhIAlAOGc780n4R23WUmYjQw+GEb1OFuxf/oxvNW/w4pTpaUiXI KRERJVDp0hEOOj48uNA5plSacJydRIUdomzr+elZTi2p2z+HGhb31Y4/6RCtdTo9I+aP mJOcTf+6Ovu63Dx4a55Kh1Psy1UNkolNhkBoAydTWHDbdOqsKYUVfaqE9aYb5R3SLDTn TNWEJkrgeSqSAKgq4DE1NcsGzZpXFtXNhtdcmOigiWhSj+cUnp26kllmOY5CpPTTZmlp vP7A== X-Gm-Message-State: AOJu0YwRZX/vyBA5lw7h4xSNxCFyk12mQdOt760C1DRQtUBuFWoW3tbc Jd/hVD2DAWxNKMxfjeTRvuUXVPcKRkgbfdb6eiLR5zShcSWN2lpxmdq0Sds5/TehwB7MpzbpX0H jE9S9bA== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a81:5709:0:b0:5f8:bd56:176f with SMTP id l9-20020a815709000000b005f8bd56176fmr2362476ywb.2.1705968378456; Mon, 22 Jan 2024 16:06:18 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:02 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 3/5] perf test: Workaround debug output in list test From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788839992104592904 X-GMAIL-MSGID: 1788839992104592904 Write the json output to a specific file to avoid debug output breaking it. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/list.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/shell/list.sh b/tools/perf/tests/shell/list.sh index 22b004f2b23e..8a868ae64560 100755 --- a/tools/perf/tests/shell/list.sh +++ b/tools/perf/tests/shell/list.sh @@ -3,17 +3,32 @@ # SPDX-License-Identifier: GPL-2.0 set -e -err=0 shelldir=$(dirname "$0") # shellcheck source=lib/setup_python.sh . "${shelldir}"/lib/setup_python.sh +list_output=$(mktemp /tmp/__perf_test.list_output.json.XXXXX) + +cleanup() { + rm -f "${list_output}" + + trap - EXIT TERM INT +} + +trap_cleanup() { + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + test_list_json() { echo "Json output test" - perf list -j | $PYTHON -m json.tool + perf list -j -o "${list_output}" + $PYTHON -m json.tool "${list_output}" echo "Json output test [Success]" } test_list_json -exit $err +cleanup +exit 0 From patchwork Tue Jan 23 00:06:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 190517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp39805dyi; Mon, 22 Jan 2024 16:28:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+46jCybL6YKyjgq8sz2jkEkhp0MXeFB7PF0NyP4KAY7sdqAJkaY8turBRzdniHxlaj2Py X-Received: by 2002:a05:6830:20d0:b0:6dd:ec51:5bb6 with SMTP id z16-20020a05683020d000b006ddec515bb6mr3570343otq.67.1705969707493; Mon, 22 Jan 2024 16:28:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705969707; cv=pass; d=google.com; s=arc-20160816; b=uJjh5PwY6s/7qFvV7aNNJRnDrFt3uATupr2eFRLDbjzNCI9e+yYmiNdSVDy+01W/OB NiYJ4rptFnjU6WjARvKLmgugyIcZFvJyQdV/bGQnD5KkpskJmcZO7isSVwil+i79RKxq /QT/fII6d/CIdcCZrmpyIvq7jcdGzMdQxTSPj+1Jo+//0KWLi9X6z6lerSsE8YJIl/Wq ituOrcqXpZ5mSVzn85vpRL25xsu7cGqymFRzxwCIbCT9D8ZgJGao3RUtBGaFgQmnIPwz RLpAeqsO7aCeb10yadJeWSh7I9Kou/xkFT77lZ6xufOw7LuzcFk6HqQ6pFoHczYINhTe 0/cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=q79azOTXwSlimUfkUpJ2p/ZsQdIQmqJ7jFQrY/iqycY=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=NGRH6JWX1xuiYufVBZabj+8fcnDB3vB8W8Ulkj1sMJ6We66N65FkaFI9npfiAsf6sG UucZUMdgXPjuPJWCtSqb02ItAMcQVCxeIUb/SDvLkuU5SJZworwM9Q8Bm7cppPHKwLa3 l+pkydmWEkwFRGDAtOTIb0stttSMQVChnEGpnbyoZSmxhalN/LrXF+KOpjT/DLMGGIlr 5vGYzdo8OCYzqpH3zGYIOn86g2noE2Q8HS5Ra4THiRHPk9GnbIxsfKShpRqZy1tpxPDX ZrKKFGlWRnWxzxsb1NEC0aIZKfP5ICAVOkzeuFvuBcOfnKGEbSN9/fhlY3mZ9DTZvE8l JfSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gmr27no4; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34439-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id du1-20020a05620a47c100b0078394eddfc4si5616155qkb.599.2024.01.22.16.28.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:28:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gmr27no4; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34439-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4783B1C27F8F for ; Tue, 23 Jan 2024 00:28:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5CD21482F0; Tue, 23 Jan 2024 00:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gmr27no4" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A10CE1474A5 for ; Tue, 23 Jan 2024 00:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968383; cv=none; b=L2A9/8882Fr48P2m3Xve699v2SiUGEY0rujYjT5mr3U3FgNhkT6NrQ4EJL7XF9otvzoJ3vmZiFJf0YdoFHavk5pW824/ial71VxL+AFyt+EmbE2A9jGYG6Qy1avXlF3xgXlyFbY4gSRGXk1mUUTIVzGA4W2zV9GBeqh5HYxcZ18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968383; c=relaxed/simple; bh=IEvafp8noNqOSfOmOKDMTOQOH5/R9XopGqVio4nEPyc=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZfiY1Rupx6uuqsUdpxS5P5H2V7YJ2ROvv+XT9uBz/ti66RJthhKX8mzdDKz1+DAY7I8bcn2RIGx4/zOC+SoUfndIs8i+MI1aZNKbiy15NtrqAfgwN5KmeHpjuyqxlLlVW4G3sAj2ks1z4/GHHuzoq/YlaPBv4JHZMznHMgp+tWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gmr27no4; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc24eb13fecso4685816276.0 for ; Mon, 22 Jan 2024 16:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968381; x=1706573181; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=q79azOTXwSlimUfkUpJ2p/ZsQdIQmqJ7jFQrY/iqycY=; b=gmr27no4HkxKA6Oy5axRfTVGcB5pDb4hJOHV1Xf8ZPXxlh2gEmoozDSJo40O/9tzpd vg6ds6KjHZoVDxQgDs5sPUJnx5rWUxP11jck4JG9De9atfJo/8I+dX1InkRiVqFwFrzB Bk+Fr0hm8AqexjBS8lXDvtn0v6tz5GnMWXcpd+COIv4+ySgMTOlq/7ElmVK/aiy19LgO AxICSAwWVE/CycYPutxKp+p0gqhcIbNe4n8hWTW7Lr2+ikVoUd/ISM71i/gggjricoBB spbs6sP62Quo5WdTumzJe6n9TbKrmYBbW9hGTgWZlLWk0uMuz4sn2FJoh+DvKiCR20DC 2sXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968381; x=1706573181; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q79azOTXwSlimUfkUpJ2p/ZsQdIQmqJ7jFQrY/iqycY=; b=JgdCsbvnutlwqNfVG345hvv4XAb+9wO29KdAHzYW4NjmKyqh91wu3zMbjH9tN3RL2+ hTmCl2nuX846aUoiCxmrvbMLfcoLLNKPyNMzkHsUEWzUvsjxar8hHt38voNKjH6kKJyj 4mbH0qoLPiissV03RgCUFJzn+lGzxchL4rXKDtWLFXVrsn/Xu6mPpgqKrKxAJqRS8pGh YV/vMu+afAX1z4C5aIYrBHq/WUdEroy6MfJ/M6Id6Plz0coDWm5lkiYTk5ehw3cHn9Is E3uRIRO+jdQt1WT8mdsy5cq6rShb0LbaAb+/Mfn+PxgIkoQtkDSl36elsZndRG0Q6Mgq IzEQ== X-Gm-Message-State: AOJu0Yx39bHVfT3VHIVfglUMc0Sax4Qnd3wb/3oCO6GS6xL9pAJD8SLz wQmtBewyXwn5ksiC3rSrNYoIsDsscAI+9azlcaUJy/WUVklHSLIyxLPxjdqCkQzZcXHioZg2AQ/ kOofrnA== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a05:6902:352:b0:dc3:696e:ffae with SMTP id e18-20020a056902035200b00dc3696effaemr438504ybs.3.1705968380873; Mon, 22 Jan 2024 16:06:20 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:03 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 4/5] perf test: Fix script test for python being disabled From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788838891916945011 X-GMAIL-MSGID: 1788838891916945011 "grep -cv" can exit with an error code that causes the "set -e" to abort the script. Switch to using the grep exit code in the if condition to avoid this. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/script.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/script.sh b/tools/perf/tests/shell/script.sh index 5ae7bd0031a8..b43077dbaf98 100755 --- a/tools/perf/tests/shell/script.sh +++ b/tools/perf/tests/shell/script.sh @@ -36,8 +36,7 @@ test_db() echo "DB test" # Check if python script is supported - libpython=$(perf version --build-options | grep python | grep -cv OFF) - if [ "${libpython}" != "1" ] ; then + if perf version --build-options | grep python | grep -q OFF ; then echo "SKIP: python scripting is not supported" err=2 return From patchwork Tue Jan 23 00:06:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 190545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp43527dyi; Mon, 22 Jan 2024 16:38:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1Aey0sZyzWK9qyNcLr52B3FPGT4D2AG81TW0ugJOfCL2UfRaQaxBYoPC+UN89LkeWynZI X-Received: by 2002:a17:90a:4c82:b0:28f:f70b:a272 with SMTP id k2-20020a17090a4c8200b0028ff70ba272mr2332648pjh.21.1705970289485; Mon, 22 Jan 2024 16:38:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705970289; cv=pass; d=google.com; s=arc-20160816; b=m8ttc61Mp/tz1bcP1M2xEfK0x3/oBnM4NmoWWHvzhTGF04b769I7pe9YFSW08mbaDC m2NI32J3g2Q3HqOY8LoBUaN8QFEhg25aDM6ZRQ9b9+DehkyOuQub7wAgeVYBRcUb+jOK WIX/MJPy5gXvbF0KPgm+mwaeQBVhxg59py77agkPuFqwBg3Lj1byb1IX4Shn2n98Bi9n /S/P8YnmmhtQW8NbdS5aG3BklyLzUIE+AKBMDuRXGH5pnE0UPQgAcOQNlcncZYqP49R5 bkijlltfIQLXC7ADn88ChRD4xFWtRk16RsI5TBE1FwLUIRRR5UiCaljuwJ+yoRxcT/mw 6Tpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=mlN6A8juJEER+izsNXvsEIZz1p6Al9v8V+UObNcvASh9jY8+8Yxf+LBWY9Nd4qeGGo QToIx4pd4OQQpr8hFKnjCsvoUbetYdltN52RUlptqzcq3ohhOWxGdrAltmmzqB+zBsX6 bXExIhO32EVUyOFKADfD55OSpRdgIx4LJGqo6FTH+Vfv5oZdtwRJfgdsvpLxCrc41j4/ 43wYN+RwaoPwIlfO0sS1Omh9kd+no8INO198eT23zy9rNphlZNXr19hR9w4R4/0GnbZb OXXcU813HobzXw3O7gVLxl0LYCvpfy3yMnU+N+r09+5va5pQ7yLxwf+WukUjCRXsAkxd y5DQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nH3pPjWn; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cq16-20020a17090af99000b0028ffc9c1453si8908017pjb.21.2024.01.22.16.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nH3pPjWn; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C17128C124 for ; Tue, 23 Jan 2024 00:28:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A85514830B; Tue, 23 Jan 2024 00:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nH3pPjWn" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 086AF1474D5 for ; Tue, 23 Jan 2024 00:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968385; cv=none; b=IHdZfi59TuEdhzRQHXk4OpwacUrtVPCxYR0QwZ9aZAnCIltDBMliEEIBHwRZDPTdyy0qmVDNXbf1cVlle7QQWFDOIHsdUdcynPTf+znsA+kWjhRKWWrf/49bIzyd6HO6St+wOywKIJj79jLkjYpRga1yWmB3pa/6VGoiC5cZ270= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968385; c=relaxed/simple; bh=FCUxXLEqX6wbauWA6R/m3LLJXqQAbHJBX+CMyQoYlc0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=PQvnfx+abIkwwt8q/+XDIZNozIfJ8GDGNuyooVModRQj7gWLLl9mkYftbMxJTqK0ZEvvdLekZOGCpmhg8jV1MGjMUivfnXLpG1Fm7+XAZEg3uzXrzpcWkMn4eotVNWiDRVZ7+WjaGH8f9btIiLv2jzYmCcLLEr2tCnItvtp+03E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nH3pPjWn; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5f325796097so65306467b3.1 for ; Mon, 22 Jan 2024 16:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968383; x=1706573183; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; b=nH3pPjWnwi6JgAGKa/p8fnkmY3+bZgE8U7E6wBrSOJqAivLHmyX05OjLpEHvmVEG5k bl2iUPOlNsAbcYuOK2zY4cC3EdknIRdD7au0Re22vRhn0bo8xZS3R+u1EJM5zmzH1+Ej J/A2NMoaUQQMPxudflVyR8xDV8UoDWiA3jgsdD+q76uwCRkyi5iXfr/d92WDK0cgnUT9 BEhnNXYla4pvLBqTPl0SsIwQ7c6/GU7aBQpvUVsZFr6lIQEtWnAazK+DVr1X31fkPGWg ngOCy6O8jEE4g7iu+KlFsNs456iRmlC7Ri7CEEb3HiVA98w2ePzIt8VnyiP83/kHEEuZ tGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968383; x=1706573183; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; b=AHiLcJt+qHgRAXANn+Dj5Ccf0izhJ3Ai8l6471j5aGC+ukRKeIg4bLcEGM/EtqSEuB 2Gxh8yyUMFGmeMZvhRPmsDGRNioLffqXIITMxUsLcjtiPEExPW2ABb/fgKaGomNkWSMZ zrBT68ibledBvqyX+2FV0C9M71JRQ8MCairmwfYmnmVSnnZxGglAMbB8WSL1UVYM2xlp vbfXvwVk0mZFa9SsVIfEWkonsQ8YCs9lEN6JkaQacl5e03JURn/HJZzClUhmQBJWVZKY 9yc3gzVNXZ55yu+b0/zWE94pipEar7Ezw1XExm4T2feUsAVoNhTAhvhZBTnLTF84YSCN xZDA== X-Gm-Message-State: AOJu0YwTSpdd2pyes230Y3V4Y81efCOHkt0xCc0t2/FzqwJEUhWvHVhv sJCiG3ZJk/zE3mMvOQmKYImOJn9Wa0QwuR+cQlnTvc5seqII7kvcwm7fJzpdn9utYewE9Lehmpz o6EUVmw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a0d:cc52:0:b0:5ff:a9fa:2722 with SMTP id o79-20020a0dcc52000000b005ffa9fa2722mr2416222ywd.3.1705968383026; Mon, 22 Jan 2024 16:06:23 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:04 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 5/5] perf test: Make daemon signal test less racy From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788839502076309048 X-GMAIL-MSGID: 1788839502076309048 The daemon signal test sends signals and then expects files to be written. It was observed on an Intel Alderlake that the signals were sent too quickly leading to the 3 expected files not appearing. To avoid this send the next signal only after the expected previous file has appeared. To avoid an infinite loop the number of retries is limited. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/daemon.sh | 34 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh index 4c598cfc5afa..de61e7898578 100755 --- a/tools/perf/tests/shell/daemon.sh +++ b/tools/perf/tests/shell/daemon.sh @@ -414,16 +414,30 @@ EOF # start daemon daemon_start ${config} test - # send 2 signals - perf daemon signal --config ${config} --session test - perf daemon signal --config ${config} - - # stop daemon - daemon_exit ${config} - - # count is 2 perf.data for signals and 1 for perf record finished - count=`ls ${base}/session-test/*perf.data* | wc -l` - if [ ${count} -ne 3 ]; then + # send 2 signals then exit. Do this in a loop watching the number of + # files to avoid races. If the loop retries more than 600 times then + # give up. + local retries=0 + local signals=0 + local success=0 + while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do + local files + files=`ls ${base}/session-test/*perf.data* | wc -l` + if [ ${signals} -eq 0 ]; then + perf daemon signal --config ${config} --session test + signals=1 + elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then + perf daemon signal --config ${config} + signals=2 + elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then + daemon_exit ${config} + signals=3 + elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then + success=1 + fi + retries=$((${retries} +1)) + done + if [ ${success} -eq 0 ]; then error=1 echo "FAILED: perf data no generated" fi