All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filippo ARCIDIACONO <filippo.arcidiacono@st.com>
To: gaowanlong@cn.fujitsu.com
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] getrusage04: add opportunity to increase the max [us]time increment
Date: Thu, 23 Feb 2012 11:21:51 +0100	[thread overview]
Message-ID: <016501ccf214$f5f05da0$e1d118e0$@arcidiacono@st.com> (raw)
In-Reply-To: <4F4609F6.5060008@cn.fujitsu.com>



> -----Original Message-----
> From: Wanlong Gao [mailto:gaowanlong@cn.fujitsu.com]
> Sent: Thursday, February 23, 2012 10:42 AM
> To: Filippo ARCIDIACONO
> Cc: ltp-list@lists.sourceforge.net
> Subject: Re: [LTP] [PATCH] getrusage04: add opportunity to increase the
> max [us]time increment
> 
> On 02/23/2012 04:23 PM, Filippo ARCIDIACONO wrote:
> 
> > From: Filippo Arcidiacono <filippo.arcidiacono@st.com>
> >
> > On slow systems it could be needed to increase the max value [us]time
> > increment beetween two getrusage calls.
> >
> > Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
> > Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
> > ---
> >  testcases/kernel/syscalls/getrusage/getrusage04.c |   42
> +++++++++++++++++---
> >  1 files changed, 35 insertions(+), 7 deletions(-)
> >
> > diff --git a/testcases/kernel/syscalls/getrusage/getrusage04.c
> b/testcases/kernel/syscalls/getrusage/getrusage04.c
> > index 3bdd3b0..92f8361 100644
> > --- a/testcases/kernel/syscalls/getrusage/getrusage04.c
> > +++ b/testcases/kernel/syscalls/getrusage/getrusage04.c
> > @@ -54,11 +54,22 @@ int TST_TOTAL = 1;
> >
> >  #define BIAS_MAX      1000
> >  #define RECORD_MAX    20
> > +#define FACTOR_MAX    10
> >
> >  #ifndef RUSAGE_THREAD
> >  #define RUSAGE_THREAD 1
> >  #endif
> >
> > +static int opt_factor;
> > +static char *factor_str;
> > +static long factor_nr = 1;
> > +
> > +option_t child_options[] = {
> > +	{ "m:", &opt_factor, &factor_str },
> > +	{ NULL, NULL,         NULL }
> > +};
> > +
> > +static void fusage(void);
> >  static void busyloop(long wait);
> >  static void setup(void);
> >  static void cleanup(void);
> > @@ -69,8 +80,9 @@ int main(int argc, char *argv[])
> >  	unsigned long ulast, udelta, slast, sdelta;
> >  	int i, lc;
> >  	char *msg;
> > +	char msg_string[BUFSIZ];
> >
> > -	msg = parse_opts(argc, argv, NULL, NULL);
> > +	msg = parse_opts(argc, argv, child_options, fusage);
> >  	if (msg != NULL)
> >  		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> >
> > @@ -80,6 +92,11 @@ int main(int argc, char *argv[])
> >
> >  	setup();
> >
> > +	if (opt_factor)
> > +		factor_nr = SAFE_STRTOL(cleanup, factor_str, 0,
> FACTOR_MAX);
> > +
> > +	tst_resm(TINFO, "Using %ld as multiply factor for max [us]time
> increment (1000+%ldus)!", factor_nr, BIAS_MAX * factor_nr);
> 
> 
> Could you please fix the over 80 characters warning?

Ok.
> 
> > +
> >  	for (lc = 0; TEST_LOOPING(lc); lc++) {
> >  		Tst_count = 0; i = 0;
> >  		ulast = 0, slast = 0;
> > @@ -95,14 +112,20 @@ int main(int argc, char *argv[])
> >  				tst_resm(TINFO, "utime:%12luus;
stime:%12luus",
> >  					    usage.ru_utime.tv_usec,
> >  					    usage.ru_stime.tv_usec);
> > -				if (udelta > 1000+BIAS_MAX)
> > -					tst_brkm(TFAIL, cleanup,
> > -						    "utime increased >
1000us:"
> > +				if (udelta > 1000+(BIAS_MAX * factor_nr)) {
> > +					sprintf(msg_string,
> > +						"utime increased > %ldus:",
> > +						1000 + BIAS_MAX *
factor_nr);
> > +					tst_brkm(TFAIL, cleanup, msg_string,
> >  						    " delta = %luus",
udelta);
> > -				if (sdelta > 1000+BIAS_MAX)
> > -					tst_brkm(TFAIL, cleanup,
> > -						    "stime increased >
1000us:"
> > +				}
> > +				if (sdelta > 1000+(BIAS_MAX * factor_nr)) {
> > +					sprintf(msg_string,
> > +						"stime increased > %ldus:",
> > +						1000 + BIAS_MAX *
factor_nr);
> > +					tst_brkm(TFAIL, cleanup, msg_string,
> >  						    " delta = %luus",
sdelta);
> > +				}
> >  			}
> >  			ulast = usage.ru_utime.tv_usec;
> >  			slast = usage.ru_stime.tv_usec;
> > @@ -113,6 +136,11 @@ int main(int argc, char *argv[])
> >  	tst_exit();
> >  }
> >
> > +static void fusage(void)
> > +{
> > +	printf("  -m n    use n as multiply factor for max [us]time
> increment (1000+(1000*n)us), default value is 1\n");
> 
> 
> ditto
> 
> 
> Thanks
> -Wanlong Gao

I'll post a new version.
Thanks for the review.

Filippo.
> 
> > +}
> > +
> >  static void busyloop(long wait)
> >  {
> >  	while (wait--)
> 



------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2012-02-23 10:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  8:23 [LTP] [PATCH] getrusage04: add opportunity to increase the max [us]time increment Filippo ARCIDIACONO
2012-02-23  9:42 ` Wanlong Gao
2012-02-23 10:21   ` Filippo ARCIDIACONO [this message]
     [not found] <4f45f838.8aa82a0a.6cc7.334fSMTPIN_ADDED@mx.google.com>
2012-06-18  8:50 ` Andrew Yan-Pai Chen

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='016501ccf214$f5f05da0$e1d118e0$@arcidiacono@st.com' \
    --to=filippo.arcidiacono@st.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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.