public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] proc01: add option to limit max read bytes
  2012-07-31  8:33 [LTP] [PATCH] proc01: add option to limit max read bytes Jan Stancek
@ 2010-02-16  2:27 ` chrubis
       [not found]   ` <1513655937.3221262.1348143318321.JavaMail.root@redhat.com>
  2012-08-23  3:34 ` Caspar Zhang
  1 sibling, 1 reply; 5+ messages in thread
From: chrubis @ 2010-02-16  2:27 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> single proc file. When this limit is reached testcase
> will continue with next file.
> 
> Reason for this new option is to allow running this testcase
> as sanity test, that doesn't need go through full content of
> files such as "pagemap" (which can take hours).

Wouldn't adding -m to the proc01 to runtest/fs make sense too?

(so we doesn't spend too much time in proc01 in defalt runs)

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH] proc01: add option to limit max read bytes
@ 2012-07-31  8:33 Jan Stancek
  2010-02-16  2:27 ` chrubis
  2012-08-23  3:34 ` Caspar Zhang
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Stancek @ 2012-07-31  8:33 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]


Add option -m to set upper limit of read megabytes from
single proc file. When this limit is reached testcase
will continue with next file.

Reason for this new option is to allow running this testcase
as sanity test, that doesn't need go through full content of
files such as "pagemap" (which can take hours).

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/fs/proc/proc01.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-proc01-add-option-to-limit-max-read-bytes.patch --]
[-- Type: text/x-patch; name="0001-proc01-add-option-to-limit-max-read-bytes.patch", Size: 2472 bytes --]

diff --git a/testcases/kernel/fs/proc/proc01.c b/testcases/kernel/fs/proc/proc01.c
index 0a7695a..e3bc80b 100644
--- a/testcases/kernel/fs/proc/proc01.c
+++ b/testcases/kernel/fs/proc/proc01.c
@@ -58,10 +58,13 @@ static char	*opt_procpathstr;
 static int	 opt_buffsize = 0;
 static int	 opt_readirq = 0;
 static char	*opt_buffsizestr;
+static int	 opt_maxmbytes;
+static char	*opt_maxmbytesstr;
 
 static char	*procpath = "/proc";
 static char	 selfpath[] = "/proc/self";
 size_t		 buffsize = 1024;
+static long long maxbytes;
 
 unsigned long long total_read = 0;
 unsigned int total_obj = 0;
@@ -197,6 +200,7 @@ void setup()
 void help()
 {
 	printf("  -b x    read byte count\n");
+	printf("  -m x    max megabytes to read from single file\n");
 	printf("  -q      read .../irq/... entries\n");
 	printf("  -r x    proc pathname\n");
 	printf("  -v      verbose mode\n");
@@ -208,6 +212,7 @@ void help()
  */
 option_t options[] = {
 	{ "b:", &opt_buffsize,	&opt_buffsizestr},
+	{ "m:", &opt_maxmbytes,	&opt_maxmbytesstr},
 	{ "q",	&opt_readirq,	NULL },
 	{ "r:", &opt_procpath,	&opt_procpathstr},
 	{ "v",  &opt_verbose,	NULL },
@@ -243,6 +248,7 @@ long readproc(const char *obj)
 	int fd, tmperr, i;
 	ssize_t nread;
 	static char buf[MAX_BUFF_SIZE];	/* static kills reentrancy, but we don't care about the contents */
+	unsigned long long file_total_read = 0;
 
 	/* Determine the file type */
 	if (lstat(obj, &statbuf) < 0) {
@@ -373,6 +379,7 @@ long readproc(const char *obj)
 			}
 		}
 
+		file_total_read = 0;
 		do {
 
 			nread = read(fd, buf, buffsize);
@@ -400,7 +407,8 @@ long readproc(const char *obj)
 
                 		}
 
-			}
+			} else
+				file_total_read += nread;
 
 			if (opt_verbose) {
 #ifdef DEBUG
@@ -409,9 +417,13 @@ long readproc(const char *obj)
 				fprintf(stderr, ".");
 			}
 
-			total_read += nread;
-
+			if ((maxbytes > 0) && (file_total_read > maxbytes)) {
+				tst_resm(TINFO, "%s: reached maxmbytes (-m)",
+					obj);
+				break;
+			}
 		} while (0 < nread);
+		total_read += file_total_read;
 
 		if (opt_verbose)
 			fprintf(stderr, "\n");
@@ -444,6 +456,8 @@ int main(int argc, char *argv[])
 				 "Invalid arg for -b (max: %u): %s",
 				 MAX_BUFF_SIZE, opt_buffsizestr);
 	}
+	if (opt_maxmbytes)
+		maxbytes = atoi(opt_maxmbytesstr) * 1024 * 1024;
 
 	if (opt_procpath)
 		procpath = opt_procpathstr;
@@ -467,4 +481,4 @@ int main(int argc, char *argv[])
 
 	cleanup();
 	tst_exit();
-}
\ No newline at end of file
+}

[-- Attachment #3: Type: text/plain, Size: 395 bytes --]

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] proc01: add option to limit max read bytes
  2012-07-31  8:33 [LTP] [PATCH] proc01: add option to limit max read bytes Jan Stancek
  2010-02-16  2:27 ` chrubis
@ 2012-08-23  3:34 ` Caspar Zhang
  2012-08-23  3:40   ` Wanlong Gao
  1 sibling, 1 reply; 5+ messages in thread
From: Caspar Zhang @ 2012-08-23  3:34 UTC (permalink / raw)
  To: ltp-list

On 07/31/2012 04:33 PM, Jan Stancek wrote:
>
> Add option -m to set upper limit of read megabytes from
> single proc file. When this limit is reached testcase
> will continue with next file.
>
> Reason for this new option is to allow running this testcase
> as sanity test, that doesn't need go through full content of
> files such as "pagemap" (which can take hours).
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Caspar Zhang <caspar@casparzhang.com>

> ---
>   testcases/kernel/fs/proc/proc01.c |   22 ++++++++++++++++++----
>   1 files changed, 18 insertions(+), 4 deletions(-)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] proc01: add option to limit max read bytes
  2012-08-23  3:34 ` Caspar Zhang
@ 2012-08-23  3:40   ` Wanlong Gao
  0 siblings, 0 replies; 5+ messages in thread
From: Wanlong Gao @ 2012-08-23  3:40 UTC (permalink / raw)
  To: Caspar Zhang, Jan Stancek; +Cc: ltp-list

On 08/23/2012 11:34 AM, Caspar Zhang wrote:
> On 07/31/2012 04:33 PM, Jan Stancek wrote:
>>
>> Add option -m to set upper limit of read megabytes from
>> single proc file. When this limit is reached testcase
>> will continue with next file.
>>
>> Reason for this new option is to allow running this testcase
>> as sanity test, that doesn't need go through full content of
>> files such as "pagemap" (which can take hours).
>>
>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Reviewed-by: Caspar Zhang <caspar@casparzhang.com>

Pushed, thank you.

Wanlong Gao


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] proc01: add option to limit max read bytes
       [not found]   ` <1513655937.3221262.1348143318321.JavaMail.root@redhat.com>
@ 2012-10-04 14:21     ` chrubis
  0 siblings, 0 replies; 5+ messages in thread
From: chrubis @ 2012-10-04 14:21 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> Seems like a good idea. Question is, what should we choose
> as good default for maximum. I'm running it now with:
> proc01 proc01 -m 128
> 
> I chose 128MB as rule of thumb, so I can hit some real pages
> and holes (in pagemap). 128MB equals to 4194304 pages (32bits per entry).
> If page_size is 4kB, this covers first 16G of address space, so
> it's likely you hit all kinds of pagemap entries.

I've commited the change in runtest file.
(and quoted part of your mail in the commit message)

Thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-04 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-31  8:33 [LTP] [PATCH] proc01: add option to limit max read bytes Jan Stancek
2010-02-16  2:27 ` chrubis
     [not found]   ` <1513655937.3221262.1348143318321.JavaMail.root@redhat.com>
2012-10-04 14:21     ` chrubis
2012-08-23  3:34 ` Caspar Zhang
2012-08-23  3:40   ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox