Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CPSim_GUI/bin/.gitignore

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified CPSim_GUI/bin/org/eclipse/cpsim/Diagram/util/CmdExecuter.class
Binary file not shown.
Binary file modified CPSim_GUI/bin/org/eclipse/cpsim/Diagram/util/DiagramUtil.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified CPSim_GUI/bin/org/eclipse/cpsim/menu/design/MakeUpProject.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified CPSim_GUI/bin/org/eclipse/cpsim/menu/simulation/RoIDialog.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added ComputerModelling_FinalReport_VictorMihaila.pdf
Binary file not shown.
45 changes: 45 additions & 0 deletions Engine/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <unordered_map>
#include "Logger.h"
#include <fstream>
#include <vector>

/**
* This file is the cpp file for the Executor class.
Expand Down Expand Up @@ -97,6 +98,9 @@ void Executor::set_current_hyper_period_end(int current_hyper_period_end)
*/
bool Executor::run_simulation(JobVectorOfSimulator& job_vector_of_simulator, JobVectorsForEachECU& job_vectors_for_each_ECU, double start_time)
{
std::ofstream s_log;
s_log.open(utils::cpsim_path + "/Log/VictorMihaila_schedule.log", std::ios::app);
std::vector<Event> events;
double end_time = start_time + utils::hyper_period;
move_ecus_jobs_to_simulator(job_vector_of_simulator, job_vectors_for_each_ECU); // Copies job vectors from ECUs to Sim.
if (!utils::real_workload)
Expand All @@ -114,6 +118,13 @@ bool Executor::run_simulation(JobVectorOfSimulator& job_vector_of_simulator, Job
if(job->get_actual_start_time() < 0 || job->get_actual_finish_time() > job->get_actual_deadline())
{
std::cout <<"DEADLINE MISS IN REAL CYBER SYSTEM" << std::endl;
//std::string s1 = (std::to_string(job->get_actual_deadline()) + " " + std::to_string(job->get_job_id()) + " DEADLINE MISS");
//s_log.write(s1.c_str(),s1.size());
Event e;
e.time=job->get_actual_deadline();
e.job_id=job->get_job_id();
e.event_type="DEADLINE MISS";
events.push_back(e);
}
}
//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - utils::simulator_start_time).count() <<std::endl;
Expand Down Expand Up @@ -207,9 +218,43 @@ bool Executor::run_simulation(JobVectorOfSimulator& job_vector_of_simulator, Job

update_all(job_vector_of_simulator, run_job);
}

}

utils::current_time = end_time;
for (auto job : job_vector_of_simulator)
{
Event e1;
e1.time=job->get_actual_release_time();
e1.job_id=job->get_job_id();
e1.event_type="RELEASED";
events.push_back(e1);
Event e2;
e2.time=job->get_actual_start_time();
e2.job_id=job->get_job_id();
e2.event_type="STARTED";
events.push_back(e2);
Event e3;
e3.time=job->get_actual_finish_time();
e3.job_id=job->get_job_id();
e3.event_type="FINISHED";
events.push_back(e3);
}
std::sort(events.begin(), events.end(), [](const Event &a, const Event &b){
if(a.time!=b.time) return a.time<b.time;
if(a.job_id!=b.job_id) return a.time<b.time;
return (a.event_type=="RELEASED" && b.event_type!="RELEASED") || (a.event_type=="STARTED" && b.event_type=="FINISHED");
});
auto newEnd=std::unique(events.begin(), events.end(), [](const Event &a, const Event &b){
return a.time==b.time && a.job_id==b.job_id && a.event_type==b.event_type;
});
events.erase(newEnd, events.end());
for(Event e : events){
if(e.time>=0){
std::string s=(std::to_string(e.time) + " J" + std::to_string(e.job_id) + " " + e.event_type + "\n");
s_log.write(s.c_str(), s.size());
}
}
return true;
}

Expand Down
8 changes: 8 additions & 0 deletions Engine/Executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
*
*/

typedef struct Event
{
int time;
int job_id;
std::string event_type;
} Event;


typedef struct OldData
{
int est;
Expand Down
10 changes: 10 additions & 0 deletions Engine/Initializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ void Initializer::initialize(EcuVector& ecu_vector, TaskVector& task_vector, Job
/**
* Speicification Initialization
*/
std::string s="[ TIME ] [ READ/WRITE ] [ TASK NAME ] [ DATA NAME ]\n";
std::ofstream rw_log;
rw_log.open(utils::cpsim_path + "/Log/VictorMihaila_read_write.log");
rw_log.write(s.c_str(), s.size());
rw_log.close();
s="[ TIME ] [ JOB ID ] [ EVENT TYPE ]\n";
std::ofstream s_log;
s_log.open(utils::cpsim_path + "/Log/VictorMihaila_schedule.log");
s_log.write(s.c_str(), s.size());
s_log.close();
if(utils::real_workload == true)
{
Specifier specifier;
Expand Down
23 changes: 22 additions & 1 deletion Engine/Job.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Job.h"
#include "Utils.h"
#include "Logger.h"
#include <ctime>
#include <cstdlib>
#include <climits>
Expand Down Expand Up @@ -568,8 +569,12 @@ void Job::add_history(std::shared_ptr<Job> new_deadline)
}

void Job::run_function()
{
{
std::ofstream rw_log;
rw_log.open(utils::cpsim_path + "/Log/VictorMihaila_read_write.log", std::ios::app);
m_run_start = std::chrono::steady_clock::now();
std::string s1;
std::string s2;
if((get_is_read() == true) && (get_is_write() == true))
{
if(!global_object::tagged_data_read.empty())
Expand All @@ -585,6 +590,19 @@ void Job::run_function()
delayed_data->data_write3 = shared::rtY.write3;
delayed_data->data_write2 = shared::CC_Send_BRAKE;
delayed_data->data_write1 = shared::CC_Send_ACCEL;
if(this->get_task_name()=="SWC0" && utils::log_task=="CC"){
std::string s1=(std::to_string(m_actual_start_time) + " READ " + "CC" + " TARGET_SPEED \n");
std::string s2=(std::to_string(m_actual_finish_time) + " WRITE " + "CC" + " ACCEL_VALUE \n");
rw_log.write(s1.c_str(), s1.size());
rw_log.write(s2.c_str(), s2.size());
}
if(this->get_task_name()=="SWC1" && utils::log_task=="LK"){
std::string s1=(std::to_string(m_actual_start_time) + " READ " + "LK" + " TARGET_SPEED \n");
std::string s2=(std::to_string(m_actual_finish_time) + " WRITE " + "LK" + " ACCEL_VALUE \n");
rw_log.write(s1.c_str(), s1.size());
rw_log.write(s2.c_str(), s2.size());
}
//rw_log.close();
}
else if((get_is_read() == true) && (get_is_write() == false))
{
Expand Down Expand Up @@ -614,4 +632,7 @@ void Job::run_function()
#endif
}
m_run_end = std::chrono::steady_clock::now();
//if(get_task_name()==utils::log_task){
//VictorMihaila_task_read_write_logger(utils::log_task);
//}
}
57 changes: 56 additions & 1 deletion Engine/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ Logger::~Logger()
void Logger::set_schedule_log_info(std::vector<std::shared_ptr<Task>>& task_vector)
{
std::ofstream scheduling_log;
scheduling_log.open(utils::cpsim_path + "/Log/scheduling.log", std::ios::out);
//std::ofstream rw_log;
scheduling_log.open(utils::cpsim_path + "/Log/scheduling.log", std::ios::out);
//rw_log.open(utils::cpsim_path + "/Log/VictorMihaila_read_write.log", std::ios::out);
std::string contents = "";
for(int idx = 0; idx < task_vector.size(); idx++)
{
Expand All @@ -83,8 +85,12 @@ void Logger::set_schedule_log_info(std::vector<std::shared_ptr<Task>>& task_vect
contents += ", ";
}
}
//std::string s=std::to_string(global_object::running_job->get_actual_start_time())+"\n";
scheduling_log.write(contents.c_str(), contents.size());
//rw_log.write(s.c_str(), s.size());
scheduling_log.close();
//rw_log.close();
//VictorMihaila_task_read_write_logger(utils::log_task);
}

void Logger::start_logging()
Expand Down Expand Up @@ -114,3 +120,52 @@ void Logger::start_logging()
utils::mtx_data_log.unlock();
}
}

void VictorMihaila_task_read_write_logger(std::string task_name){
/*while (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - utils::simulator_start_time).count() < utils::simulation_termination_time)
{
std::ofstream rw_log;
rw_log.open(utils::cpsim_path + "/Log/VictorMihaila_read_write.log", std::ios::app);
utils::mtx_data_log.lock();
if(global_object::running_job->get_task_name() == task_name){
if(std::chrono::steady_clock::now()>global_object::running_job->get_actual_start_time() && std::chrono::steady_clock::now() > global_object::running_job->get_actual_finish_time()){
std::string contents="";
contents=std::to_string(global_object::running_job->get_actual_start_time())+ " " + "READ " + task_name + "TARGET_SPEED";
}
}

if(global_object::schedule_data.size() > 10)
{
int min_idx = 0;
std::shared_ptr<ScheduleData> current_data = global_object::schedule_data.front();
for (int idx = 0; idx < global_object::schedule_data.size(); idx ++)
{
if(current_data->get_time() > global_object::schedule_data.at(idx)->get_time())
{
current_data = global_object::schedule_data.at(idx);
min_idx = idx;
}
}

global_object::schedule_data.erase(global_object::schedule_data.begin() + min_idx);
rw_log.write(current_data->get_data().c_str(), current_data->get_data().size());
}
rw_log.close();
utils::mtx_data_log.unlock();
}*/
std::ofstream rw_log;
rw_log.open(utils::cpsim_path + "/Log/VictorMihaila_read_write.log", std::ios::out);
std::string contents="";
contents+="[ TIME ] [ READ/WRITE ] [ TASK NAME ] [ DATA NAME ]\n";
rw_log.write(contents.c_str(), contents.size());
if(global_object::running_job->get_is_read()){
contents="";
contents += (std::to_string(global_object::running_job->get_actual_start_time()) + " READ " + task_name + " TARGET_SPEED \n");
rw_log.write(contents.c_str(), contents.size());
}
if(global_object::running_job->get_is_write()){
contents="";
contents += (std::to_string(global_object::running_job->get_actual_finish_time()) + " WRITE " + task_name + " ACCEL_VALUE \n");
rw_log.write(contents.c_str(), contents.size());
}
}
2 changes: 1 addition & 1 deletion Engine/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ class Logger{
void print_offline_guider_status();
void set_schedule_log_info(std::vector<std::shared_ptr<Task>>&);
};

void VictorMihaila_task_read_write_logger(std::string task_name);
#endif
2 changes: 1 addition & 1 deletion Engine/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef std::vector<std::shared_ptr<CAN_message> > CanMsgVector;
#endif

namespace utils
{
{
inline std::mutex mtx_data_read;
inline std::mutex mtx_data_write;
inline std::mutex mtx_data_log;
Expand Down
26 changes: 13 additions & 13 deletions Log/CPU_info.log
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 6
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 165
Model name: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
Stepping: 2
CPU MHz: 3703.040
CPU max MHz: 5000.0000
CPU min MHz: 800.0000
BogoMIPS: 5199.98
Model: 78
Model name: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
Stepping: 3
CPU MHz: 1529.143
CPU max MHz: 2800.0000
CPU min MHz: 400.0000
BogoMIPS: 4800.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 12288K
NUMA node0 CPU(s): 0-11
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp pku ospke md_clear flush_l1d arch_capabilities
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
Loading