39 Addr addr,
const QString& msg)
49 setTextAlignment(0, Qt::AlignRight);
50 setTextAlignment(1, Qt::AlignRight);
51 setTextAlignment(2, Qt::AlignRight);
62 Addr addr,
bool inside,
63 const QString& code,
const QString& cmd,
74 setTextAlignment(0, Qt::AlignRight);
75 setTextAlignment(1, Qt::AlignRight);
76 setTextAlignment(2, Qt::AlignRight);
87 if (instr && (l = instr->
line()))
88 setText(7, l->
name());
106 setTextAlignment(0, Qt::AlignRight);
107 setTextAlignment(1, Qt::AlignRight);
108 setTextAlignment(2, Qt::AlignRight);
114 QString callStr =
" ";
116 callStr += QObject::tr(
"Active call to '%1'")
119 callStr += QObject::tr(
"%n call(s) to '%2'",
"", (
uint64)cc)
143 setTextAlignment(0, Qt::AlignRight);
144 setTextAlignment(1, Qt::AlignRight);
145 setTextAlignment(2, Qt::AlignRight);
152 jStr = QObject::tr(
"Jump %1 of %2 times to 0x%3")
157 jStr = QObject::tr(
"Jump %1 times to 0x%2")
170 if (!_instrCall)
return;
183 if (_instrJump)
return;
195 QString icon =
"edit-undo";
197 KIconLoader* loader = KIconLoader::global();
198 p= loader->loadIcon(icon, KIconLoader::Small, 0,
199 KIconLoader::DefaultState, QStringList(), 0,
true);
202 str = QObject::tr(
"(cycle)");
220 setText(1, QString());
221 setIcon(1, QPixmap());
224 double total = totalCost->
subCost(et);
225 double pure = 100.0 * _pure / total;
228 setText(1, QString(
"%1")
231 setText(1, _pure.
pretty());
233 setIcon(1,
costPixmap(et, instrCost, total,
false));
239 setText(2, QString());
240 setIcon(2, QPixmap());
243 double total = totalCost->
subCost(ct2);
244 double pure = 100.0 * _pure2 / total;
247 setText(2, QString(
"%1")
250 setText(2, _pure2.
pretty());
252 setIcon(2,
costPixmap(ct2, instrCost, total,
false));
260 int col = treeWidget()->sortColumn();
263 return (ii1->_pure < ii2->_pure);
266 return (ii1->_pure2 < ii2->_pure2);
269 if (ii1->_addr < ii2->_addr)
return true;
270 if (ii1->_addr > ii2->_addr)
return false;
273 if (!ii1->_instrCall && !ii1->_instrJump)
return true;
274 if (!ii2->_instrCall && !ii2->_instrJump)
return false;
277 if (ii1->_instrCall && !ii2->_instrCall)
return true;
278 if (ii2->_instrCall && !ii1->_instrCall)
return false;
280 if (ii1->_instrCall && ii2->_instrCall) {
282 if (ii1->_pure < ii2->_pure)
return true;
283 if (ii1->_pure > ii2->_pure)
return false;
295 return QTreeWidgetItem::operator<(other);
314 const QModelIndex &index)
const
316 QSize sz = QItemDelegate::sizeHint(option, index);
318 int c = index.column();
319 if (c != 3)
return sz;
325 return QSize(0, sz.height());
328 return QSize(10 + 6*levels + 2, sz.height());
332 const QStyleOptionViewItem &option,
333 const QModelIndex &index)
const
335 int column = index.column();
339 if ( !item->
inside() || ((column==1) || (column==2)))
340 color = option.palette.color( QPalette::Button );
342 color = option.palette.color( QPalette::Midlight );
349 QItemDelegate::paint(painter, option, index);
353 const QStyleOptionViewItem &option,
354 const QModelIndex &index)
const
360 const QRect& rect = option.rect;
361 int height = rect.height();
364 drawBackground(p, option, index);
365 p->translate(rect.topLeft());
368 int yy = height/2, y1, y2;
371 int start = -1, end = -1;
378 for(
int i=0; i< item->
jumpCount(); i++) {
380 if (jump == 0)
continue;
384 if ((instrJump == jump) &&
388 if (start<0) start = i;
394 else if (!instrJump && !instrCall &&
406 p->fillRect( marg + 6*i, y1, 4, y2, c);
407 p->setPen(c.light());
408 p->drawLine( marg + 6*i, y1, marg + 6*i, y2);
410 p->drawLine( marg + 6*i +3, y1, marg + 6*i +3, y2);
414 int x, y = yy-2, w, h = 4;
419 p->fillRect( x, y, w, h, c);
420 p->setPen(c.light());
421 p->drawLine(x, y, x+w-1, y);
422 p->drawLine(x, y, x, y+h-1);
424 p->drawLine(x+w-1, y, x+w-1, y+h-1);
425 p->drawLine(x+1, y+h-1, x+w-1, y+h-1);
433 a.putPoints(0, 8, x,y+h,
434 x,y, x+w-8,y, x+w-8,y-2,
436 x+w-8,y+h+2, x+w-8,y+h,
439 p->drawConvexPolygon(a);
441 p->setPen(c.light());
442 p->drawPolyline(a.constData(), 5);
444 p->drawPolyline(a.constData() + 4, 2);
445 p->setPen(c.light());
446 p->drawPolyline(a.constData() + 5, 2);
448 p->drawPolyline(a.constData() + 6, 2);
453 for(
int i=0; i< item->
jumpCount(); i++) {
455 if (jump == 0)
continue;
462 if (start<0) drawUp=
false;
465 p->fillRect( marg + 6*i +1, 0, 2, yy, c);
467 p->fillRect( marg + 6*i +1, yy, 2, height-yy, c);
472 p->fillRect( marg + 6*i +1, 0, 2, yy, c);
474 p->fillRect( marg + 6*i +1, yy, 2, height-yy, c);
EventType * eventType2() const
bool operator<(const QTreeWidgetItem &other) const
static bool showPercentage()
SubCost subCost(EventType *)
Returns a sub cost.
TraceInstr * instr() const
EventType * eventType() const
TraceInstr * instrTo() const
void setJumpArray(const QVector< TraceInstrJump * > &a)
static QColor functionColor(ProfileContext::Type gt, TraceFunction *)
unsigned long long uint64
A call from an instruction of one function to another function.
Addresses are 64bit values like costs to be able to always load profile data produced on 64bit archit...
virtual void setData(TraceData *d)
TraceInstrJump * jump(int i) const
An array of basic cost metrics for a trace item.
InstrItemDelegate(InstrView *parent)
A code instruction address of the program.
TraceFunction * function() const
QString prettyName() const
Similar to name, but prettyfied = more descriptive to humans.
virtual TraceData * data()
A source line of the program.
virtual QString name() const
Returns dynamic name info (without type)
A jump from an instruction to another inside of a function.
static bool showExpanded()
void paintArrows(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const
static int percentPrecision()
Cost event counter, simple wrapper around a 64bit entity.
TraceFunction * called(bool skipCycle=false) const
void addPrettyLocation(QString &, int maxFiles=1) const
QString pretty(char sep= ' ') const
Convert SubCost value into a QString, spaced every 3 digits.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
TraceInstr * instrFrom() const
InstrItem(InstrView *iv, QTreeWidget *parent, Addr addr, const QString &)
TraceInstrCall * instrCall() const
TraceInstrJump * instrJump() const
ProfileContext::Type groupType() const
QPixmap costPixmap(EventType *ct, ProfileCostArray *cost, double total, bool framed)
QPixmap colorPixmap(int w, int h, QColor c)
QString calledName(bool skipCycle=false) const
ProfileCostArray * inclusive()
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const