Scheduler
docmain.cpp
Go to the documentation of this file.
1 
10 #include <cassert>
11 #include <iostream>
12 #include <vector>
13 
14 #include <utils/configuration.h>
15 #include <utils/programTime.h>
16 
20 #include <scheduler/system.h>
21 #include <scheduler/process.h>
23 
24 
25 int main(int argc, char *argv[])
26 {
28 
29  std::string defaultConfigName = "configuration/configuration.conf";
30  std::string configName;
31  configName = (argc == 2 ? argv[1]: defaultConfigName);
32 
33 
34  std::shared_ptr<Scheduler::SchedulerConfiguration> conf = std::make_shared<Scheduler::SchedulerConfiguration>(configName);
35  assert(conf != nullptr);
36  Scheduler::SchedulingSimulator simulator(conf);
37 
38  simulator.seedRandomGenerator(123);
39 
40  simulator.createRealTimeTask(0.0, 15.0, 5.0*MINFREQ, 15.0);
41  simulator.createRealTimeTask(0.0, 20.0, 6.0*MINFREQ, 20.0);
42 
43  simulator.turnOnProcessor(-0.0001);
45 
46  simulator.endSimulation(conf->getRunningTime());
47 
48  simulator.startScheduler();
49  return 0;
50 
51 }
52 
std::shared_ptr< Process > createRealTimeTask(double startTime, double period, double wcet, double deadline=0.0, int priority=0, double bcet=0.0, double powerCoeff=1.0)
creates a new real-time task event and add it to the event scheduling queue
void startScheduler()
call this function to launch the simulation
static System * getInstance()
Definition: system.cpp:28
void seedRandomGenerator(time_t seed)
seeds the random generator
void printProcessesReport()
Definition: system.cpp:89
int main(int argc, char *argv[])
Definition: docmain.cpp:25
static void init()
Definition: programTime.cpp:17
void turnOnProcessor(double start)
turns on the processor
#define MINFREQ
Definition: freqConstants.h:15
void endSimulation(double time)
set the end of the simulation