33 #include <wx/minifram.h>
61 wxWindow* parent, wxWindowID
id,
63 wxMiniFrame(parent,
id, _T("Top Execution Counts")),
64 topCountTable_(topCountTable) {
66 wxSizer* sizer =
new wxBoxSizer(wxVERTICAL);
67 list_ =
new wxListCtrl(
68 this, -1, wxDefaultPosition, wxDefaultSize,
69 wxLC_REPORT | wxLC_SINGLE_SEL);
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);
89 list_->DeleteAllItems();
91 DisasmTopCountAttrProvider::ExecutionCountTable::const_iterator iter =
99 unsigned count = (*iter).first;
103 DisasmTopCountAttrProvider::AddressSet::const_iterator citer =
108 while (citer != addressSet.end()) {
109 unsigned rangeFirst = *citer;
110 unsigned rangeLast = *citer;
111 while (citer != addressSet.end() && (*citer == rangeLast)) {
119 if (rangeFirst != rangeLast) {
120 range.Append(_T(
" - "));
125 list_->SetItem(0, 1, range);
126 list_->SetItemData(0, rangeFirst);
131 list_->SetItemBackgroundColour(
132 0, wxColour(255 , pos * 50, 0));
134 list_->SetItemBackgroundColour(
135 0, wxColour(255 - (2 * (pos * 25 - 128)), 255, 0));
139 if (citer != addressSet.end()) {
157 unsigned addr =
list_->GetItemData(event.GetIndex());
173 simulator_(simulator), topCounts_(topCounts) {
210 wxGridCellAttr* attr =
new wxGridCellAttr();
215 if (execCount == 0) {
216 attr->SetBackgroundColour(wxColour(220, 220, 220));
218 attr->SetBackgroundColour(
bgColour(execCount));
243 instruction = &
program.nextInstruction(*instruction);
259 ExecutionCountTable::iterator iter =
topCountTable_.find(execCount);
261 (*iter).second.insert(address);
266 addressSet.insert(address);
268 std::pair<ClockCycleCount, AddressSet>(execCount, addressSet));
287 ExecutionCountTable::reverse_iterator iter =
topCountTable_.rbegin();
290 if ((*iter).first == execCount) {
300 return wxColour(255 , 2 * value, 0);
302 return wxColour(255 - (2 * (value-128)), 255, 0);
305 return wxColour(255, 255, 255);