Skip to contentSkip to conversation

cyclictest: finish removal of 1 second first loops

PATCH In review Paul Gortmaker 2 participants 2 messages Feb 14, 2013 – Feb 15, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cyclictest: finish removal of 1 second first loops

From: Jim Somerville <[email protected]>

Huge latencies are observed (close to 1 second) when certain options are used in cyclictest.

The problem was 1st introduced at commit da4956cbcaf7945554f ("use interval on first loop instead of 1 second"). It removed the 1 second first timing loop out of the main path in cyclictest but left it in two other paths, namely the ones triggered by these two options:

    -r   --relative    use relative timer instead of absolute
    -s   --system      use sys_nanosleep and sys_setitimer

which in turn causes the huge latencies of close to 1 second to be reported by cyclictest with certain uses of those two options.

Here we extend the original commit to remove the 1 second hardcoded timer values from the RELTIME and ITIMER options, by simply using the actual interval provided instead.

Cc Clark Williams <[email protected]>
Cc John Kacur <[email protected]>
Cc Steven Rostedt <[email protected]>
src/cyclictest/cyclictest.c +2 -4
index abf3e8b..8c93ccb 100644
@@ -775,17 +775,15 @@ void *timerthread(void *param)
 		if (par->timermode == TIMER_ABSTIME)
 			tspec.it_value = next;
 		else {
-			tspec.it_value.tv_nsec = 0;
-			tspec.it_value.tv_sec = 1;
+			tspec.it_value = interval;
 		}
 		timer_settime(timer, par->timermode, &tspec, NULL);
 	}
 
 	if (par->mode == MODE_SYS_ITIMER) {
-		itimer.it_value.tv_sec = 1;
-		itimer.it_value.tv_usec = 0;
 		itimer.it_interval.tv_sec = interval.tv_sec;
 		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+		itimer.it_value = itimer.it_interval;
 		setitimer (ITIMER_REAL, &itimer, NULL);
 	}
 
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 42 lines · Paul Gortmaker

From: Jim Somerville <[email protected]>

Huge latencies are observed (close to 1 second) when certain options are used in cyclictest.

The problem was 1st introduced at commit da4956cbcaf7945554f ("use interval on first loop instead of 1 second"). It removed the 1 second first timing loop out of the main path in cyclictest but left it in two other paths, namely the ones triggered by these two options:

    -r   --relative    use relative timer instead of absolute
    -s   --system      use sys_nanosleep and sys_setitimer

which in turn causes the huge latencies of close to 1 second to be reported by cyclictest with certain uses of those two options.

Here we extend the original commit to remove the 1 second hardcoded timer values from the RELTIME and ITIMER options, by simply using the actual interval provided instead.

Cc Clark Williams <[email protected]>
Cc John Kacur <[email protected]>
Cc Steven Rostedt <[email protected]>
src/cyclictest/cyclictest.c +1 -2
index abf3e8b..8c93ccb 100644
@@ -775,17 +775,15 @@ void *timerthread(void *param)
 		if (par->timermode == TIMER_ABSTIME)
 			tspec.it_value = next;
 		else {
-			tspec.it_value.tv_nsec = 0;
-			tspec.it_value.tv_sec = 1;
+			tspec.it_value = interval;
 		}
 		timer_settime(timer, par->timermode, &tspec, NULL);
 	}

src/cyclictest/cyclictest.c void *timerthread(void *param) · line 789

Quoted 10 lines
src/cyclictest/cyclictest.c +1 -2
 
 	if (par->mode == MODE_SYS_ITIMER) {
-		itimer.it_value.tv_sec = 1;
-		itimer.it_value.tv_usec = 0;
 		itimer.it_interval.tv_sec = interval.tv_sec;
 		itimer.it_interval.tv_usec = interval.tv_nsec / 1000;
+		itimer.it_value = itimer.it_interval;
 		setitimer (ITIMER_REAL, &itimer, NULL);
 	}
 

Thanks Jim and Paul, I've added it to my queue for the next build.

John