From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] controllers/cpuacct: rewrote testcases
Date: Tue, 10 Nov 2015 12:00:48 +0100 [thread overview]
Message-ID: <20151110110048.GE23947@rei> (raw)
In-Reply-To: <20151109175127.GC23947@rei>
Hi!
> > +## check that cpuacct.usage != 0 for every subgroup
> > +((TST_COUNT = TST_COUNT + 1))
> > +if [ "$error" -eq "1" ]; then
> > + tst_resm TFAIL "cpuacct.usage should not be equal to 0"
> > +else
> > + tst_resm TPASS "cpuacct.usage is not equal to 0 for every subgroup"
> > +fi
>
> I'm not 100% sure that this assertion will always hold. I will have to
> look into this.
I've given it some thoughts and what we can do is to create the helper
process in a way that it kill itself after it spends defined time
executing code.
#include <stdio.h>
#include <sys/time.h>
int main(void)
{
struct itimerval it = {.it_value = {.tv_sec = 0, .tv_usec = 10000}};
setitimer(ITIMER_VIRTUAL, &it, NULL);
for (;;);
return 0;
}
This code sets up timer that sends a signal to a process after 1ms of
execution.
Now we can run as many of these as we need and then we can do wait on the pids
in the main process. That way we would have guaranteed that the execution time
is slightly above 1ms.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2015-11-10 11:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 9:35 [LTP] [PATCH] controllers/cpuacct: rewrote testcases Cedric Hnyda
2015-11-09 17:51 ` Cyril Hrubis
2015-11-09 19:05 ` Cyril Hrubis
2015-11-10 11:00 ` Cyril Hrubis [this message]
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=20151110110048.GE23947@rei \
--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