Skip to contentSkip to conversation

psos skin: time_slice is specified in ticks instead of ns

PATCH Applied Ronny Meeus 2 participants 3 messages Mar 15, 2013 – Mar 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 psos skin: time_slice is specified in ticks instead of ns

The pSOS skin uses a default timeslice of 1000 sec. In comments it is mentioned that the value is specified in ms while the place where the variable is used assumes that it is in ticks.

Rename time_slice to time_slice_in_ticks to make this clear. Additionally, increase the timeslice from the intended 1ms to 5ms to reduce the overhead a bit.

lib/psos/init.c +3 -3
@@ -39,7 +39,7 @@ unsigned int psos_long_names;
 
 static unsigned int clock_resolution = 1000000; /* 1ms */
 
-static unsigned int time_slice = 1000000; /* 1ms */
+static unsigned int time_slice_in_ticks = 5;
 
 static const struct option psos_options[] = {
 	{
@@ -71,7 +71,7 @@ static int psos_parse_option(int optnum,
 		clock_resolution = atoi(optarg);
 		break;
 	case time_slice_opt:
-		time_slice = atoi(optarg);
+		time_slice_in_ticks = atoi(optarg);
 		break;
 	default:
 		/* Paranoid, can't happen. */
@@ -113,7 +113,7 @@ static int psos_init(void)
 	}
 
 	/* Convert pSOS ticks to timespec. */
-	clockobj_ticks_to_timespec(&psos_clock, time_slice, &psos_rrperiod);
+	clockobj_ticks_to_timespec(&psos_clock, time_slice_in_ticks, &psos_rrperiod);
 
 	return 0;
 }
#1 lore raw
Quoted 33 lines · Ronny Meeus

The pSOS skin uses a default timeslice of 1000 sec. In comments it is mentioned that the value is specified in ms while the place where the variable is used assumes that it is in ticks.

Rename time_slice to time_slice_in_ticks to make this clear. Additionally, increase the timeslice from the intended 1ms to 5ms to reduce the overhead a bit.

lib/psos/init.c +2 -2
@@ -39,7 +39,7 @@ unsigned int psos_long_names;
 
 static unsigned int clock_resolution = 1000000; /* 1ms */
 
-static unsigned int time_slice = 1000000; /* 1ms */
+static unsigned int time_slice_in_ticks = 5;
 
 static const struct option psos_options[] = {
        {
@@ -71,7 +71,7 @@ static int psos_parse_option(int optnum,
                clock_resolution = atoi(optarg);
                break;
        case time_slice_opt:
-               time_slice = atoi(optarg);
+               time_slice_in_ticks = atoi(optarg);
                break;
        default:
                /* Paranoid, can't happen. */

lib/psos/init.c static int psos_init(void) · line 119

Quoted 8 lines
lib/psos/init.c +1 -1
@@ -113,7 +113,7 @@ static int psos_init(void)
        }
 
        /* Convert pSOS ticks to timespec. */
-       clockobj_ticks_to_timespec(&psos_clock, time_slice, &psos_rrperiod);
+       clockobj_ticks_to_timespec(&psos_clock, time_slice_in_ticks, &psos_rrperiod);
 
        return 0;
 }

To be clear, this is a patch for the xenomai forge repository.

#2 lore raw
In reply to Ronny Meeus
Quoted 10 lines · Ronny Meeus

The pSOS skin uses a default timeslice of 1000 sec. In comments it is mentioned that the value is specified in ms while the place where the variable is used assumes that it is in ticks.

Rename time_slice to time_slice_in_ticks to make this clear. Additionally, increase the timeslice from the intended 1ms to 5ms to reduce the overhead a bit.

Merged to the staging branch, on its way to mainline, thanks.

http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=eaef61542ff3ec37d40de84361d69ec309840d0a

Signature · 1 line
Philippe.