From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Christian Brauner <brauner@kernel.org>,
James Clark <james.clark@arm.com>,
Kan Liang <kan.liang@linux.intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Yicong Yang <yangyicong@hisilicon.com>,
Kajol Jain <kjain@linux.ibm.com>,
Disha Goel <disgoel@linux.ibm.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Song Liu <songliubraving@fb.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: [PATCH v1 2/4] perf test: stat output per thread of just the parent process
Date: Thu, 29 Feb 2024 23:46:37 -0800 [thread overview]
Message-ID: <20240301074639.2260708-2-irogers@google.com> (raw)
In-Reply-To: <20240301074639.2260708-1-irogers@google.com>
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 <irogers@google.com>
---
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]"
}
--
2.44.0.278.ge034bb2e1d-goog
next prev parent reply other threads:[~2024-03-01 7:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 7:46 [PATCH v1 1/4] perf record: Delete session after stopping sideband thread Ian Rogers
2024-03-01 7:46 ` Ian Rogers [this message]
2024-03-01 7:46 ` [PATCH v1 3/4] perf test: Use a single fd for the child process out/err Ian Rogers
2024-03-01 7:46 ` [PATCH v1 4/4] perf test: Read child test 10 times a second rather than 1 Ian Rogers
2024-03-01 7:50 ` [PATCH v1 1/4] perf record: Delete session after stopping sideband thread Ian Rogers
2024-03-20 4:42 ` Ian Rogers
2024-03-20 14:49 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240301074639.2260708-2-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=disgoel@linux.ibm.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=tim.c.chen@linux.intel.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.