From 5a56b49b79dd6f15c9d1972069053dedb2456903 Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Mon, 6 Jun 2011 18:17:31 +0000 Subject: [PATCH] AVATAR: update on simulation panel + update on executable code --- executablecode/src/request.h | 1 + executablecode/src/request_manager.c | 24 +++++++++++++++++-- executablecode/src/tracemanager.c | 5 +++- .../c++2/src_simulator/app/TMLEventBChannel.h | 6 +++-- .../InteractiveSimulationActions.java | 5 +++- .../JFrameSimulationSDPanel.java | 15 ++++++++++-- .../JSimulationSDPanel.java | 11 +++++++++ 7 files changed, 59 insertions(+), 8 deletions(-) diff --git a/executablecode/src/request.h b/executablecode/src/request.h index 607941ed37..00b93c8e5a 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 e39896f260..51f6d494b9 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 b2e88220c9..d19967ef7a 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 26bf9397bc..d3bfb7e52a 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 b25cc70a18..582295b71b 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 807e1f43fc..5a37f61662 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 4804336226..03e06a9ce6 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"); -- GitLab