plain text document attachment (gtod_inf_window.patch)
The existing test has an infinite window and report the new max each
time it is increased. The patch maintains the default behavior and
adds a -w option, allowing the user to specify a window (iteration
count) for which the max of that window is reported ever w iterations.
# ./gtod_infinite -w 1000000
jvmsim disabled
1000000 iterations in max calculation window
Task delayed for 22338 nsec!!! Thu May 15 17:37:45 2008
Task delayed for 22059 nsec!!! Thu May 15 17:37:48 2008
Task delayed for 20383 nsec!!! Thu May 15 17:37:51 2008
Task delayed for 18987 nsec!!! Thu May 15 17:37:55 2008
Task delayed for 17591 nsec!!! Thu May 15 17:37:58 2008
Task delayed for 11448 nsec!!! Thu May 15 17:38:01 2008
Test terminated with asynchronous signal
Signed-off-by: Darren Hart <[EMAIL PROTECTED]>
Acked-by: John Stultz <[EMAIL PROTECTED]>
Index: ltp/testcases/realtime/func/gtod_latency/gtod_infinite.c
===================================================================
--- ltp.orig/testcases/realtime/func/gtod_latency/gtod_infinite.c
2008-05-15 14:22:37.000000000 -0700
+++ ltp/testcases/realtime/func/gtod_latency/gtod_infinite.c 2008-05-15
14:37:07.000000000 -0700
@@ -63,12 +63,14 @@
#define REPORT_MIN 1000000
static int run_jvmsim = 0;
+static unsigned int max_window = 0; /* infinite, don't use a window */
void usage(void)
{
rt_help();
- printf("async_handler specific options:\n");
- printf(" -j enable jvmsim\n");
+ printf("gtod_infinite specific options:\n");
+ printf(" -j enable jvmsim\n");
+ printf(" -wWINDOW iterations in max value window (default
inf)\n");
}
int parse_args(int c, char *v)
@@ -81,6 +83,9 @@
case 'h':
usage();
exit(0);
+ case 'w':
+ max_window = atoi(v);
+ break;
default:
handled = 0;
break;
@@ -97,6 +102,7 @@
// cpu_set_t mask;
struct sched_param param;
time_t tt;
+ unsigned int wi;
setup();
/*
@@ -108,7 +114,7 @@
exit(1);
}
*/
- rt_init("jh",parse_args, argc, argv);
+ rt_init("jhw:", parse_args, argc, argv);
if (run_jvmsim) {
printf("jvmsim enabled\n");
@@ -117,6 +123,11 @@
printf("jvmsim disabled\n");
}
+ if (max_window > 0) {
+ printf("%d iterations in max calculation window\n",
+ max_window);
+ }
+
param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 80;
rc = sched_setscheduler(0, SCHED_FIFO, ¶m);
if (rc) {
@@ -130,6 +141,7 @@
exit(1);
}
+ wi = 0;
while(1) {
rc = clock_gettime(CLOCK_TO_USE, &ts);
if (rc) {
@@ -141,14 +153,24 @@
ts_to_nsec(&ts, &e_time);
diff_time = e_time - s_time;
- if ((diff_time > max_time) ||
- (diff_time > REPORT_MIN)) {
- tt = (time_t)ts.tv_sec;
- printf("Task delayed for %lld nsec!!! %s",
- diff_time, ctime (&tt));
- fflush(stdout);
+
+ if (max_window > 0 ||
+ ((diff_time > max_time) ||
+ (diff_time > REPORT_MIN))) {
if (diff_time > max_time)
max_time = diff_time;
+
+ if (max_window == 0 || ++wi == max_window) {
+ tt = (time_t)ts.tv_sec;
+ printf("Task delayed for %lld nsec!!! %s",
+ max_time, ctime(&tt));
+ fflush(stdout);
+
+ if (wi == max_window) {
+ max_time = 0;
+ wi = 0;
+ }
+ }
rc = clock_gettime(CLOCK_TO_USE, &p_ts);
if (rc) {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list