26 #include <QPushButton> 
   27 #include <QVBoxLayout> 
   41 #define DEFAULT_PARTITIONMODE "Inclusive" 
   42 #define DEFAULT_DIAGRAMMODE   false 
   43 #define DEFAULT_DRAWFRAMES    true 
   44 #define DEFAULT_SHOWINFO      false 
   45 #define DEFAULT_FUNCTIONZOOM  false 
   46 #define DEFAULT_CALLEELEVELS  1 
   47 #define DEFAULT_DRAWNAME      true 
   48 #define DEFAULT_DRAWCOST      true 
   49 #define DEFAULT_FORCESTRINGS  false 
   50 #define DEFAULT_ALLOWROTATION true 
   56   _inSelectionUpdate = 
false;
 
   58   setWindowTitle(tr(
"Parts Overview"));
 
   60   QVBoxLayout* vboxLayout = 
new QVBoxLayout(
this);
 
   61   vboxLayout->setSpacing(6);
 
   62   vboxLayout->setMargin(6);
 
   65   _partAreaWidget->setMinimumHeight(50);
 
   66   _partAreaWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
   71   _partAreaWidget->
setFieldType(0, tr(
"Name", 
"A thing's name"));
 
   73   vboxLayout->addWidget(_partAreaWidget);
 
   75   _rangeLabel = 
new QLabel(
this);
 
   76   _rangeLabel->setWordWrap(
false);
 
   77   _rangeLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
 
   78   vboxLayout->addWidget(_rangeLabel);
 
   79   _rangeLabel->setText(tr(
"(no trace parts)"));
 
   92   connect(_partAreaWidget, SIGNAL(currentChanged(
TreeMapItem*, 
bool)),
 
   96   connect(_partAreaWidget,
 
  106     return tr( 
"<b>The Parts Overview</b>" 
  107            "<p>A trace consists of multiple trace parts when " 
  108            "there are several profile data files from one profile run. " 
  109            "The Trace Part Overview dockable shows these, " 
  110            "horizontally ordered in execution time; " 
  111            "the rectangle sizes are proportional to the total " 
  112            "cost spent in the parts. You can select one or several " 
  113            "parts to constrain all costs shown to these parts only." 
  115            "<p>The parts are further subdivided: there is a " 
  116            "partitioning and an callee split mode: " 
  117            "<ul><li>Partitioning: You see the " 
  118            "partitioning into groups for a trace part, according to " 
  119            "the group type selected. E.g. if ELF object groups are " 
  120            "selected, you see colored rectangles for each " 
  121            "used ELF object (shared library or executable), sized " 
  122            "according to the cost spent therein.</li>" 
  123            "<li>Callee: A rectangle showing the inclusive " 
  124            "cost of the current selected function in the trace part " 
  126            "This is split up into smaller rectangles to show the costs of its " 
  127            "callees.</li></ul></p>");
 
  133     _partAreaWidget->
setData(data);
 
  156     _inSelectionUpdate = 
true;
 
  158     qDebug(
"Entering PartSelection::activePartsChangedSlot");
 
  164         bool active = list.contains(part);
 
  165     if (!active && _partAreaWidget->
isSelected(i)) {
 
  167         qDebug(
"PartSelection::selectParts: Part %s changed to unselected.",
 
  168            ((
PartItem*)i)->part()->shortName());
 
  176         bool active = list.contains(part);
 
  177     if (active && !_partAreaWidget->
isSelected(i)) {
 
  179         qDebug(
"PartSelection::selectParts: Part %s changed to selected.",
 
  180            ((
PartItem*)i)->part()->shortName()));
 
  186     _inSelectionUpdate = 
false;
 
  188     qDebug(
"Leaving PartSelection::activePartsChangedSlot");
 
  192 void PartSelection::doUpdate(
int changeType, 
bool)
 
  217     _inSelectionUpdate = 
true;
 
  219     _inSelectionUpdate = 
false;
 
  225     _partAreaWidget->
redraw();
 
  235     if (i->
text(0).isEmpty()) 
return;
 
  238     QString str = i->
text(0);
 
  239     if (!i->
text(1).isEmpty())
 
  240         str += 
" (" + i->
text(1) + 
')';
 
  241     QString msg = tr(
"Profile Part Overview: Current is '%1'").arg(str);
 
  246     if (_showInfo) fillInfo();
 
  252     if (!i || i->
rtti() != 3) 
return;
 
  286     if (_inSelectionUpdate) 
return;
 
  288     qDebug(
"PartSelection::selectionChanged");
 
  290     bool something_changed = 
false;
 
  291     bool nothingSelected = 
true;
 
  302         nothingSelected = 
false;
 
  308     bool active = nothingSelected || _partAreaWidget->
isSelected(i);
 
  311         something_changed = 
true;
 
  315     if (something_changed) {
 
  323     QAction* a = qobject_cast<QAction*>(sender());
 
  339     QAction* selectPartAction = 0;
 
  340     QAction* selectAllPartsAction = 0;
 
  341     QAction* hidePartsAction = 0;
 
  342     QAction* showPartsAction = 0;
 
  345     if (!s->
text(0).isEmpty()) {
 
  347         str = tr(
"Deselect '%1'").arg(s->
text(0));
 
  349         str = tr(
"Select '%1'").arg(s->
text(0));
 
  351         selectPartAction = popup.addAction(str);
 
  354     selectAllPartsAction = popup.addAction(tr(
"Select All Parts"));
 
  355     QMenu* ppopup = popup.addMenu(tr(
"Visible Parts"));
 
  356     hidePartsAction = ppopup->addAction(tr(
"Hide Selected Parts"));
 
  357     showPartsAction = ppopup->addAction(tr(
"Show Hidden Parts"));
 
  359     popup.addSeparator();
 
  364     if (i->
rtti() == 3) {
 
  366     while (ni && ni->
rtti() == 3) {
 
  372         a = popup.addAction(str);
 
  373         a->setData(QVariant::fromValue( (
void*)ni ));
 
  374         connect(a, SIGNAL(triggered()), 
this, SLOT(
itemSelected()));
 
  378     popup.addSeparator();
 
  380     QMenu* vpopup = popup.addMenu(tr(
"Visualization"));
 
  381     QAction* showPartitioningAction = vpopup->addAction(tr(
"Partitioning Mode"));
 
  382     showPartitioningAction->setCheckable(
true);
 
  383     QAction* zoomFunctionAction = vpopup->addAction(tr(
"Zoom Function"));
 
  384     zoomFunctionAction->setCheckable(
true);
 
  385     QAction* directCallsAction = vpopup->addAction(tr(
"Show Direct Calls"));
 
  386     QAction* incCallsAction = vpopup->addAction(tr(
"Increment Shown Call Levels"));
 
  387     QAction* showDiagramAction = vpopup->addAction(tr(
"Diagram Mode"));
 
  388     showDiagramAction->setCheckable(
true);
 
  390     showPartitioningAction->setChecked(
true);
 
  391     zoomFunctionAction->setEnabled(
false);
 
  392     directCallsAction->setEnabled(
false);
 
  393     incCallsAction->setEnabled(
false);
 
  396     zoomFunctionAction->setChecked(_partAreaWidget->
zoomFunction());
 
  398     showDiagramAction->setChecked(_diagramMode);
 
  400     vpopup->addSeparator();
 
  402     QAction* drawNamesAction = vpopup->addAction(tr(
"Draw Names"));
 
  403     drawNamesAction->setCheckable(
true);
 
  404     QAction* drawCostsAction = vpopup->addAction(tr(
"Draw Costs"));
 
  405     drawCostsAction->setCheckable(
true);
 
  406     QAction* ignorePropsAction = vpopup->addAction(tr(
"Ignore Proportions"));
 
  407     ignorePropsAction->setCheckable(
true);
 
  408     QAction* allowRotationAction = vpopup->addAction(tr(
"Allow Rotation"));
 
  409     allowRotationAction->setCheckable(
true);
 
  410     QAction* drawFramesAction = vpopup->addAction(tr(
"Draw Frames"));
 
  411     drawFramesAction->setCheckable(
true);
 
  414     ignorePropsAction->setEnabled(
false);
 
  415     allowRotationAction->setEnabled(
false);
 
  418     drawNamesAction->setChecked(_partAreaWidget->
fieldVisible(0));
 
  419     drawCostsAction->setChecked(_partAreaWidget->
fieldVisible(1));
 
  420     ignorePropsAction->setChecked(_partAreaWidget->
fieldForced(0));
 
  421     allowRotationAction->setChecked(_partAreaWidget->
allowRotation());
 
  422     drawFramesAction->setChecked(_drawFrames);
 
  424     QAction* showInfoAction = popup.addAction(_showInfo ? tr(
"Hide Info"):tr(
"Show Info"));
 
  426     a = popup.exec(_partAreaWidget->mapToGlobal(p));
 
  428     if (a == selectPartAction) {
 
  432     else if (a == selectAllPartsAction) {
 
  437     else if (a == hidePartsAction)
 
  439     else if (a == showPartsAction)
 
  441     else if (a == drawNamesAction)
 
  443     else if (a == drawCostsAction)
 
  445     else if (a == ignorePropsAction) {
 
  449     else if (a == allowRotationAction)
 
  451     else if (a == drawFramesAction) {
 
  452     _drawFrames = !_drawFrames;
 
  453     _partAreaWidget->
drawFrame(2,_drawFrames);
 
  454     _partAreaWidget->
drawFrame(3,_drawFrames);
 
  456     else if (a == showInfoAction)
 
  458     else if (a == showPartitioningAction)
 
  462     else if (a == zoomFunctionAction) {
 
  466     else if (a == directCallsAction)
 
  468     else if (a == incCallsAction) {
 
  472     else if (a == showDiagramAction) {
 
  473     _diagramMode = !_diagramMode;
 
  487     QString pmode = g->
value(
"PartitionMode",
 
  489     if (pmode == 
"Inclusive")
 
  498     _partAreaWidget->
drawFrame(2,_drawFrames);
 
  499     _partAreaWidget->
drawFrame(3,_drawFrames);
 
  533     mode = 
"Partitioning";
 
  558   if (_showInfo == enable) 
return;
 
  569 void PartSelection::fillInfo()
 
  572     _rangeLabel->setText(tr(
"(no trace loaded)"));
 
  585       info += 
", Time " + part->
timeframe() + 
" BBs";
 
  590     if (part && !part->
version().isEmpty())
 
  591       info += 
", Cachegrind " + part->
version();
 
  595   _rangeLabel->setText(info);
 
  598 #include "partselection.moc" 
void doubleClicked(TreeMapItem *)
virtual void partsSelected(TraceItemView *sender, const TracePartList &)
ProfileContext::Type type() const 
virtual void setValue(const QString &key, const QVariant &value, const QVariant &defaultValue=QVariant())
Base class for cost items. 
#define DEFAULT_ALLOWROTATION
void currentChangedSlot(TreeMapItem *, bool)
QString activePartRange()
virtual TracePart * part()
ProfileContext::Type _groupType
void hiddenPartsChangedSlot(const TracePartList &list)
static ConfigGroup * group(const QString &group, const QString &optSuffix=QString())
Abstract Base Class for KCachegrind Views. 
virtual void setData(TraceData *d)
void restoreOptions(const QString &prefix, const QString &postfix)
TracePartList parts() const 
TreeMapItem * parent() const 
Parent Item. 
An array of basic cost metrics for a trace item. 
#define DEFAULT_FUNCTIONZOOM
PartSelection(TopLevelBase *, QWidget *parent=0)
Cost of a class, from a single trace file. 
QString whatsThis() const 
static QString shortenSymbol(const QString &)
A group of configuration settings. 
Cost of a function, from a single trace file. 
void saveOptions(const QString &prefix, const QString &postfix)
virtual TreeMapItemList * children()
#define DEFAULT_CALLEELEVELS
virtual void activated(TraceItemView *sender, CostItem *)
#define DEFAULT_PARTITIONMODE
#define DEFAULT_DIAGRAMMODE
QString timeframe() const 
A Trace Part: All data read from a trace file, containing all costs that happened in a specified time...
Cost of a source file, from a single trace file. 
QList< TracePart * > TracePartList
virtual void showMessage(const QString &, int msec)=0
#define DEFAULT_FORCESTRINGS
This class holds profiling data of multiple tracefiles generated with cachegrind on one command...
Base class of items in TreeMap. 
#define DEFAULT_DRAWFRAMES
void contextMenuRequested(TreeMapItem *, const QPoint &)
Cost of a object, from a single trace file. 
void setData(TraceData *)
virtual QVariant value(const QString &key, const QVariant &defaultValue) const