public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Filippo ARCIDIACONO <filippo.arcidiacono@st.com>
To: 'Caspar Zhang' <caspar@casparzhang.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] getrusage03: add opportunity to reduce memory allocation's size
Date: Wed, 15 Feb 2012 09:27:19 +0100	[thread overview]
Message-ID: <01df01ccebbb$a2d43650$e87ca2f0$@arcidiacono@st.com> (raw)
In-Reply-To: <4F3B2FFD.3020408@casparzhang.com>

 [snip]

> >  static void inherit_fork(void);
> >  static void inherit_fork2(void);
> > @@ -77,11 +78,23 @@ int main(int argc, char *argv[])
> >
> >  	setup();
> >
> > +	if (argc > 2)
> > +		tst_brkm(TBROK, cleanup, " Too many arguments - Usage: %s
> [factor]", argv[0]);
> > +
> > +	if (argv[1])
> > +		factor_nr = atoi(argv[1]);
> > +
> > +	if (factor_nr == 0)
> > +		tst_brkm(TBROK, cleanup, "Input factor must be != 0");
> 
> Here I want to use an LTP way to pass parameters, i.e. use option_t and
> parse_opts.
> 
> Please take a look at getrusage03_child.c as example.

I have seen that but, I haven't done because it needs to pass only one number.
In any case I will follow your suggestion.

> 
> > +
> > +	tst_resm(TINFO, "Using %d as factor allocation mamory!",
> factor_nr);
> > +
> >  	for (lc = 0; TEST_LOOPING(lc); lc++) {
> >  		Tst_count = 0;
> >
> > -		tst_resm(TINFO, "allocate 100MB");
> > -		consume(100);
> > +		size = 10 * factor_nr;
> > +		tst_resm(TINFO, "allocate %dMB", size);
> > +		consume(size);
> >
> >  		inherit_fork();
> >  		inherit_fork2();
> > @@ -123,17 +136,17 @@ static void inherit_fork(void)
> >  }
> >
> >  /* Testcase #02: fork inherit (cont.)
> > - * expect: initial.children ~= 100MB, child.children = 0 */
> > + * expect: initial.children ~= (10 * factor_nr)MB, child.children =
> 0 */
> >  static void inherit_fork2(void)
> >  {
> >  	tst_resm(TINFO, "Testcase #02: fork inherit(cont.)");
> >
> >  	SAFE_GETRUSAGE(cleanup, RUSAGE_CHILDREN, &ru);
> >  	tst_resm(TINFO, "initial.children = %ld", ru.ru_maxrss);
> > -	if (is_in_delta(ru.ru_maxrss - 102400))
> > -		tst_resm(TPASS, "initial.children ~= 100MB");
> > +	if (is_in_delta(ru.ru_maxrss - (10240 * factor_nr)))
> > +		tst_resm(TPASS, "initial.children ~= %dMB", size);
> 
> `size` in this function is not initialized?

'size' is globally defined, it is initialized in the main().

> 
> >  	else
> > -		tst_resm(TFAIL, "initial.children !~= 100MB");
> > +		tst_resm(TFAIL, "initial.children !~= %dMB", size);
> >
> >  	switch (pid = fork()) {
> >  	case -1:
> > @@ -153,9 +166,11 @@ static void inherit_fork2(void)
> >  }
> >

Thanks for the review.

Filippo.


------------------------------------------------------------------------------
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-15  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 15:33 [LTP] [PATCH] getrusage03: add opportunity to reduce memory allocation's size Filippo ARCIDIACONO
2012-02-15  4:09 ` Caspar Zhang
2012-02-15  8:27   ` Filippo ARCIDIACONO [this message]
     [not found]   ` <4f3b6c8d.c1cb0e0a.3e38.354dSMTPIN_ADDED@mx.google.com>
2012-02-15 10:24     ` Caspar Zhang
2012-02-15 10:46       ` Filippo ARCIDIACONO

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='01df01ccebbb$a2d43650$e87ca2f0$@arcidiacono@st.com' \
    --to=filippo.arcidiacono@st.com \
    --cc=caspar@casparzhang.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox