From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: gowrishankar <gomuthuk@linux.vnet.ibm.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] add iterations option in gtod_latency.
Date: Fri, 06 Nov 2009 13:56:33 +0100 [thread overview]
Message-ID: <4AF41D01.207@st.com> (raw)
In-Reply-To: <4AF41677.8030408@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
gowrishankar wrote:
> Giuseppe CAVALLARO wrote:
>> Regards,
>> Peppe
>>
>
> Can you please add freeing resources at the end of main.
>
> stats_container_free(&dat);
> stats_container_free(&hist);
> stats_quantiles_free(&quantiles);
>
> Also, you could set MIN_ITERATION to 10000 instead of hard coding inside
> main.
> Just a suggestion.
patch reattached!
Peppe
>
> Thanks,
> Gowri
>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>>
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment
>> - and focus on what you do best, core application coding. Discover
>> what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>
[-- Attachment #2: ltp-full-20090731-gtod_latency_iterations.patch --]
[-- Type: text/x-patch, Size: 4756 bytes --]
[PATCH (RESEND)] add iterations option in gtod_latency.
This patch adds a new option for tuning the number
of iterations into the gtod_latency realtime test.
Running gtod_latency on a target with limited resources
it fails (ENOMEM) as soon as it try to allocate the memory
for the two buffers start_data and stop_data.
Tested on i386 and sh4 architectures.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
--- ltp/testcases/realtime.orig/func/gtod_latency/gtod_latency.c 2009-11-04 15:55:58.000000000 +0100
+++ ltp/testcases/realtime/func/gtod_latency/gtod_latency.c 2009-11-06 13:54:39.000000000 +0100
@@ -56,6 +56,7 @@
#include <sys/mman.h>
#define ITERATIONS 10000000
+#define MIN_ITERATION 10000
#define HIST_BUCKETS 20
#define SCATTER_FILENAME 0
@@ -81,13 +82,14 @@ char *labels[] = {"scatter plot x-axis",
"histogram y-axis"};
static unsigned long long latency_threshold = 0;
+static unsigned int iterations = ITERATIONS;
void stats_cmdline_help(void)
{
printf("Usage: ./gtod_latency {-[so|scatter-output] -[ho|hist-output]"
" -[st|scatter-title] -[ht|hist-title] -[sxl|scatter-xlabel]"
" -[syl|scatter-ylabel] -[hxl|hist-xlabel] -[hyl|hist-ylabel]"
- " -[lt|latency-trace]}"
+ " -[lt|latency-trace] -[i|iterations]}"
" -[help] \n");
printf("**command-line options are not supported yet for this testcase\n");
}
@@ -194,6 +196,15 @@ int stats_cmdline(int argc, char *argv[]
continue;
}
+ if (!strcmp(flag, "i") || !strcmp(flag, "iterations")) {
+ if (i + 1 == argc) {
+ printf("flag has missing argument\n");
+ return -1;
+ }
+ iterations = strtoull(argv[++i], NULL, 0);
+ continue;
+ }
+
printf("unknown flag given\n");
return -1;
}
@@ -210,9 +221,6 @@ long long timespec_subtract(struct times
return ns;
}
-struct timespec start_data[ITERATIONS];
-struct timespec stop_data[ITERATIONS];
-
int main(int argc, char *argv[])
{
int i, j, k, err;
@@ -222,16 +230,38 @@ int main(int argc, char *argv[])
stats_container_t dat;
stats_container_t hist;
stats_quantiles_t quantiles;
+ struct timespec *start_data;
+ struct timespec *stop_data;
+
+ if (stats_cmdline(argc, argv) < 0) {
+ printf("usage: %s help\n", argv[0]);
+ exit(1);
+ }
+
+ if (iterations < MIN_ITERATION) {
+ iterations = MIN_ITERATION ;
+ printf("user \"iterations\" value is too small (use: %d)\n",
+ iterations);
+ }
- stats_container_init(&dat, ITERATIONS);
+ stats_container_init(&dat, iterations);
stats_container_init(&hist, HIST_BUCKETS);
- stats_quantiles_init(&quantiles, (int)log10(ITERATIONS));
+ stats_quantiles_init(&quantiles, (int)log10(iterations));
setup();
mlockall(MCL_CURRENT|MCL_FUTURE);
- if (stats_cmdline(argc, argv) < 0) {
- printf("usage: %s help\n", argv[0]);
+ start_data = calloc(iterations, sizeof(struct timespec));
+ if (start_data == NULL) {
+ printf("Memory allocation Failed (too many Iteration: %d)\n",
+ iterations);
+ exit(1);
+ }
+ stop_data = calloc(iterations, sizeof(struct timespec));
+ if (stop_data == NULL) {
+ printf("Memory allocation Failed (too many Iteration: %d)\n",
+ iterations);
+ free(start_data);
exit(1);
}
@@ -253,9 +283,9 @@ int main(int argc, char *argv[])
printf("\n----------------------\n");
printf("Gettimeofday() Latency\n");
printf("----------------------\n");
- printf("Iterations: %d\n\n", ITERATIONS);
+ printf("Iterations: %d\n\n", iterations);
- /* collect ITERATIONS pairs of gtod calls */
+ /* collect iterations pairs of gtod calls */
max = min = 0;
if (latency_threshold) {
latency_trace_enable();
@@ -263,7 +293,7 @@ int main(int argc, char *argv[])
}
/* This loop runs for a long time, hence can cause soft lockups.
Calling sleep periodically avoids this. */
- for (i=0; i<(ITERATIONS/10000); i++) {
+ for (i = 0; i < (iterations/10000); i++) {
for (j=0; j < 10000; j++) {
k = (i * 10000) + j;
clock_gettime(CLOCK_MONOTONIC,&start_data[k]);
@@ -271,7 +301,7 @@ int main(int argc, char *argv[])
}
usleep(1000);
}
- for (i = 0; i < ITERATIONS; i++) {
+ for (i = 0; i < iterations; i++) {
delta = timespec_subtract(&start_data[i], &stop_data[i]);
dat.records[i].x = i;
dat.records[i].y = delta;
@@ -282,7 +312,7 @@ int main(int argc, char *argv[])
}
if (latency_threshold) {
latency_trace_stop();
- if (i != ITERATIONS) {
+ if (i != iterations) {
printf("Latency threshold (%lluus) exceeded at iteration %d\n",
latency_threshold, i);
latency_trace_print();
@@ -305,5 +335,9 @@ int main(int argc, char *argv[])
stats_quantiles_calc(&dat, &quantiles);
stats_quantiles_print(&quantiles);
+ stats_container_free(&dat);
+ stats_container_free(&hist);
+ stats_quantiles_free(&quantiles);
+
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 354 bytes --]
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
[-- 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
next prev parent reply other threads:[~2009-11-06 12:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-06 7:49 [LTP] [PATCH] add iterations option in gtod_latency Giuseppe CAVALLARO
2009-11-06 12:28 ` gowrishankar
2009-11-06 12:56 ` Giuseppe CAVALLARO [this message]
2009-11-06 14:03 ` gowrishankar
2009-11-09 17:39 ` Subrata Modak
2009-11-16 14:56 ` Giuseppe CAVALLARO
[not found] ` <4B06495F.2060600@st.com>
[not found] ` <1258712924.4986.5.camel@subratamodak.linux.ibm.com>
2009-11-20 12:01 ` Giuseppe CAVALLARO
2009-11-20 12:10 ` Subrata Modak
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=4AF41D01.207@st.com \
--to=peppe.cavallaro@st.com \
--cc=gomuthuk@linux.vnet.ibm.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