diff --git a/simulators/c++2/src_simulator/app/TMLbrbwChannel.cpp b/simulators/c++2/src_simulator/app/TMLbrbwChannel.cpp index ee88335d2e58531c46ac4564cca2183e0a956fa6..16017733dcb7a02a18e3027c8047d1f11fde2845 100755 --- a/simulators/c++2/src_simulator/app/TMLbrbwChannel.cpp +++ b/simulators/c++2/src_simulator/app/TMLbrbwChannel.cpp @@ -61,6 +61,7 @@ void TMLbrbwChannel::testRead(TMLTransaction* iTrans){ } void TMLbrbwChannel::write(){ +std::cout<<"write!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<std::endl; #ifdef LOSS_ENABLED if (_maxNbOfLosses > _nbOfLosses){ TMLLength aLostBytes = _writeTrans->getVirtualLength() * _lossRate + _lossRemainder; diff --git a/simulators/c++2/src_simulator/arch/Bus.cpp b/simulators/c++2/src_simulator/arch/Bus.cpp index 420ba0ffad572905dd345122d8ee12f7d415c6dd..1be069c5093fb1c00c672e5a9c0e12e5258cd09a 100644 --- a/simulators/c++2/src_simulator/arch/Bus.cpp +++ b/simulators/c++2/src_simulator/arch/Bus.cpp @@ -91,7 +91,7 @@ void Bus::schedule(){ //Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions bool Bus::addTransaction(TMLTransaction* iTransToBeAdded){ - //std::cout << "Bus add trans " << _nextTransaction << "\n"; + std::cout << "Bus add trans ####" << _nextTransaction << "\n"; _endSchedule = _nextTransaction->getEndTime(); //std::cout << "set end time to " << _endSchedule << "\n"; //_transactList.push_back(_nextTransaction); diff --git a/simulators/c++2/src_simulator/arch/CPU.h b/simulators/c++2/src_simulator/arch/CPU.h index ef8f099df2fbd049f0a1c9c848a3fa9c009f61b1..a11a799649590fb4aef26d6e5c2b1ca13bb7eb6c 100755 --- a/simulators/c++2/src_simulator/arch/CPU.h +++ b/simulators/c++2/src_simulator/arch/CPU.h @@ -159,6 +159,109 @@ public: std::cout << "Current Trans " << _name << ": "; if (_nextTransaction==0) std::cout << "0\n"; else std::cout << _nextTransaction->toString() << "\n"; }*/ + void schedule2HTML(std::ofstream& myfile) const { + myfile << "<h2><span>Scheduling for device: "<< _name << "</span></h2>" << std::endl; + + if ( _transactList.size() == 0 ) { + myfile << "<h4>Device never activated</h4>" << std::endl; + } + else { + myfile << "<table>" << std::endl << "<tr>"; + + std::map<TMLTask*, std::string> taskCellClasses; + unsigned int nextCellClassIndex = 0; + TMLTime aCurrTime = 0; + + for( TransactionList::const_iterator i = _transactList.begin(); i != _transactList.end(); ++i ) { + std::cout<<"get transaction core number is: "<<(*i)->getTransactCoreNumber()<<std::endl; + std::cout<<"time : "<<_cycleTime<<std::endl; + std::cout << "CPU:calcSTL: html of CPU " << _name << ": " << (*i)->toString() << std::endl; + //if( (*i)->getTransactCoreNumber() == this->_cycleTime ){ + TMLTransaction* aCurrTrans = *i; + unsigned int aBlanks = aCurrTrans->getStartTime() - aCurrTime; + + if ( aBlanks > 0 ) { + writeHTMLColumn( myfile, aBlanks, "not", "idle time" ); + } + + unsigned int aLength = aCurrTrans->getPenalties(); + + if ( aLength != 0 ) { + std::ostringstream title; + title << "idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty(); + writeHTMLColumn( myfile, aLength, "not", title.str() ); + } + + aLength = aCurrTrans->getOperationLength(); + + // Issue #4 + TMLTask* task = aCurrTrans->getCommand()->getTask(); + const std::string cellClass = determineHTMLCellClass( taskCellClasses, task, nextCellClassIndex ); + + writeHTMLColumn( myfile, aLength, cellClass, aCurrTrans->toShortString() ); + + aCurrTime = aCurrTrans->getEndTime(); + // } + } + + + myfile << "</tr>" << std::endl << "<tr>"; + + for ( unsigned int aLength = 0; aLength < aCurrTime; aLength++ ) { + myfile << "<th></th>"; + } + + myfile << "</tr>" << std::endl << "<tr>"; + + for ( unsigned int aLength = 0; aLength <= aCurrTime; aLength += 5 ) { + std::ostringstream spanVal; + spanVal << aLength; + writeHTMLColumn( myfile, 5, "sc", "", spanVal.str(), false ); + //myfile << "<td colspan=\"5\" class=\"sc\">" << aLength << "</td>"; + } + + myfile << "</tr>" << std::endl << "</table>" << std::endl << "<table>" << std::endl << "<tr>"; + + for( std::map<TMLTask*, std::string>::iterator taskColIt = taskCellClasses.begin(); taskColIt != taskCellClasses.end(); ++taskColIt ) { + TMLTask* task = (*taskColIt).first; + // Unset the default td max-width of 5px. For some reason setting the max-with on a specific t style does not work + myfile << "<td class=\"" << taskCellClasses[ task ] << "\"></td><td style=\"max-width: unset;\">" << task->toString() << "</td><td class=\"space\"></td>"; + } + + myfile << "</tr>" << std::endl; + + #ifdef ADD_COMMENTS + bool aMoreComments = true, aInit = true; + Comment* aComment; + + while ( aMoreComments ) { + aMoreComments = false; + myfile << "<tr>"; + + for( std::map<TMLTask*, std::string>::iterator taskColIt = taskCellClasses.begin(); taskColIt != taskCellClasses.end(); ++taskColIt ) { + //for(TaskList::const_iterator j=_taskList.begin(); j != _taskList.end(); ++j){ + TMLTask* task = (*taskColIt).first; + std::string aCommentString = task->getNextComment( aInit, aComment ); + + if ( aComment == 0 ) { + myfile << "<td></td><td></td><td class=\"space\"></td>"; + } + else { + replaceAll(aCommentString,"<","<"); + replaceAll(aCommentString,">",">"); + aMoreComments = true; + myfile << "<td style=\"max-width: unset;\">" << aComment->_time << "</td><td><pre>" << aCommentString << "</pre></td><td class=\"space\"></td>"; + } + } + + aInit = false; + myfile << "</tr>" << std::endl; + } + #endif + myfile << "</table>" << std::endl; + } + } + protected: ///List of all tasks running on the CPU TaskList _taskList; diff --git a/simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp b/simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp index 883382c2cfae104cfc130b4cbc82d5fc083570a6..bb23eff30fba2722f88942584eb11c1b17f942f2 100644 --- a/simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp +++ b/simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp @@ -337,17 +337,17 @@ std::cout << "CPU:calcSTL: addtransaction of CPU " << _name << ": " << _nextTran // unsigned int iCoreNumber=getCoreNumber(); std::cout<<"multicore number "<<coreNumber<<" end schedule "<<_endSchedule<<std::endl; multiCore[coreNumber]=_endSchedule; - if (_cycleTime < amountOfCore -1){ - _endSchedule=0; - _nextTransaction->setTransactCoreNumber(coreNumber); - ++coreNumber; - std::cout<<"haha1"<<std::endl; - } - else { - _endSchedule=getMinEndSchedule(); - _nextTransaction->setTransactCoreNumber(coreNumber); - std::cout<<"haha2"<<std::endl; - //initCore(); + std::cout<<"cycle time is "<<_cycleTime<<std::endl; + if (coreNumber < amountOfCore -1){ + _endSchedule=0; + _nextTransaction->setTransactCoreNumber(coreNumber); + ++coreNumber; + std::cout<<"haha1: "<<coreNumber<<std::endl; + }else { + _endSchedule=getMinEndSchedule(); + _nextTransaction->setTransactCoreNumber(coreNumber); + std::cout<<"haha2: "<<coreNumber<<std::endl; + //initCore(); } std::cout <<"test transaction core number !!!! "<<_nextTransaction->getTransactCoreNumber()<<std::endl; std::cout << "set end schedule CPU: " << _endSchedule << "\n"; diff --git a/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp b/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp index 93667963643af69694341522fbb12cf279f72cb0..373694424338bbe144a48f29a8a20b1eb6c048cb 100644 --- a/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp +++ b/simulators/c++2/src_simulator/arch/SchedulableDevice.cpp @@ -184,8 +184,7 @@ std::string SchedulableDevice::determineHTMLCellClass( std::map<TMLTask*, std:: return taskColors[ task ]; } -void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const { - +void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const { myfile << "<h2><span>Scheduling for device: "<< _name << "</span></h2>" << std::endl; if ( _transactList.size() == 0 ) { @@ -202,7 +201,7 @@ void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const { std::cout<<"get transaction core number is: "<<(*i)->getTransactCoreNumber()<<std::endl; std::cout<<"time : "<<_cycleTime<<std::endl; std::cout << "CPU:calcSTL: html of CPU " << _name << ": " << (*i)->toString() << std::endl; - if( (*i)->getTransactCoreNumber() == this->_cycleTime ){ + //if( (*i)->getTransactCoreNumber() == this->_cycleTime ){ TMLTransaction* aCurrTrans = *i; unsigned int aBlanks = aCurrTrans->getStartTime() - aCurrTime; @@ -227,7 +226,7 @@ void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const { writeHTMLColumn( myfile, aLength, cellClass, aCurrTrans->toShortString() ); aCurrTime = aCurrTrans->getEndTime(); - } + // } } diff --git a/simulators/c++2/src_simulator/sim/Simulator.cpp b/simulators/c++2/src_simulator/sim/Simulator.cpp index 177b6971c009d18f1695883aba68fe05dcf357f3..7d253ae9c20325d4a91bc61619f0b1550b743ea7 100644 --- a/simulators/c++2/src_simulator/sim/Simulator.cpp +++ b/simulators/c++2/src_simulator/sim/Simulator.cpp @@ -289,7 +289,7 @@ void Simulator::latencies2XML(std::ostringstream& glob, int id1, int id2) { } void Simulator::schedule2HTML(std::string& iTraceFileName) const { -std::cout<<"schedule2HTML--------------------------------------"<<std::endl; +std::cout<<"schedule2HTML--------------------------------------******************"<<std::endl; struct timeval aBegin,aEnd; gettimeofday(&aBegin,NULL); @@ -522,8 +522,11 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){ std::cout << "cpuLET= " << cpuLET->toString() << std::endl; std::cout << "kernel:simulate:cpuLET printed" << std::endl; #endif + std::cout<<"in simulator begin addTransaction "<<std::endl; bool x = cpuLET->addTransaction(0); - cpuLET->setCycleTime(0); + // cpuLET->setCycleTime(0); + std::cout<<"in simulator end addTransactin "<<std::endl; + //std::cout << "kernel:simulate: x=" << x << std::endl; #ifdef DEBUG_KERNEL std::cout << "kernel:simulate: AFTER add trans: " << x << std::endl;