diff --git a/simulators/c++2/src_simulator/arch/CPU.cpp b/simulators/c++2/src_simulator/arch/CPU.cpp index bd0ef56fef34f64a71ea388ca9563e72729a3e9d..c2ff4d635722f81fa439d1741de05e43f200d200 100644 --- a/simulators/c++2/src_simulator/arch/CPU.cpp +++ b/simulators/c++2/src_simulator/arch/CPU.cpp @@ -121,6 +121,7 @@ void CPU::drawPieChart(std::ofstream& myfile) const { data : efficiency" << _ID << "_" << j << ",\n"; myfile << " backgroundColor : coloR" << _ID << "_" << j << std::endl; myfile << SCHED_HTML_JS_CONTENT1 << "Average load is " << averageLoad(j) << SCHED_HTML_JS_CONTENT2 << std::endl; + myfile << "$(\"#" << _ID << "_" << j << "\").click(function() {\n"; myfile << " var chart" << _ID << "_" << j << " = new Chart( "<< "ctx" << _ID << "_" << j << ", {\n \ type : \"pie\",\n"; @@ -137,8 +138,9 @@ void CPU::showPieChart(std::ofstream& myfile) const{ type : \"pie\",\n"; myfile << "data : data " << _ID << this->_cycleTime <<",\n"; myfile << SCHED_HTML_JS_CONTENT2 << std::endl;*/ + myfile << SCHED_HTML_JS_BUTTON1 << _ID << "_" << this->_cycleTime << SCHED_HTML_JS_BUTTON2 << std::endl; myfile << SCHED_HTML_JS_DIV_BEGIN << std::endl; - myfile << SCHED_HTML_JS_BEGIN_CANVAS << _ID << "_" << this->_cycleTime << SCHED_HTML_JS_END_CANVAS <<std::endl; + myfile << SCHED_HTML_JS_BEGIN_CANVAS << _ID << "_" << this->_cycleTime << SCHED_HTML_JS_END_CANVAS << std::endl; myfile << SCHED_HTML_JS_DIV_END << std::endl; } diff --git a/simulators/c++2/src_simulator/arch/FPGA.cpp b/simulators/c++2/src_simulator/arch/FPGA.cpp index 16d080fedc9787e82cc06a28834670f5b45fd649..b8bbfe3e776b3d535a926cf2c691c25aa991118d 100644 --- a/simulators/c++2/src_simulator/arch/FPGA.cpp +++ b/simulators/c++2/src_simulator/arch/FPGA.cpp @@ -503,20 +503,30 @@ void FPGA::drawPieChart(std::ofstream& myfile) const { data : efficiency" << _ID << "_" << _htmlCurrTask->toShortString() << ",\n"; myfile << " backgroundColor : coloR" << _ID << "_" << _htmlCurrTask->toShortString() << std::endl; myfile << SCHED_HTML_JS_CONTENT1 << "Average load is " << averageLoad(_htmlCurrTask) << SCHED_HTML_JS_CONTENT2 << std::endl; - myfile << " var chart" << _ID << "_" << _htmlCurrTask->toShortString() << " = new Chart( "<< - "ctx" << _ID << "_" << _htmlCurrTask->toShortString() << ", {\n \ - type : \"pie\",\n"; - myfile << " data : data" << _ID << "_" << _htmlCurrTask->toShortString() <<",\n"; - myfile << " " << SCHED_HTML_JS_CONTENT3 << std::endl; + } +void FPGA::buttonPieChart(std::ofstream& myfile) const{ + myfile << "$(\"#" << _ID << "\").click(function() {\n"; + for(TaskList::const_iterator i = _taskList.begin(); i!= _taskList.end(); ++i){ + myfile << " var chart" << _ID << "_" << (*i)->toShortString() << " = new Chart( "<< + "ctx" << _ID << "_" << (*i)->toShortString() << ", {\n \ + type : \"pie\",\n"; + myfile << " data : data" << _ID << "_" << (*i)->toShortString() <<",\n"; + myfile << " options : options\n" << " });" << std::endl; + + } + myfile << "});" << std::endl; +} + void FPGA::showPieChart(std::ofstream& myfile) const{ /* if(_taskNumber==1) myfile << SCHED_HTML_JS_DIV_ID << _ID << "_" << _htmlCurrTask->toShortString() << SCHED_HTML_JS_DIV_ID_END <<std::endl; else myfile << SCHED_HTML_JS_DIV_ID << _ID << "_" << _htmlCurrTask->toShortString() << SCHED_HTML_JS_DIV_ID_END_FPGA <<std::endl;*/ + if( _taskNumber == 1) myfile << SCHED_HTML_JS_DIV_BEGIN << std::endl; else diff --git a/simulators/c++2/src_simulator/arch/FPGA.h b/simulators/c++2/src_simulator/arch/FPGA.h index 28a92a4b9c825a12cbcec5e29fa4f730db9a7f5e..d9c68b4ca5521376a59f44d43e42077fa407ff6f 100644 --- a/simulators/c++2/src_simulator/arch/FPGA.h +++ b/simulators/c++2/src_simulator/arch/FPGA.h @@ -130,6 +130,7 @@ public: } ///inline void setTransNumber(unsigned int num) { _transNumber=num;} ///inline unsigned int getTransNumber() { return _transNumber;} + inline unsigned int getID () { return _ID;} inline void setCurrTaskNumber(unsigned int num) { _currTaskNumber=num;} void schedule2HTML(std::ofstream& myfile) ; inline const TaskList& getTaskList() const{return _taskList;} @@ -139,6 +140,7 @@ public: //inline void setMaxEndTime(TMLTime t) {_maxEndTime=t;} double averageLoad (TMLTask* currTask) const; void drawPieChart(std::ofstream& myfile) const; + void buttonPieChart(std::ofstream& myfile) const; void showPieChart(std::ofstream& myfile) const; std::string determineHTMLCellClass(unsigned int &nextColor ); protected: diff --git a/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp b/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp index aed5e10b504a3cd216283ed8ecc92c564f92cd7c..30d8e22e0c03627ebf8114ce8a770002ca57e704 100644 --- a/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp +++ b/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp @@ -258,7 +258,8 @@ void SchedulableDevice::drawPieChart(std::ofstream& myfile) const { {\n \ data : efficiency" << _ID << ",\n"; myfile << " backgroundColor : coloR" << _ID << std::endl; - myfile << SCHED_HTML_JS_CONTENT1 << "Average load is " << averageLoad() << SCHED_HTML_JS_CONTENT2 << std::endl; + myfile << SCHED_HTML_JS_CONTENT1 << "Average load is " << averageLoad() << SCHED_HTML_JS_CONTENT2 << std::endl; + myfile << "$(\"#" << _ID << "\").click(function() {\n"; myfile << " var chart" << _ID << " = new Chart( "<< "ctx" << _ID << ", {\n \ type : \"pie\",\n"; @@ -269,6 +270,7 @@ void SchedulableDevice::drawPieChart(std::ofstream& myfile) const { void SchedulableDevice::showPieChart(std::ofstream& myfile) const{ + myfile << SCHED_HTML_JS_BUTTON1 << _ID << SCHED_HTML_JS_BUTTON2 << std::endl; myfile << SCHED_HTML_JS_DIV_BEGIN << std::endl; myfile << SCHED_HTML_JS_BEGIN_CANVAS << _ID << SCHED_HTML_JS_END_CANVAS <<std::endl; myfile << SCHED_HTML_JS_DIV_END << std::endl; diff --git a/simulators/c++2/src_simulator/definitions.h b/simulators/c++2/src_simulator/definitions.h index af775c8c9b7c6c11a58d96ea4fb5138404f9348b..15dce02ab874471a95320ee8f30177efd6a8e353 100644 --- a/simulators/c++2/src_simulator/definitions.h +++ b/simulators/c++2/src_simulator/definitions.h @@ -262,7 +262,6 @@ using std::max; - #define SCHED_HTML_JS_LINK1 "<script src=\"jquery.min.js\">" #define SCHED_HTML_JS_LINK2 "<script src=\"Chart.min.js\">" #define SCHED_HTML_BEGIN_JS "<script>\n" @@ -272,6 +271,8 @@ using std::max; #define SCHED_HTML_JS_WINDOW "window.onload = function () {\n" #define SCHED_HTML_JS_DIV_BEGIN "<div class=\"wrapper\">" #define SCHED_HTML_JS_DIV_BEGIN2 "<div class=\"pie-chart-container\">" +#define SCHED_HTML_JS_BUTTON1 "<button id=\"" +#define SCHED_HTML_JS_BUTTON2 "\" type=\"button\"> Show Pie Chart </button>" #define SCHED_HTML_JS_DIV_END "</div>" #define SCHED_HTML_JS_CLEAR "<div class = \"clear\"></div>" #define NB_HTML_COLORS 15 @@ -304,7 +305,8 @@ using std::max; };\n" #define SCHED_HTML_JS_CONTENT3 "options : options\n \ - });" + });\n \ + });" #define SCHED_HTML_PIE_END "}\n \ diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp index 4e51e22ea468f4a42c56a804653c758942a89db0..27d1e185bed26b0003435a4281611cdb13592d0a 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.cpp +++ b/simulators/c++2/src_simulator/sim/Simulator.cpp @@ -435,6 +435,7 @@ std::cout<<"schedule2HTML--------------------------------------***************** (*i)->setHtmlCurrTask(*j); (*i)->drawPieChart(myfile); } + (*i)->buttonPieChart(myfile); } for(BusList::const_iterator j=_simComp->getBusList().begin(); j != _simComp->getBusList().end(); ++j){ (*j)->drawPieChart(myfile); @@ -473,6 +474,7 @@ std::cout<<"schedule2HTML--------------------------------------***************** (*j)->schedule2HTML(myfile); (*j)->setStartFlagHTML(false); } + myfile << SCHED_HTML_JS_BUTTON1 << (*j)->getID() << SCHED_HTML_JS_BUTTON2 << std::endl; for(TaskList::const_iterator i = (*j)->getTaskList().begin(); i != (*j)->getTaskList().end(); ++i){ (*j)->setHtmlCurrTask(*i); (*j)->showPieChart(myfile);