aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-03-29 13:13:42 -0400
committerJohn M. Calandrino <jmc@jupiter-cs.cs.unc.edu>2007-03-29 13:13:42 -0400
commita26ca1ee3cdbae24fadc87110c104b1c4aa9f51d (patch)
treeefc4ce48e94d1765195ddc95484252c6664be725 /kernel
parent8502e3a54384e2411dc17d55573825abfc0726e5 (diff)
Checkpoint: almost all support added. Compiles.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/litmus.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/kernel/litmus.c b/kernel/litmus.c
index dbeca929a7..a5c256505d 100644
--- a/kernel/litmus.c
+++ b/kernel/litmus.c
@@ -290,25 +290,29 @@ asmlinkage int sys_scheduler_setup(int cmd, void __user *parameter)
290 * Based on the current time, are we in the blocking zone? If so, 290 * Based on the current time, are we in the blocking zone? If so,
291 * return one, otherwise zero. 291 * return one, otherwise zero.
292 */ 292 */
293#define ZONE_SIZE 10 /* size of blocking zone, in us */
294asmlinkage int sys_in_blocking_zone(void) 293asmlinkage int sys_in_blocking_zone(void)
295{ 294{
296 struct timeval current_time; 295 struct timeval current_time, zone_start_time;
297 int quantum_start_time; 296 suseconds_t quantum_length, zone_size;
298 /* quantum_start_time = 297
299 * Time of last quantum boundary = Time of last local timer intr */ 298 /* get quantum length and zone size */
300 int zone_size = ZONE_SIZE; 299 quantum_length = (suseconds_t)jiffies_to_usecs(1);
300 zone_size = (suseconds_t)ZONE_SIZE; /* could modify if desired */
301 301
302 /* Assuming us granularity... */ 302 /* calculate starting time of zone */
303 int quantum_length = jiffies_to_usecs(1); 303 zone_start_time.tv_sec = per_cpu(last_local_intr, cpu).tv_sec;
304 zone_start_time.tv_usec = per_cpu(last_local_intr, cpu).tv_usec;
305 timeval_add_usecs(&zone_start_time, quantum_length);
306 timeval_sub_usecs(&zone_start_time, zone_size);
307
308 /* get current time */
304 do_gettimeofday(&current_time); 309 do_gettimeofday(&current_time);
305 /* Is current_time > quantum_start_time+quantum_length-zone_size? */
306 /* yes */ return 1;
307 /* no */ return 0;
308 /* try to use timeval compare, get everything in that format. */
309 /* timeval_to_ns? ns_to_timeval? */
310 310
311 return 0; // FIXME: perform "real" check. 311 /* check if we are in the blocking zone */
312 if (timeval_compare(current_time, zone_start_time) == 1)
313 return 1;
314 else
315 return 0;
312} 316}
313 317
314/* 318/*