-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.c
67 lines (55 loc) · 1.62 KB
/
driver.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <stdio.h>
#include "configuration.h"
#include "utility.h"
#include "task.h"
#include "job.h"
#include "freq_and_voltage.h"
#include "scheduler.h"
// I/O Files.
FILE *input_tasks_file;
FILE *input_freq_file;
FILE *output_file;
FILE *statistics_file;
// Variables to hold the task and job data.
int num_tasks;
Task *tasks;
int num_jobs;
Job *jobs;
// Timing parameters of the program.
long hyperperiod;
long first_in_phase_time;
long end_of_execution_time;
// Global variables related to the DVFS part of the program.
int num_freq_levels;
Freq_and_voltage *freq_and_voltage;
Freq_and_voltage static_freq_and_voltage;
int static_freq_and_voltage_index;
long num_freq_calculations;
long num_freq_changes;
float total_dynamic_energy;
/*
* Pre-condition: The relevant data in the input files (tasks and frequency inputs).
* Post-condition: Runs the program from the start to the end.
*/
int main(int argc, char const *argv[])
{
/*
* Opens the input and output files.
* Initialises, sorts and prints the data.
* Finds the static voltage and frequency for the task set.
* Finds the hyperperiod.
* Finds the first in-phase time and time till which the scheduler has to schedule.
* Function definition in utility.c
*/
open_files_and_init_data();
/* Starts the scheduler and then schedules the entire task-set. */
start_scheduler();
/*
* Takes care of things to be done when exiting from the program.
* Closes the input and output files.
* Deallocates the data from the heap.
* Function definition in utility.c
*/
close_files_and_delete_data();
return 0;
}