OpenASIP  2.0
DisasmTopCountAttrProvider.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file DisasmTopCountAttrProvider.hh
26  *
27  * Declaration DisasmTopCountAttrProvider class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_DISASM_TOP_COUNT_ATTR_PROVIDER_HH
34 #define TTA_DISASM_TOP_COUNT_ATTR_PROVIDER_HH
35 
36 #include <set>
37 #include <map>
38 #include <wx/listctrl.h>
39 #include <wx/minifram.h>
41 #include "Listener.hh"
42 #include "SimulatorConstants.hh"
43 
44 class wxGridCellAttr;
47 
48 /**
49  * Attribute provider for disassembly window grid.
50  *
51  * Highlights instructions with top execution counts with background colour.
52  */
54 public:
56  TracedSimulatorFrontend& simulator, size_t topCounts);
58  virtual void update();
59  virtual wxGridCellAttr* moveCellAttr(
60  InstructionAddress address, int move);
61 
62  typedef std::set<InstructionAddress> AddressSet;
63  typedef std::map<ClockCycleCount, AddressSet> ExecutionCountTable;
64 private:
65  void updateTopCountTable();
66  void addToTopCountTable(
67  InstructionAddress address, ClockCycleCount execCount);
68 
69  void createExecCountWindow();
70  wxColour bgColour(ClockCycleCount execCount);
71 
72  /// Top execution counts and set of instruction addresses with each count.
74  /// Simulator frontend used for accessing the instructions and exec counts.
76  /// Number of top execution counts in the top execution count list.
77  size_t topCounts_;
79 };
80 
81 
82 /**
83  * Simple list window for displaying list of top execution counts.
84  */
85 class DisasmExecCountFrame : public wxMiniFrame {
86 public:
88  wxWindow* parent, wxWindowID id,
90 
91  virtual ~DisasmExecCountFrame();
92  void update();
93  void addExecCount(
94  unsigned execCount, unsigned start,
95  unsigned end, const wxColour& colour);
96 
97 private:
98  void onClose(wxCloseEvent& event);
99  void onSelection(wxListEvent& event);
100  wxListCtrl* list_;
102 
103  DECLARE_EVENT_TABLE()
104 };
105 
106 #endif
TracedSimulatorFrontend
Definition: TracedSimulatorFrontend.hh:49
DisasmTopCountAttrProvider
Definition: DisasmTopCountAttrProvider.hh:53
DisasmTopCountAttrProvider::ExecutionCountTable
std::map< ClockCycleCount, AddressSet > ExecutionCountTable
Definition: DisasmTopCountAttrProvider.hh:63
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
DisasmTopCountAttrProvider::AddressSet
std::set< InstructionAddress > AddressSet
Definition: DisasmTopCountAttrProvider.hh:62
DisasmExecCountFrame::~DisasmExecCountFrame
virtual ~DisasmExecCountFrame()
Definition: DisasmTopCountAttrProvider.cc:80
DisasmTopCountAttrProvider::bgColour
wxColour bgColour(ClockCycleCount execCount)
Definition: DisasmTopCountAttrProvider.cc:285
DisasmTopCountAttrProvider::update
virtual void update()
Definition: DisasmTopCountAttrProvider.cc:195
DisasmTopCountAttrProvider::updateTopCountTable
void updateTopCountTable()
Definition: DisasmTopCountAttrProvider.cc:228
DisasmTopCountAttrProvider::listWin_
DisasmExecCountFrame * listWin_
Definition: DisasmTopCountAttrProvider.hh:78
SimulatorConstants.hh
DisasmTopCountAttrProvider::createExecCountWindow
void createExecCountWindow()
DisasmTopCountAttrProvider::DisasmTopCountAttrProvider
DisasmTopCountAttrProvider(TracedSimulatorFrontend &simulator, size_t topCounts)
Definition: DisasmTopCountAttrProvider.cc:170
ProximDisasmAttrProvider.hh
ProximDisasmAttrProvider
Definition: ProximDisasmAttrProvider.hh:44
DisasmExecCountFrame::list_
wxListCtrl * list_
Definition: DisasmTopCountAttrProvider.hh:100
DisasmTopCountAttrProvider::moveCellAttr
virtual wxGridCellAttr * moveCellAttr(InstructionAddress address, int move)
Definition: DisasmTopCountAttrProvider.cc:207
DisasmTopCountAttrProvider::simulator_
TracedSimulatorFrontend & simulator_
Simulator frontend used for accessing the instructions and exec counts.
Definition: DisasmTopCountAttrProvider.hh:75
DisasmExecCountFrame::onSelection
void onSelection(wxListEvent &event)
Definition: DisasmTopCountAttrProvider.cc:156
DisasmExecCountFrame::topCountTable_
const DisasmTopCountAttrProvider::ExecutionCountTable & topCountTable_
Definition: DisasmTopCountAttrProvider.hh:101
DisasmExecCountFrame::DisasmExecCountFrame
DisasmExecCountFrame(wxWindow *parent, wxWindowID id, const DisasmTopCountAttrProvider::ExecutionCountTable &table)
Definition: DisasmTopCountAttrProvider.cc:60
DisasmTopCountAttrProvider::addToTopCountTable
void addToTopCountTable(InstructionAddress address, ClockCycleCount execCount)
Definition: DisasmTopCountAttrProvider.cc:256
DisasmTopCountAttrProvider::topCounts_
size_t topCounts_
Number of top execution counts in the top execution count list.
Definition: DisasmTopCountAttrProvider.hh:77
DisasmTopCountAttrProvider::~DisasmTopCountAttrProvider
virtual ~DisasmTopCountAttrProvider()
Definition: DisasmTopCountAttrProvider.cc:185
DisasmTopCountAttrProvider::topCountTable_
ExecutionCountTable topCountTable_
Top execution counts and set of instruction addresses with each count.
Definition: DisasmTopCountAttrProvider.hh:73
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
DisasmExecCountFrame::addExecCount
void addExecCount(unsigned execCount, unsigned start, unsigned end, const wxColour &colour)
DisasmExecCountFrame
Definition: DisasmTopCountAttrProvider.hh:85
DisasmExecCountFrame::update
void update()
Definition: DisasmTopCountAttrProvider.cc:87
DisasmExecCountFrame::onClose
void onClose(wxCloseEvent &event)
Listener.hh