OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DisasmExecCountFrame Class Reference

#include <DisasmTopCountAttrProvider.hh>

Inheritance diagram for DisasmExecCountFrame:
Inheritance graph
Collaboration diagram for DisasmExecCountFrame:
Collaboration graph

Public Member Functions

 DisasmExecCountFrame (wxWindow *parent, wxWindowID id, const DisasmTopCountAttrProvider::ExecutionCountTable &table)
 
virtual ~DisasmExecCountFrame ()
 
void update ()
 
void addExecCount (unsigned execCount, unsigned start, unsigned end, const wxColour &colour)
 

Private Member Functions

void onClose (wxCloseEvent &event)
 
void onSelection (wxListEvent &event)
 

Private Attributes

wxListCtrl * list_
 
const DisasmTopCountAttrProvider::ExecutionCountTabletopCountTable_
 

Detailed Description

Simple list window for displaying list of top execution counts.

Definition at line 85 of file DisasmTopCountAttrProvider.hh.

Constructor & Destructor Documentation

◆ DisasmExecCountFrame()

DisasmExecCountFrame::DisasmExecCountFrame ( wxWindow *  parent,
wxWindowID  id,
const DisasmTopCountAttrProvider::ExecutionCountTable topCountTable 
)

The Constructor.

Parameters
parentParent window of the miniframe.
idWindow identifier for the frame.
topCountTableTable of top execution counts to display.

Definition at line 60 of file DisasmTopCountAttrProvider.cc.

62 :
63 wxMiniFrame(parent, id, _T("Top Execution Counts")),
64 topCountTable_(topCountTable) {
65
66 wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
67 list_ = new wxListCtrl(
68 this, -1, wxDefaultPosition, wxDefaultSize,
69 wxLC_REPORT | wxLC_SINGLE_SEL);
70
71 list_->InsertColumn(0, _T("Exec Count"), wxLIST_FORMAT_LEFT, 100);
72 list_->InsertColumn(1, _T("Address range"), wxLIST_FORMAT_LEFT, 200);
73 sizer->Add(list_, 1, wxEXPAND|wxALL, 5);
74 SetSizer(sizer);
75}
const DisasmTopCountAttrProvider::ExecutionCountTable & topCountTable_

◆ ~DisasmExecCountFrame()

DisasmExecCountFrame::~DisasmExecCountFrame ( )
virtual

The Destructor.

Definition at line 80 of file DisasmTopCountAttrProvider.cc.

80 {
81}

Member Function Documentation

◆ addExecCount()

void DisasmExecCountFrame::addExecCount ( unsigned  execCount,
unsigned  start,
unsigned  end,
const wxColour &  colour 
)

◆ onClose()

void DisasmExecCountFrame::onClose ( wxCloseEvent &  event)
private

◆ onSelection()

void DisasmExecCountFrame::onSelection ( wxListEvent &  event)
private

Event handler for the execution count list selection events.

Selects and shows the start address of the selected range in the disassembly winow.

Parameters
eventSelection event to handle.

Definition at line 156 of file DisasmTopCountAttrProvider.cc.

156 {
157 unsigned addr = list_->GetItemData(event.GetIndex());
159 disasmwin.showAddress(addr);
160}
void showAddress(unsigned address)
static ProximDisassemblyWindow * disassemblyWindow()

References ProximToolbox::disassemblyWindow(), list_, and ProximDisassemblyWindow::showAddress().

Here is the call graph for this function:

◆ update()

void DisasmExecCountFrame::update ( )

Updates the execution count list.

Definition at line 87 of file DisasmTopCountAttrProvider.cc.

87 {
88
89 list_->DeleteAllItems();
90
91 DisasmTopCountAttrProvider::ExecutionCountTable::const_iterator iter =
92 topCountTable_.begin();
93
94 int pos = topCountTable_.size();
95 // Iterate through all entries in the topcount table.
96 for (; iter != topCountTable_.end(); iter++) {
97
98 pos--;
99 unsigned count = (*iter).first;
101 (*iter).second;
102
103 DisasmTopCountAttrProvider::AddressSet::const_iterator citer =
104 addressSet.begin();
105
106 // Iterate through all addresses with the same execution count and
107 // combine consecutive addresses to address ranges.
108 while (citer != addressSet.end()) {
109 unsigned rangeFirst = *citer;
110 unsigned rangeLast = *citer;
111 while (citer != addressSet.end() && (*citer == rangeLast)) {
112 citer++;
113 rangeLast++;
114 }
115 rangeLast--;
116
117 // Add list entry for the address range.
118 wxString range = WxConversion::toWxString(rangeFirst);
119 if (rangeFirst != rangeLast) {
120 range.Append(_T(" - "));
121 range.Append(WxConversion::toWxString(rangeLast));
122 }
123
124 list_->InsertItem(0, WxConversion::toWxString(count));
125 list_->SetItem(0, 1, range);
126 list_->SetItemData(0, rangeFirst);
127
128 // Set background color for the list item.
129 // TODO: more elegant solution :)
130 if (pos < 5) {
131 list_->SetItemBackgroundColour(
132 0, wxColour(255 , pos * 50, 0));
133 } else {
134 list_->SetItemBackgroundColour(
135 0, wxColour(255 - (2 * (pos * 25 - 128)), 255, 0));
136 }
137
138
139 if (citer != addressSet.end()) {
140 citer++;
141 }
142 }
143 }
144}
std::set< InstructionAddress > AddressSet
static wxString toWxString(const std::string &source)

References list_, topCountTable_, and WxConversion::toWxString().

Referenced by DisasmTopCountAttrProvider::update().

Here is the call graph for this function:

Member Data Documentation

◆ list_

wxListCtrl* DisasmExecCountFrame::list_
private

Definition at line 100 of file DisasmTopCountAttrProvider.hh.

Referenced by onSelection(), and update().

◆ topCountTable_

const DisasmTopCountAttrProvider::ExecutionCountTable& DisasmExecCountFrame::topCountTable_
private

Definition at line 101 of file DisasmTopCountAttrProvider.hh.

Referenced by update().


The documentation for this class was generated from the following files: