diff --git a/executablecode/src/request.h b/executablecode/src/request.h index 607941ed374bccbb37280e2e338ae363f3abc2cb..00b93c8e5a007e2eecf6bde40417cdfb9457edc2 100644 --- a/executablecode/src/request.h +++ b/executablecode/src/request.h @@ -43,6 +43,7 @@ struct request { struct request* relatedRequest; // For synchro and broadcast struct syncchannel *syncChannel; struct asyncchannel *asyncChannel; + int type; int ID; int hasDelay;; diff --git a/executablecode/src/request_manager.c b/executablecode/src/request_manager.c index e39896f2604e9507ea94cd79ea3f2f88138bb517..51f6d494b97315f846f588bfde0ec89f4ea37c0c 100644 --- a/executablecode/src/request_manager.c +++ b/executablecode/src/request_manager.c @@ -41,7 +41,17 @@ void executeSendSyncTransaction(request *req) { // Remove all related request from list requests //req->syncChannel->inWaitQueue = removeRequestFromList(req->syncChannel->inWaitQueue, selectedReq); + debugMsg("Setting related request"); req->relatedRequest = selectedReq; + selectedReq->relatedRequest = req; + + if (req->relatedRequest == NULL) { + debugMsg("NULL related req"); + } + + if (selectedReq->relatedRequest == NULL) { + debugMsg("Other NULL related req"); + } // Select the selected request, and notify the information selectedReq->selected = 1; @@ -80,7 +90,17 @@ void executeReceiveSyncTransaction(request *req) { } //req->syncChannel->outWaitQueue = removeRequestFromList(req->syncChannel->outWaitQueue, selectedReq); + debugMsg("Setting related request"); req->relatedRequest = selectedReq; + selectedReq->relatedRequest = req; + + if (req->relatedRequest == NULL) { + debugMsg("NULL related req"); + } + + if (selectedReq->relatedRequest == NULL) { + debugMsg("Other NULL related req"); + } // Select the request, and notify the information in the channel selectedReq->selected = 1; @@ -403,7 +423,7 @@ void private__makeRequest(request *req) { // In all cases: remove other requests of the same list from their pending form debugMsg("Removing original req"); removeAllPendingRequestsFromPendingLists(req, 1); - removeAllPendingRequestsFromPendingListsRelatedRequests(req); + //removeAllPendingRequestsFromPendingListsRelatedRequests(req); /*if (req->relatedRequest != NULL) { debugMsg("Removing related req"); removeAllPendingRequestsFromPendingLists(req->relatedRequest, 0); @@ -416,7 +436,7 @@ void removeAllPendingRequestsFromPendingListsRelatedRequests(request *req) { debugMsg("Removing related req"); removeAllPendingRequestsFromPendingLists(req->relatedRequest, 0); // Recursive call - removeAllPendingRequestsFromPendingListsRelatedRequests(req->relatedRequest); + //removeAllPendingRequestsFromPendingListsRelatedRequests(req->relatedRequest); } } diff --git a/executablecode/src/tracemanager.c b/executablecode/src/tracemanager.c index b2e88220c9cd4e11c4ed31deb2239d974c44eb6a..d19967ef7a1cd7e7b7432b3c463476de98ceac90 100644 --- a/executablecode/src/tracemanager.c +++ b/executablecode/src/tracemanager.c @@ -161,7 +161,10 @@ void traceRequest(char *myname, request *req) { switch(req->type) { case SEND_SYNC_REQUEST: debug2Msg("Sync channel", req->syncChannel->outname); - sprintf(s, "block=%s type=send_synchro channel=%s\n", myname, req->syncChannel->outname); + if ( req->relatedRequest == NULL) { + printf("NULL related\n"); + } + sprintf(s, "block=%s type=send_synchro channel=%s blockdestination=%s\n", myname, req->syncChannel->outname, req->relatedRequest->listOfRequests->owner); break; case RECEIVE_SYNC_REQUEST: sprintf(s, "block=%s type=receive_synchro channel=%s\n", myname, req->syncChannel->inname); diff --git a/simulators/c++2/src_simulator/app/TMLEventBChannel.h b/simulators/c++2/src_simulator/app/TMLEventBChannel.h index 26bf9397bc7c8d98b7aa92542d36dec7a2f4f517..d3bfb7e52a1ded250376e499aca7afa3aadd1673 100644 --- a/simulators/c++2/src_simulator/app/TMLEventBChannel.h +++ b/simulators/c++2/src_simulator/app/TMLEventBChannel.h @@ -168,7 +168,8 @@ public: std::ostream& writeObject(std::ostream& s){ TMLEventSizedChannel<T,paramNo>::writeObject(s); if (_eventFile!=0){ - std::istream::streampos aPos=_eventFile->tellg(); + //std::istream::streampos aPos=_eventFile->tellg(); + int aPos=_eventFile->tellg(); WRITE_STREAM(s,aPos); #ifdef DEBUG_SERIALIZE std::cout << "Write: TMLEventBChannel " << this->_name << " posInFile: " << _eventFile->tellg() << std::endl; @@ -178,7 +179,8 @@ public: } std::istream& readObject(std::istream& s){ - std::istream::streampos aPos; + //std::istream::streampos aPos; + int aPos; TMLEventSizedChannel<T,paramNo>::readObject(s); //std::cout << "Read Object TMLEventBChannel " << _name << std::endl; if (_eventFile!=0){ diff --git a/src/ui/interactivesimulation/InteractiveSimulationActions.java b/src/ui/interactivesimulation/InteractiveSimulationActions.java index b25cc70a18f2867dc96ceff40f01b21adb6ef810..582295b71b2490af300695202bdbf2935528aef1 100755 --- a/src/ui/interactivesimulation/InteractiveSimulationActions.java +++ b/src/ui/interactivesimulation/InteractiveSimulationActions.java @@ -92,13 +92,15 @@ public class InteractiveSimulationActions extends AbstractAction { public static final int ACT_UPDATE_BUS = 18; public static final int ACT_UPDATE_TASKS = 19; + public static final int ACT_REFRESH = 32; + public static final int ACT_PRINT_CPUS = 28; public static final int ACT_PRINT_BUS = 29; public static final int ACT_ANALYSIS_RG = 30; public static final int ACT_VIEW_RG = 31; - public static final int NB_ACTION = 32; + public static final int NB_ACTION = 33; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -169,6 +171,7 @@ public class InteractiveSimulationActions extends AbstractAction { actions[ACT_UPDATE_MEMS] = new TAction("update-mems", "Update Memories information", IconManager.imgic75, IconManager.imgic75, "Update Memories information", "Update information on Memories", 'R'); actions[ACT_UPDATE_BUS] = new TAction("update-bus", "Update bus info", IconManager.imgic75, IconManager.imgic75, "Update bus information", "Update information on busses", 'R'); actions[ACT_UPDATE_TASKS] = new TAction("update-tasks", "Update task information", IconManager.imgic75, IconManager.imgic75, "Update task information", "Update information on tasks", 'R'); + actions[ACT_REFRESH] = new TAction("refresh", "Refresh transactions", IconManager.imgic75, IconManager.imgic75, "Refresh", "Refresh the Sequence Diagram representing transactions", 'R'); actions[ACT_PRINT_CPUS] = new TAction("print-cpus", "Print CPU info", IconManager.imgic75, IconManager.imgic75, "Print CPU information", "Print information on CPUs", 'R'); actions[ACT_PRINT_BUS] = new TAction("print-bus", "Print Bus info", IconManager.imgic75, IconManager.imgic75, "Print Bus information", "Print information on Busses", 'R'); diff --git a/src/ui/interactivesimulation/JFrameSimulationSDPanel.java b/src/ui/interactivesimulation/JFrameSimulationSDPanel.java index 807e1f43fc8a41dbd5aebd1fefd5c3321f51436a..5a37f61662b840e711e396e373c5c112c233d2a6 100755 --- a/src/ui/interactivesimulation/JFrameSimulationSDPanel.java +++ b/src/ui/interactivesimulation/JFrameSimulationSDPanel.java @@ -99,8 +99,7 @@ public class JFrameSimulationSDPanel extends JFrame implements ActionListener { private static int[] clockDivisers = {1000000000, 1000000, 1000, 1}; protected JComboBox units; - protected JButton buttonClose; - protected JButton buttonRefresh; + protected JButton buttonClose, buttonRefresh; protected JSimulationSDPanel sdpanel; protected JLabel status; //, buttonStart, buttonStopAndClose; @@ -147,6 +146,8 @@ public class JFrameSimulationSDPanel extends JFrame implements ActionListener { units.setSelectedIndex(1); units.addActionListener(this); topPanel.add(units); + buttonRefresh = new JButton(actions[InteractiveSimulationActions.ACT_REFRESH]); + topPanel.add(buttonRefresh); framePanel.add(topPanel, BorderLayout.NORTH); // Simulation panel @@ -186,6 +187,12 @@ public class JFrameSimulationSDPanel extends JFrame implements ActionListener { setVisible(false); } + + public void refresh() { + if (sdpanel != null ){ + sdpanel.refresh(); + } + } public void actionPerformed(ActionEvent evt) { @@ -196,6 +203,10 @@ public class JFrameSimulationSDPanel extends JFrame implements ActionListener { close(); return; //TraceManager.addDev("Start simulation!"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_REFRESH].getActionCommand())) { + refresh(); + return; + //TraceManager.addDev("Start simulation!"); } else if (evt.getSource() == units) { if (sdpanel != null) { switch(units.getSelectedIndex()) { diff --git a/src/ui/interactivesimulation/JSimulationSDPanel.java b/src/ui/interactivesimulation/JSimulationSDPanel.java index 480433622657377208b782f7fb3f9a17be8536f9..03e06a9ce6e9af0c35b29b81a1c7e6e4ae5d7334 100644 --- a/src/ui/interactivesimulation/JSimulationSDPanel.java +++ b/src/ui/interactivesimulation/JSimulationSDPanel.java @@ -727,6 +727,17 @@ public class JSimulationSDPanel extends JPanel implements MouseMotionListener, R Thread t = new Thread(this); t.start(); } + + public void refresh() { + if (mode == FILE_MODE) { + entityNames.clear(); + transactions.clear(); + transactionsOfPoints.clear(); + points.clear(); + Thread t = new Thread(this); + t.start(); + } + } public void run() { TraceManager.addDev("Reading file");