From patchwork Fri Mar 1 07:46:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 208684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp922934dyb; Thu, 29 Feb 2024 23:56:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUINyiQZ9EItLR+2/6sBT4bYSilKpbA9b8s2fASjav1bj0M9wGaQjhZxbb26N3tsqVI626VNmXkzcV3FNGB+gWbdAFs9g== X-Google-Smtp-Source: AGHT+IFMK0e9I4ETMHQ8UQ5+I4LUnPRPcrYnjknLCMEXAcyUhkDGe84l8tSe8EVzaPSg6o8ZkoNC X-Received: by 2002:a05:6808:11c3:b0:3c1:c9ad:7525 with SMTP id p3-20020a05680811c300b003c1c9ad7525mr1081464oiv.29.1709279802901; Thu, 29 Feb 2024 23:56:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709279802; cv=pass; d=google.com; s=arc-20160816; b=DrZ4EzmoUwKrRyN/B30tJjAfpl1JP6Smnhal2PHP9lrpwQdXWDqIYiZhTAzCBEy+ra GKE1nwOT/QsBkDuKMmlkBh5vhkSAwRQSjuShPIHE2kCxbCI5iJ0XYYtWO+MvB+reKDF8 yQamjt2rZTqjHh4WyyHv/Ksrl3IYxu4Ie1YWNrJgWviUIm2+s8ZMfyBpHMGqZtQ1TYMe Svcfuq6r9y8px4mOmMKVcXEKNjb/hWF4B72fn0UyxMDVxEzfVjDiz+3ZsnilEIk0k+16 QtgSHDtZmNNnTR26WkC+bti3LjXgEK4XsC6QPS4nYmFQ9nyV0BDpCvyECg2WK+5xdq48 r6pw== 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=7Hog9+5whTjGin5G0M4AR3EFSxPaJm96RaOiuDoEPKc=; fh=1XfB4a+cNz8EkiBS6QhOGZgRV6xv4ukUdyinLj/F+Xw=; b=ieEHz4ec98LItaE7d+vSinhZ8c5O+ZxneeS/zSleziX9govgHafE1DwqHOiJyFiHFi XoWU5YjdXCnB5osFi2Q1jNQfe8T+UfHC4ebKN1MH4cedeaTBHQcwoPyT71JdveMWYkpE NE8tQyk6wqNSAn2x3GS8iFJgo+V3RHC1WraldgnlIKnKOJviVE3Hbql4/BlWZa9X6hgZ +Dl/M4E6sa94UvxJjMyYg+vBGpjpw48xRavHfetVtufedCnnDYQHbCjz8M2EH2lxlQMP DZmZfrYfgQFMw0DxJ02oCIweKE7e1tjEpkVneJZ9C16m0IbcTgpvuX7mgw2UPYeSsJ57 nz5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=0FlNYgO2; 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-88023-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88023-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 d2-20020a63bd42000000b005dbec91be93si3031860pgp.595.2024.02.29.23.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 23:56:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88023-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=0FlNYgO2; 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-88023-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88023-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 012CB28C2A7 for ; Fri, 1 Mar 2024 07:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43FBC69DE9; Fri, 1 Mar 2024 07:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0FlNYgO2" 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 CABC469970 for ; Fri, 1 Mar 2024 07:47:04 +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=1709279226; cv=none; b=BRS66o2/xwg3OVrSx6KD8/kBjrQIMb8Ud97tWuR+liV+BLjQpFCblofKx9qMv3bCwtFivcnNJEk/7Ehm/yeThtnILDMZ9h0gGHBActmXPsKWr9SF3zWikm3+qVPGXOZeBFKCNYFnlPJL1Bj/0ktv6XxfY0/Glz0qkLDlkh+9i0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709279226; c=relaxed/simple; bh=VOm7IPIBVo5PZ4RqJQ+la336Qu+bZ3B28KGc7lbQY1c=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=k6E+JbUBzTNXwWfANvzhKQoscXMyFAsjY60rPkW11hzbWxsaRAChEMHcXJnWMr+nL3N2qRmcxR7wI2Rh75UInpZNxuYqO5rs819hXUDdadrs6GicLVjHAxJZP8/BGt4e88Ec2J2UJ+fWhctWjxdq2ELVa8Zv+cBBK+tD24NuDEg= 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=0FlNYgO2; 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-5f38d676cecso38366467b3.0 for ; Thu, 29 Feb 2024 23:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709279224; x=1709884024; 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=7Hog9+5whTjGin5G0M4AR3EFSxPaJm96RaOiuDoEPKc=; b=0FlNYgO2kqOhGSyfpAQQBJL1dd7rKBTXhz3pINcsFfaMqmJcqnTG38B6jaOJlZXlQY WlsuBT/nNTGPGC//5tqc4rpTUVLgYs4rpPPNsIzpypx8lnlebYPINeUbAMKDXKQ29chz LmHhrF1YPf+sJ4JZiSSvs1CnCaeR+eszxK/wEI/buDluavltGj5Zp0Ht9VOag+wmoP5l VDoLtK/uit8Qwl7HUGHYZa0xIVsnJ23fCW6CxulTSv6DVMQdI+l5fAmJTaQz5xPSYsXV NstLWqmsKtuX1zhq9l/EYAI9DC1uZmnzCfFvv/fUdPRFx4qfsdp+2pFqqs9yh4+jcOSO oIaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709279224; x=1709884024; 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=7Hog9+5whTjGin5G0M4AR3EFSxPaJm96RaOiuDoEPKc=; b=jxpYR512aQ9Ry06nij2TG7O7f9Vx+KFnYcphBe8WDw0kYv3HpXtsOcEYnmMBaL9fmV zEXOmxZfOp8e8b9qQTh7AGiiHD2jUHJEXWZdC3UkJYo+8cmFi9h/zpy31y7fav5y6oH8 slbTzH446S7/2X6QiyhblVUSgli9GcPGv+X0ICkYG5QMrnYztdhOa8FoAUTRH/Al9dCk 9RhVhE/UBS/xrWt9DLXc+CP4/6LUqaWA4/8kfWSaDoD72PENeetzaFEHRL38DICN/ngr LHP+4lwvjJ6GjF9ziQBHlUPDbrvGwiwk67FAhPLw/cOz7/f1vvUc9JWL+1VK0oYV5AuE kq+g== X-Forwarded-Encrypted: i=1; AJvYcCUylwMOVbFJDHR9Lry3Y3jNauVWE5piRr5WrX9upD5UhOsVHOVnu05vA4oszmPcw/8QzzHr/eiBkJFEcOecCjjBAuWrO3ieU4XKhPZP X-Gm-Message-State: AOJu0YxizHplgQCGm/QIl0UsnS4KRDWC7QWkG3yvZ4K5tgEdLXAw0GCg t+HO5WuIW19WQQlZcbQxNfMD2gXntQ0DtoSb4iQDAG555YBhssy1viIcXAlWIJene/SE9LytBpW cx9g3jg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:af4b:7fc1:b7be:fcb7]) (user=irogers job=sendgmr) by 2002:a05:6902:1249:b0:dc7:7655:46ce with SMTP id t9-20020a056902124900b00dc7765546cemr280153ybu.2.1709279223896; Thu, 29 Feb 2024 23:47:03 -0800 (PST) Date: Thu, 29 Feb 2024 23:46:37 -0800 In-Reply-To: <20240301074639.2260708-1-irogers@google.com> Message-Id: <20240301074639.2260708-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: <20240301074639.2260708-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v1 2/4] perf test: stat output per thread of just the parent process From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Christian Brauner , James Clark , Kan Liang , Tim Chen , Athira Rajeev , Yicong Yang , Kajol Jain , Disha Goel , K Prateek Nayak , Song Liu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792309778054106064 X-GMAIL-MSGID: 1792309778054106064 Per-thread mode requires either system-wide (-a), a pid (-p) or a tid (-t). The stat output tests were using system-wide mode but this is racy when threads are starting and exiting - something that happens a lot when running the tests in parallel (perf test -p). Avoid the race conditions by using pid mode with the pid of the parent process. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/lib/stat_output.sh | 2 +- tools/perf/tests/shell/stat+json_output.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/lib/stat_output.sh b/tools/perf/tests/shell/lib/stat_output.sh index c81d6a9f7983..9a176ceae4a3 100644 --- a/tools/perf/tests/shell/lib/stat_output.sh +++ b/tools/perf/tests/shell/lib/stat_output.sh @@ -79,7 +79,7 @@ check_per_thread() echo "[Skip] paranoid and not root" return fi - perf stat --per-thread -a $2 true + perf stat --per-thread -p $$ $2 true commachecker --per-thread echo "[Success]" } diff --git a/tools/perf/tests/shell/stat+json_output.sh b/tools/perf/tests/shell/stat+json_output.sh index 2b9c6212dffc..6b630d33c328 100755 --- a/tools/perf/tests/shell/stat+json_output.sh +++ b/tools/perf/tests/shell/stat+json_output.sh @@ -105,7 +105,7 @@ check_per_thread() echo "[Skip] paranoia and not root" return fi - perf stat -j --per-thread -a -o "${stat_output}" true + perf stat -j --per-thread -p $$ -o "${stat_output}" true $PYTHON $pythonchecker --per-thread --file "${stat_output}" echo "[Success]" }