From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] ltp/numa: waiting for numastat refresh
Date: Wed, 23 Nov 2016 13:57:27 +0100 [thread overview]
Message-ID: <20161123125727.GF3346@rei.lan> (raw)
In-Reply-To: <1479872202-29920-1-git-send-email-liwang@redhat.com>
Hi!
> +wait_for_update()
> +{
> + NUMASTAT_PATH="/sys/devices/system/node/node$1/numastat"
> + local loop=0
>
> + while [ $loop -lt 5 ]; do
> + sum_value=0
> +
> + for i in $(seq 200); do
> + det_value=$(grep $2 ${NUMASTAT_PATH} | cut -d ' ' -f 2)
> + sum_value=$((sum_value + det_value))
I do not understand this part, here you are summing the accumated value
over and over. That is not making any sense.
> + sync && tst_sleep 10ms
Why the sync here?
> + done
> +
> + if [ $((sum_value/200)) -eq $det_value ]; then
Here as well. It's higly unlikely that the value would be exactly equal
since the number is increased by other things the system does as well.
> + return
> + fi
> +
> + loop=$((loop+1))
> + done
> +}
This seems like a good idea generally but what would I do is something
as:
* Read the statistic with some small sleep in between as you do
* Exit once the increase is at least the expected value
* Give up if there was no increase in some well defined time or
if it generally took too much time, i.e. something as:
if the last increase of the number was more than second ago -> fail
(this could be done easily by counting time since the last increase
and resetting it if there was some)
if the number was increased steadily for more than ten seconds but
hasn't reached at least the expected value -> fail
The timing constants may need to be tuned, but AFAIC this is the best we
can do in this tests.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-11-23 12:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 3:36 [LTP] [PATCH 1/3] ltp/numa: waiting for numastat refresh Li Wang
2016-11-23 12:57 ` Cyril Hrubis [this message]
2016-11-28 3:40 ` Li Wang
2016-12-01 10:51 ` Cyril Hrubis
2016-12-02 7:49 ` Li Wang
2016-12-05 9:28 ` Cyril Hrubis
2016-12-05 10:24 ` Li Wang
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=20161123125727.GF3346@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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