EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.scheduler.timeslice.impl]

COVERAGE SUMMARY FOR SOURCE FILE [PriorityDependentTimeSlice.java]

nameclass, %method, %block, %line, %
PriorityDependentTimeSlice.java0%   (0/1)0%   (0/4)0%   (0/74)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PriorityDependentTimeSlice0%   (0/1)0%   (0/4)0%   (0/74)0%   (0/19)
PriorityDependentTimeSlice (ProcessWithPriority, double, double, double): void 0%   (0/1)0%   (0/16)0%   (0/6)
computeTicksFromPriority (IPriority, double): double 0%   (0/1)0%   (0/34)0%   (0/6)
getBasicTimeSlice (IPriority, double): double 0%   (0/1)0%   (0/14)0%   (0/4)
updateTimeForScheduling (): void 0%   (0/1)0%   (0/10)0%   (0/3)

1package de.uka.ipd.sdq.scheduler.timeslice.impl;
2 
3import de.uka.ipd.sdq.scheduler.priority.IPriority;
4import de.uka.ipd.sdq.scheduler.processes.impl.ProcessWithPriority;
5 
6public class PriorityDependentTimeSlice extends ContinuousTimeSlice {
7 
8        private double min_time_to_be_scheduled; // Default value for Linux no x86 systems: 11
9 
10        public PriorityDependentTimeSlice(ProcessWithPriority process, double basic_timeslice, double min_timeslice, double min_time_to_be_scheduled) {
11                double computed_timeslice = computeTicksFromPriority(process
12                                .getStaticPriority(), basic_timeslice);
13                this.timeslice = Math.max(computed_timeslice, min_timeslice);
14                this.min_time_to_be_scheduled = min_time_to_be_scheduled;
15        }
16 
17        /**
18         * Computes the length of the current time slice according to the Linux
19         * 2.6.18 Scheduler.
20         * 
21         * @param process
22         * @return
23         */
24        public static double computeTicksFromPriority(IPriority prio, double basic_timeslice) {
25                double basic = getBasicTimeSlice(prio, basic_timeslice);
26                IPriority max_prio = prio.getManager().getHighestPriority();
27                IPriority min_prio = prio.getManager().getLowestPriority();
28                int distance = min_prio.distance(prio) + 1;
29                double factor = (min_prio.distance(max_prio) + 1) / 2.0;
30                return basic * distance / factor;
31        }
32 
33        /**
34         * Processes with a static priority above default are preferred.
35         * 
36         * @param static_prio
37         * @return
38         */
39        public static double getBasicTimeSlice(IPriority static_prio, double basicTimeslice) {
40                IPriority default_prio = static_prio.getManager().getDefaultPriority();
41                if (static_prio.greaterThan(default_prio)) {
42                        return basicTimeslice * 4;
43                } else {
44                        return basicTimeslice;
45                }
46        }
47        
48        @Override
49        public void updateTimeForScheduling() {
50                // if the remaining time is smaller than a jiffies the
51                // timeslice needs to be reset first.
52                if (remaining_time < min_time_to_be_scheduled){
53                        remaining_time = 0;
54                } 
55        }
56}

[all classes][de.uka.ipd.sdq.scheduler.timeslice.impl]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov