linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adrián Herrera Arcila" <adrian.herrera@arm.com>
To: tmricht@linux.ibm.com, acme@kernel.org, linux-perf-users@vger.kernel.org
Cc: James.Clark@arm.com, nd@arm.com
Subject: perf tools: software regression in d0a0a511493d269514fcbd852481cdca32c95350
Date: Wed, 13 Jul 2022 08:30:37 +0100	[thread overview]
Message-ID: <f15afd38-3628-c57a-0735-1342f379b83c@arm.com> (raw)

Hello all,

The regression affects the perf command "stat" used with the option "-D 
msecs, --delay msecs". The change was introduced in v5.18 and was 
backported up to v5.15.33 of 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git. In 
v5.18, the behaviour of the affected option is described in 
tools/perf/Documentation/perf-stat.txt as follows:

"After starting the program, wait msecs before measuring (-1: start with 
events disabled). This is useful to filter out the startup phase of the 
program, which is often very different."

The program is expected to start without delay. The observed behaviour 
in v5.18 does not correspond, as demonstrated by the following experiments:

time perf stat --delay 2000 --quiet sleep 2
v5.18 output:
Events disabled
Events enabled

real    0m4.065s
user    0m0.019s
sys    0m0.028s
v5.17 output:
Events disabled
Events enabled

real    0m2.028s
user    0m0.001s
sys    0m0.008s

perf stat --delay 2000 --quiet echo "marking"
v5.18 output:
Events disabled
Events enabled
marking
v5.17 output:
Events disabled
marking
Events enabled

I think there are two behaviours that are valuable to maintain to enable 
two uses: (1) if no delay is specified, the program should start after 
counters are enabled, to prevent the unexpected behaviour that Thomas 
fixed with this change; (2) if delay is specified, the program should 
start before the delay is engaged.

Two possible solutions are: (1) though conditionals; if delay > 0, start 
the workload, then call enable_counters, which will usleep for the 
delay; if no delay, then behaviour as it is in v5.18; (2) replace 
blocking usleep with asynchronous callback, if that exists in Linux, 
that enables counters after the delay.

Any suggestions from more experienced Linux developers on which solution 
to pursue will be appreciated.

Kind regards,
Adrián.



             reply	other threads:[~2022-07-13  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  7:30 Adrián Herrera Arcila [this message]
2022-07-14 12:46 ` perf tools: software regression in d0a0a511493d269514fcbd852481cdca32c95350 Leo Yan
2022-07-28 12:44   ` Adrián Herrera Arcila
2022-07-28 14:07     ` Leo Yan
2022-07-28 22:38       ` Song Liu
  -- strict thread matches above, loose matches on Subject: below --
2022-07-09 12:57 Adrián Herrera Arcila

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=f15afd38-3628-c57a-0735-1342f379b83c@arm.com \
    --to=adrian.herrera@arm.com \
    --cc=James.Clark@arm.com \
    --cc=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=nd@arm.com \
    --cc=tmricht@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).