Commit 97a6fb31 authored by Josef Weidendorfer's avatar Josef Weidendorfer
Browse files

KCachegrind: reduce visualization view updates by update merging

The TraceViewItem class, which is the base class for all
visualization views in KCachegrind, now does update merging, ie.
a call to updateView() now does not directly result in a call
to doUpdate().

This e.g. cuts down the number of refreshes for the Flat profile
on startup of KCachegrind with a data file from 4 to 1, and also
gets rid of a short wrong display, as well as slow flicker.

Sometimes (e.g. when setting a new profile data model), we need
to skip this merging either completely for one update with
updateView(true), or for all updates of a TraceViewItem subclass
with setMergingUpdates(false).

svn path=/trunk/KDE/kdesdk/kcachegrind/; revision=1007541
parent b7c65e7a
......@@ -1473,7 +1473,9 @@ void TopLevel::setData(TraceData* data)
_functionSelection->setData(_data);
_functionSelection->updateView();
_multiView->setData(_data);
_multiView->updateView();
// Force update of _data in all children of _multiView
// This is needed to make restoring of activeItem work!
_multiView->updateView(true);
/* this is needed to let the other widgets know the types */
restoreTraceTypes();
......
......@@ -1815,7 +1815,7 @@ CostItem* CallGraphView::canShow(CostItem* i)
return 0;
}
void CallGraphView::doUpdate(int changeType)
void CallGraphView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == eventType2Changed)
......
......@@ -635,7 +635,7 @@ protected:
private:
void updateSizes(QSize s = QSize(0,0));
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
void refresh();
void makeFrame(CanvasNode*, bool active);
void clear();
......
......@@ -471,7 +471,7 @@ CostItem* CallMapView::canShow(CostItem* i)
return 0;
}
void CallMapView::doUpdate(int changeType)
void CallMapView::doUpdate(int changeType, bool)
{
if (changeType == eventType2Changed) return;
......
......@@ -57,7 +57,7 @@ private slots:
private:
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
bool _showCallers;
};
......
......@@ -176,7 +176,7 @@ CostItem* CallView::canShow(CostItem* i)
return 0;
}
void CallView::doUpdate(int changeType)
void CallView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == selectedItemChanged) {
......
......@@ -46,7 +46,7 @@ private slots:
private:
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
void refresh();
bool _showCallers;
......
......@@ -214,7 +214,7 @@ CostItem* CoverageView::canShow(CostItem* i)
return 0;
}
void CoverageView::doUpdate(int changeType)
void CoverageView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == selectedItemChanged) {
......
......@@ -46,7 +46,7 @@ private slots:
private:
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
void refresh();
HighestCostList _hc;
......
......@@ -191,7 +191,7 @@ CostItem* EventTypeView::canShow(CostItem* i)
return i;
}
void EventTypeView::doUpdate(int changeType)
void EventTypeView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == selectedItemChanged) return;
......
......@@ -46,7 +46,7 @@ private slots:
private:
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
void refresh();
};
......
......@@ -344,7 +344,7 @@ CostItem* FunctionSelection::canShow(CostItem* i)
}
void FunctionSelection::doUpdate(int changeType)
void FunctionSelection::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == selectedItemChanged) return;
......
......@@ -71,7 +71,7 @@ public slots:
private:
CostItem* canShow(CostItem* i);
void doUpdate(int);
void doUpdate(int, bool);
void selectFunction();
void refresh();
void setCostColumnWidths();
......
......@@ -321,7 +321,7 @@ CostItem* InstrView::canShow(CostItem* i)
}
void InstrView::doUpdate(int changeType)
void InstrView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == selectedItemChanged) {
......
......@@ -55,7 +55,7 @@ private slots:
private:
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
void refresh();
void setColumnWidths();
bool searchFile(QString&, TraceObject*);
......
......@@ -73,6 +73,9 @@ void MultiView::appendView()
_views.append(tv);
tv->show();
// no need to waste time with update merging
tv->setMergeUpdates(false);
// set same attributes as in active view
tv->set(0, _data, _eventType, _eventType2,
_groupType, _partList, _activeItem, 0);
......@@ -152,7 +155,7 @@ void MultiView::activated(TraceItemView* sender, CostItem* i)
TraceItemView::activated(sender,i);
}
void MultiView::doUpdate(int changeType)
void MultiView::doUpdate(int changeType, bool force)
{
TabView* tv;
for(tv=_views.first(); tv; tv=_views.next()) {
......@@ -162,7 +165,7 @@ void MultiView::doUpdate(int changeType)
tv->selectedItem());
tv->notifyChange(changeType);
if (tv->isViewVisible())
tv->updateView();
tv->updateView(force);
}
}
......
......@@ -59,7 +59,7 @@ public slots:
void tabActivated(TabView*);
private:
void doUpdate(int);
void doUpdate(int, bool);
TabView* _active;
Q3PtrList<TabView> _views;
......
......@@ -192,7 +192,7 @@ void PartSelection::selectParts(const TracePartList& list)
}
void PartSelection::doUpdate(int changeType)
void PartSelection::doUpdate(int changeType, bool)
{
if (changeType == eventType2Changed) return;
if (changeType == selectedItemChanged) return;
......
......@@ -68,7 +68,7 @@ public slots:
private:
// reimplementations of TraceItemView
CostItem* canShow(CostItem*);
void doUpdate(int);
void doUpdate(int, bool);
// helper for doUpdate
void selectParts(const TracePartList& list);
......
......@@ -139,7 +139,7 @@ CostItem* PartView::canShow(CostItem* i)
return 0;
}
void PartView::doUpdate(int changeType)
void PartView::doUpdate(int changeType, bool)
{
// Special case ?
if (changeType == eventType2Changed) return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment