aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@digia.com>2013-06-14 15:46:42 +0200
committerKai Koehne <kai.koehne@digia.com>2013-06-14 17:32:04 +0300
commit35d9037732bdc581d3578650bd438e4eb964d298 (patch)
tree5e70531521e800caa5ef2345e6d820113267819c
parent1b06a7646d95d04edeb0e17563a12ecbe46bfc43 (diff)
QmlProfiler: overview using model aggregator
Change-Id: Iaffb44d97e6641f2e34df6fb5ac839f5b6ebc545 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r--plugins/qmlprofiler/abstracttimelinemodel.h1
-rw-r--r--plugins/qmlprofiler/qml/Overview.js97
-rw-r--r--plugins/qmlprofiler/qmlprofiler.pro2
-rw-r--r--plugins/qmlprofiler/qmlprofiler.qbs2
-rw-r--r--plugins/qmlprofiler/qmlprofileroverviewmodelproxy.cpp227
-rw-r--r--plugins/qmlprofiler/qmlprofileroverviewmodelproxy.h105
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp7
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h1
-rw-r--r--plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp9
-rw-r--r--plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h1
-rw-r--r--plugins/qmlprofiler/qmlprofilertraceview.cpp8
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.cpp27
-rw-r--r--plugins/qmlprofiler/timelinemodelaggregator.h3
-rw-r--r--plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp8
-rw-r--r--plugins/qmlprofilerextended/scenegraphtimelinemodel.h1
15 files changed, 103 insertions, 396 deletions
diff --git a/plugins/qmlprofiler/abstracttimelinemodel.h b/plugins/qmlprofiler/abstracttimelinemodel.h
index 7ef5dc821e..1e96a22adc 100644
--- a/plugins/qmlprofiler/abstracttimelinemodel.h
+++ b/plugins/qmlprofiler/abstracttimelinemodel.h
@@ -75,6 +75,7 @@ public:
virtual int findLastIndex(qint64 endTime) const = 0;
virtual int getEventType(int index) const = 0;
+ virtual int getEventCategory(int index) const = 0;
virtual int getEventRow(int index) const = 0;
Q_INVOKABLE virtual qint64 getDuration(int index) const = 0;
Q_INVOKABLE virtual qint64 getStartTime(int index) const = 0;
diff --git a/plugins/qmlprofiler/qml/Overview.js b/plugins/qmlprofiler/qml/Overview.js
index a334359189..4ef2187b43 100644
--- a/plugins/qmlprofiler/qml/Overview.js
+++ b/plugins/qmlprofiler/qml/Overview.js
@@ -44,75 +44,66 @@ function drawData(canvas, ctxt, region)
if ((!qmlProfilerModelProxy) || qmlProfilerModelProxy.count() == 0)
return;
- var typeCount = 5;
var width = canvas.width;
var bump = 10;
var height = canvas.height - bump;
+
+ var typeCount = qmlProfilerModelProxy.visibleCategories();
var blockHeight = height / typeCount;
var spacing = width / qmlProfilerModelProxy.traceDuration();
- var highest = [0,0,0,0,0]; // note: change if typeCount changes
-
- for (var ii = 0; ii < qmlProfilerModelProxy.count(); ++ii) {
-
- var xx = (qmlProfilerModelProxy.getStartTime(ii) -
- qmlProfilerModelProxy.traceStartTime()) * spacing;
- if (xx > region.x + region.width)
- continue;
-
- var eventWidth = qmlProfilerModelProxy.getDuration(ii) * spacing;
- if (xx + eventWidth < region.x)
- continue;
-
- if (eventWidth < 1)
- eventWidth = 1;
-
- xx = Math.round(xx);
- var ty = qmlProfilerModelProxy.getType(ii);
-
- if (xx + eventWidth > highest[ty]) {
- /*
- // special: animations
- if (ty === 0 && qmlProfilerModelProxy.getAnimationCount(ii) >= 0) {
- var vertScale = qmlProfilerModelProxy.getMaximumAnimationCount() -
- qmlProfilerModelProxy.getMinimumAnimationCount();
- if (vertScale < 1)
- vertScale = 1;
- var fraction = (qmlProfilerModelProxy.getAnimationCount(ii) -
- qmlProfilerModelProxy.getMinimumAnimationCount()) / vertScale;
- var eventHeight = blockHeight * (fraction * 0.85 + 0.15);
- var yy = bump + ty*blockHeight + blockHeight - eventHeight;
-
- var fpsFraction = qmlProfilerModelProxy.getFramerate(ii) / 60.0;
- if (fpsFraction > 1.0)
- fpsFraction = 1.0;
- ctxt.fillStyle = "hsl("+(fpsFraction*0.27+0.028)+",0.3,0.65)";
- ctxt.fillRect(xx, yy, eventWidth, eventHeight);
- } else { */
- var hue = ( qmlProfilerModelProxy.getEventId(ii) * 25 ) % 360;
- ctxt.fillStyle = "hsl("+(hue/360.0+0.001)+",0.3,0.65)";
- ctxt.fillRect(xx, bump + ty*blockHeight, eventWidth, blockHeight);
- /*}*/
- highest[ty] = xx+eventWidth;
+ var modelRowStart = 0;
+ for (var modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); modelIndex++) {
+ for (var ii = 0; ii < qmlProfilerModelProxy.count(modelIndex); ++ii) {
+
+ var xx = (qmlProfilerModelProxy.getStartTime(modelIndex,ii) -
+ qmlProfilerModelProxy.traceStartTime()) * spacing;
+ if (xx > region.x + region.width)
+ continue;
+
+ var eventWidth = qmlProfilerModelProxy.getDuration(modelIndex,ii) * spacing;
+ if (xx + eventWidth < region.x)
+ continue;
+
+ if (eventWidth < 1)
+ eventWidth = 1;
+
+ xx = Math.round(xx);
+
+ var rowNumber = modelRowStart + qmlProfilerModelProxy.getEventCategoryInModel(modelIndex, ii);
+
+ var itemHeight = qmlProfilerModelProxy.getHeight(modelIndex,ii) * blockHeight;
+ var yy = (rowNumber + 1) * blockHeight - itemHeight ;
+
+ var itemColor = qmlProfilerModelProxy.getColorRGB(modelIndex, ii);
+ ctxt.fillStyle = "rgb("+itemColor[0]+","+itemColor[1]+","+itemColor[2]+")";
+ ctxt.fillRect(xx, bump + yy, eventWidth, itemHeight);
}
+ modelRowStart += qmlProfilerModelProxy.categoryCount(modelIndex);
}
// binding loops
ctxt.strokeStyle = "orange";
ctxt.lineWidth = 2;
var radius = 1;
- for (var ii = 0; ii < qmlProfilerModelProxy.count(); ++ii) {
- if (qmlProfilerModelProxy.getBindingLoopDest(ii) >= 0) {
- var xcenter = Math.round(qmlProfilerModelProxy.getStartTime(ii) +
- qmlProfilerModelProxy.getDuration(ii) -
- qmlProfilerModelProxy.traceStartTime()) * spacing;
- var ycenter = Math.round(bump + qmlProfilerModelProxy.getType(ii) *
- blockHeight + blockHeight/2);
- ctxt.arc(xcenter, ycenter, radius, 0, 2*Math.PI, true);
- ctxt.stroke();
+ modelRowStart = 0;
+ for (modelIndex = 0; modelIndex < qmlProfilerModelProxy.modelCount(); modelIndex++) {
+ for (ii = 0; ii < qmlProfilerModelProxy.count(modelIndex); ++ii) {
+ if (qmlProfilerModelProxy.getBindingLoopDest(modelIndex,ii) >= 0) {
+ var xcenter = Math.round(qmlProfilerModelProxy.getStartTime(modelIndex,ii) +
+ qmlProfilerModelProxy.getDuration(modelIndex,ii) -
+ qmlProfilerModelProxy.traceStartTime()) * spacing;
+ var ycenter = Math.round(bump + (modelRowStart +
+ qmlProfilerModelProxy.getEventCategoryInModel(modelIndex, ii)) *
+ blockHeight + blockHeight/2);
+ ctxt.arc(xcenter, ycenter, radius, 0, 2*Math.PI, true);
+ ctxt.stroke();
+ }
}
+ modelRowStart += qmlProfilerModelProxy.categoryCount(modelIndex);
}
+
}
function drawTimeBar(canvas, ctxt, region)
diff --git a/plugins/qmlprofiler/qmlprofiler.pro b/plugins/qmlprofiler/qmlprofiler.pro
index 6fe4fb18ba..322326b995 100644
--- a/plugins/qmlprofiler/qmlprofiler.pro
+++ b/plugins/qmlprofiler/qmlprofiler.pro
@@ -26,7 +26,6 @@ SOURCES += \
qmlprofilerprocessedmodel.cpp \
qmlprofilereventsmodelproxy.cpp \
qmlprofilertimelinemodelproxy.cpp \
- qmlprofileroverviewmodelproxy.cpp \
qmlprofilertreeview.cpp \
qmlprofilertracefile.cpp \
abstracttimelinemodel.cpp \
@@ -57,7 +56,6 @@ HEADERS += \
qmlprofilerprocessedmodel.h \
qmlprofilereventsmodelproxy.h \
qmlprofilertimelinemodelproxy.h \
- qmlprofileroverviewmodelproxy.h \
qmlprofilertreeview.h \
qmlprofilertracefile.h \
abstracttimelinemodel.h \
diff --git a/plugins/qmlprofiler/qmlprofiler.qbs b/plugins/qmlprofiler/qmlprofiler.qbs
index a3e7428fe3..8fca811be9 100644
--- a/plugins/qmlprofiler/qmlprofiler.qbs
+++ b/plugins/qmlprofiler/qmlprofiler.qbs
@@ -44,8 +44,6 @@ QtcPlugin {
"qmlprofilereventview.h",
"qmlprofilermodelmanager.cpp",
"qmlprofilermodelmanager.h",
- "qmlprofileroverviewmodelproxy.cpp",
- "qmlprofileroverviewmodelproxy.h",
"qmlprofilerplugin.cpp",
"qmlprofilerplugin.h",
"qmlprofilerprocessedmodel.cpp",
diff --git a/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.cpp b/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.cpp
deleted file mode 100644
index d5e925e734..0000000000
--- a/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-#include "qmlprofileroverviewmodelproxy.h"
-#include "qmlprofilermodelmanager.h"
-#include "qmlprofilersimplemodel.h"
-
-#include <qmldebug/qmlprofilereventtypes.h>
-
-#include <QVector>
-#include <QHash>
-#include <QUrl>
-#include <QStack>
-#include <QString>
-
-#include <QDebug>
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerOverviewModelProxy::QmlProfilerOverviewModelProxyPrivate
-{
-public:
- QmlProfilerOverviewModelProxyPrivate(QmlProfilerOverviewModelProxy *qq) : q(qq) {}
- ~QmlProfilerOverviewModelProxyPrivate() {}
-
- QVector <QmlProfilerOverviewModelProxy::QmlOverviewEvent> data;
- int rowCount;
-
- QmlProfilerModelManager *modelManager;
- QmlProfilerOverviewModelProxy *q;
-};
-
-QmlProfilerOverviewModelProxy::QmlProfilerOverviewModelProxy(QmlProfilerModelManager *modelManager, QObject *parent)
- : QObject(parent), d(new QmlProfilerOverviewModelProxyPrivate(this))
-{
- d->modelManager = modelManager;
- connect(modelManager->simpleModel(),SIGNAL(changed()),this,SLOT(dataChanged()));
- connect(modelManager,SIGNAL(countChanged()),this,SIGNAL(countChanged()));
-}
-
-QmlProfilerOverviewModelProxy::~QmlProfilerOverviewModelProxy()
-{
- delete d;
-}
-
-const QVector<QmlProfilerOverviewModelProxy::QmlOverviewEvent> QmlProfilerOverviewModelProxy::getData() const
-{
- return d->data;
-}
-void QmlProfilerOverviewModelProxy::clear()
-{
- d->data.clear();
- d->rowCount = 0;
-}
-
-void QmlProfilerOverviewModelProxy::dataChanged()
-{
- loadData();
-
- emit dataAvailable();
- emit emptyChanged();
-}
-
-void QmlProfilerOverviewModelProxy::detectBindingLoops()
-{
- QStack<int> callStack;
-
- static QVector<int> acceptedTypes =
- QVector<int>() << QmlDebug::Compiling << QmlDebug::Creating
- << QmlDebug::Binding << QmlDebug::HandlingSignal;
-
-
- for (int i = 0; i < d->data.size(); ++i) {
- QmlOverviewEvent *event = &d->data[i];
-
- if (!acceptedTypes.contains(event->eventType))
- continue;
-
- QmlOverviewEvent *potentialParent = callStack.isEmpty() ? 0 : &d->data[callStack.top()];
-
- while (potentialParent
- && !(potentialParent->startTime + potentialParent->duration > event->startTime)) {
- callStack.pop();
- potentialParent = callStack.isEmpty() ? 0 : &d->data[callStack.top()];
- }
-
- // check whether event is already in stack
- for (int ii = 0; ii < callStack.size(); ++ii) {
- if (d->data[callStack.at(ii)].eventId == event->eventId) {
- event->bindingLoopHead = callStack.at(ii);
- break;
- }
- }
-
- callStack.push(i);
- }
-}
-
-bool compareEvents(const QmlProfilerOverviewModelProxy::QmlOverviewEvent &t1, const QmlProfilerOverviewModelProxy::QmlOverviewEvent &t2)
-{
- return t1.startTime < t2.startTime;
-}
-
-
-void QmlProfilerOverviewModelProxy::loadData()
-{
- clear();
- QmlProfilerSimpleModel *simpleModel = d->modelManager->simpleModel();
- if (simpleModel->isEmpty())
- return;
-
- QHash <QString, int> eventIdDict;
-
- const QVector<QmlProfilerSimpleModel::QmlEventData> eventList = simpleModel->getEvents();
- foreach (const QmlProfilerSimpleModel::QmlEventData &event, eventList) {
-
- // find event id
- QString eventHash = QmlProfilerSimpleModel::getHashString(event);
- int eventId;
- if (eventIdDict.contains(eventHash)) {
- eventId = eventIdDict[eventHash];
- } else {
- eventId = eventIdDict.count();
- eventIdDict.insert(eventHash, eventId);
- }
-
- QmlOverviewEvent newEvent = {
- event.eventType,
- event.startTime,
- event.duration,
- 1.0, // height
- eventId, // eventId
- event.eventType, // eventType
- -1 // bindingLoopHead
- };
- d->data.append(newEvent);
-
- if (event.eventType > d->rowCount)
- d->rowCount = event.eventType;
- }
-
- qSort(d->data.begin(), d->data.end(), compareEvents);
-
- detectBindingLoops();
-}
-
-/////////////////// QML interface
-
-bool QmlProfilerOverviewModelProxy::isEmpty() const
-{
- return count() == 0;
-}
-
-int QmlProfilerOverviewModelProxy::count() const
-{
- return d->data.count();
-}
-
-qint64 QmlProfilerOverviewModelProxy::traceStartTime() const
-{
- return d->modelManager->traceTime()->startTime();
-}
-
-qint64 QmlProfilerOverviewModelProxy::traceDuration() const
-{
- return d->modelManager->traceTime()->duration();
-}
-
-qint64 QmlProfilerOverviewModelProxy::traceEndTime() const
-{
- return d->modelManager->traceTime()->endTime();
-}
-
-qint64 QmlProfilerOverviewModelProxy::getStartTime(int index) const
-{
- return d->data[index].startTime;
-}
-
-qint64 QmlProfilerOverviewModelProxy::getDuration(int index) const
-{
- return d->data[index].duration;
-}
-
-int QmlProfilerOverviewModelProxy::getType(int index) const
-{
- return d->data[index].row;
-}
-
-int QmlProfilerOverviewModelProxy::getEventId(int index) const
-{
- return d->data[index].eventId;
-}
-
-int QmlProfilerOverviewModelProxy::getBindingLoopDest(int index) const
-{
- return d->data[index].bindingLoopHead;
-}
-
-}
-}
diff --git a/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.h b/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.h
deleted file mode 100644
index fe921deafb..0000000000
--- a/plugins/qmlprofiler/qmlprofileroverviewmodelproxy.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-****************************************************************************/
-
-
-#ifndef QMLPROFILEROVERVIEWMODELPROXY_H
-#define QMLPROFILEROVERVIEWMODELPROXY_H
-
-#include <QObject>
-
-
-namespace QmlProfiler {
-namespace Internal {
-
-class QmlProfilerModelManager;
-
-class QmlProfilerOverviewModelProxy : public QObject
-{
- Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
-
- Q_OBJECT
-public:
- struct QmlOverviewEvent {
- int row;
- qint64 startTime;
- qint64 duration;
- double height;
- int eventId;
- int eventType;
- int bindingLoopHead;
- };
-
- QmlProfilerOverviewModelProxy(QmlProfilerModelManager *modelManager, QObject *parent = 0);
- ~QmlProfilerOverviewModelProxy();
-
- const QVector<QmlOverviewEvent> getData() const;
-
- void loadData();
- Q_INVOKABLE int count() const;
- Q_INVOKABLE qint64 traceStartTime() const;
- Q_INVOKABLE qint64 traceDuration() const;
- Q_INVOKABLE qint64 traceEndTime() const;
- Q_INVOKABLE qint64 getStartTime(int index) const;
- Q_INVOKABLE qint64 getDuration(int index) const;
- Q_INVOKABLE int getType(int index) const;
- Q_INVOKABLE int getEventId(int index) const;
- Q_INVOKABLE int getBindingLoopDest(int i) const;
-
- void clear();
-
- int rowCount() const;
-
-
-// QML interface
- bool isEmpty() const;
-
-
-signals:
- void countChanged();
- void dataAvailable();
-// void stateChanged();
- void emptyChanged();
-// void expandedChanged();
-
-private slots:
- void dataChanged();
-
-private:
- void detectBindingLoops();
-
-private:
- class QmlProfilerOverviewModelProxyPrivate;
- QmlProfilerOverviewModelProxyPrivate *d;
-
-};
-
-}
-}
-
-#endif
diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
index f6c7d3bc3f..28bfa1eb57 100644
--- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
+++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
@@ -283,6 +283,13 @@ int PaintEventsModelProxy::getEventType(int index) const
return (int)QmlDebug::Painting;
}
+int PaintEventsModelProxy::getEventCategory(int index) const
+{
+ Q_UNUSED(index);
+ // there is only one category, all events belong to it
+ return 0;
+}
+
int PaintEventsModelProxy::getEventRow(int index) const
{
Q_UNUSED(index);
diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
index 03b7343318..ed2ddec099 100644
--- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
+++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h
@@ -90,6 +90,7 @@ public:
int findLastIndex(qint64 endTime) const;
int getEventType(int index) const;
+ Q_INVOKABLE int getEventCategory(int index) const;
int getEventRow(int index) const;
Q_INVOKABLE qint64 getDuration(int index) const;
Q_INVOKABLE qint64 getStartTime(int index) const;
diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
index 0b8576ec3e..1a09b9b25d 100644
--- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
+++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
@@ -541,6 +541,15 @@ int BasicTimelineModel::getEventType(int index) const
return d->eventDict[d->startTimeData[index].eventId].eventType;
}
+int BasicTimelineModel::getEventCategory(int index) const
+{
+ int evTy = getEventType(index);
+ // special: paint events shown?
+ if (d->categorySpan[0].empty && !isEmpty())
+ return evTy - 1;
+ return evTy;
+}
+
int BasicTimelineModel::getEventRow(int index) const
{
if (d->categorySpan[getEventType(index)].expanded)
diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
index 2ee1610388..e02ec99e0d 100644
--- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
+++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h
@@ -134,6 +134,7 @@ public:
int findLastIndex(qint64 endTime) const;
int getEventType(int index) const;
+ int getEventCategory(int index) const;
int getEventRow(int index) const;
Q_INVOKABLE qint64 getDuration(int index) const;
Q_INVOKABLE qint64 getStartTime(int index) const;
diff --git a/plugins/qmlprofiler/qmlprofilertraceview.cpp b/plugins/qmlprofiler/qmlprofilertraceview.cpp
index 21f96ae754..65a30009ed 100644
--- a/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -33,7 +33,6 @@
#include "qmlprofilermodelmanager.h"
#include "qmlprofilertimelinemodelproxy.h"
#include "timelinemodelaggregator.h"
-#include "qmlprofileroverviewmodelproxy.h"
// Needed for the load&save actions in the context menu
#include <analyzerbase/ianalyzertool.h>
@@ -123,9 +122,8 @@ public:
QDeclarativeView *m_timebar;
QDeclarativeView *m_overview;
QmlProfilerModelManager *m_modelManager;
-// BasicTimelineModel *m_modelProxy;
TimelineModelAggregator *m_modelProxy;
- QmlProfilerOverviewModelProxy *m_overviewProxy;
+
ZoomControl *m_zoomControl;
@@ -189,14 +187,12 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
d->m_modelManager = modelManager;
d->m_modelProxy = new TimelineModelAggregator(this);
d->m_modelProxy->setModelManager(modelManager);
-// d->m_modelProxy = new BasicTimelineModel(modelManager, this);
- d->m_overviewProxy = new QmlProfilerOverviewModelProxy(modelManager, this);
connect(d->m_modelManager, SIGNAL(stateChanged()),
this, SLOT(profilerDataModelStateChanged()));
d->m_mainView->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
d->m_modelProxy);
d->m_overview->rootContext()->setContextProperty(QLatin1String("qmlProfilerModelProxy"),
- d->m_overviewProxy);
+ d->m_modelProxy);
d->m_profilerState = profilerState;
connect(d->m_profilerState, SIGNAL(stateChanged()),
diff --git a/plugins/qmlprofiler/timelinemodelaggregator.cpp b/plugins/qmlprofiler/timelinemodelaggregator.cpp
index 238a7a0f3a..e98d669ba0 100644
--- a/plugins/qmlprofiler/timelinemodelaggregator.cpp
+++ b/plugins/qmlprofiler/timelinemodelaggregator.cpp
@@ -107,6 +107,17 @@ int TimelineModelAggregator::categories() const
return categoryCount;
}
+int TimelineModelAggregator::visibleCategories() const
+{
+ int categoryCount = 0;
+ foreach (const AbstractTimelineModel *modelProxy, d->modelList) {
+ for (int i = 0; i < modelProxy->categories(); i++)
+ if (modelProxy->categoryDepth(i) > 0)
+ categoryCount ++;
+ }
+ return categoryCount;
+}
+
QStringList TimelineModelAggregator::categoryTitles() const
{
QStringList retString;
@@ -235,6 +246,11 @@ int TimelineModelAggregator::getEventType(int modelIndex, int index) const
return d->modelList[modelIndex]->getEventType(index);
}
+int TimelineModelAggregator::getEventCategoryInModel(int modelIndex, int index) const
+{
+ return d->modelList[modelIndex]->getEventCategory(index);
+}
+
int TimelineModelAggregator::getEventRow(int modelIndex, int index) const
{
return d->modelList[modelIndex]->getEventRow(index);
@@ -270,6 +286,17 @@ QColor TimelineModelAggregator::getColor(int modelIndex, int index) const
return d->modelList[modelIndex]->getColor(index);
}
+QVariantList TimelineModelAggregator::getColorRGB(int modelIndex, int itemIndex) const
+{
+ // return color as RGB list, for use in Qml
+ QColor c = getColor(modelIndex, itemIndex);
+ QVariantList res;
+ res.append(QVariant(c.red()));
+ res.append(QVariant(c.green()));
+ res.append(QVariant(c.blue()));
+ return res;
+}
+
float TimelineModelAggregator::getHeight(int modelIndex, int index) const
{
return d->modelList[modelIndex]->getHeight(index);
diff --git a/plugins/qmlprofiler/timelinemodelaggregator.h b/plugins/qmlprofiler/timelinemodelaggregator.h
index c0fa1d92b4..9d041001dd 100644
--- a/plugins/qmlprofiler/timelinemodelaggregator.h
+++ b/plugins/qmlprofiler/timelinemodelaggregator.h
@@ -48,6 +48,7 @@ public:
Q_INVOKABLE int categories() const;
+ Q_INVOKABLE int visibleCategories() const;
Q_INVOKABLE QStringList categoryTitles() const;
QString name() const;
Q_INVOKABLE int count(int modelIndex = -1) const;
@@ -78,6 +79,7 @@ public:
int findLastIndex(int modelIndex, qint64 endTime) const;
int getEventType(int modelIndex, int index) const;
+ Q_INVOKABLE int getEventCategoryInModel(int modelIndex, int index) const;
int getEventRow(int modelIndex, int index) const;
Q_INVOKABLE qint64 getDuration(int modelIndex, int index) const;
Q_INVOKABLE qint64 getStartTime(int modelIndex, int index) const;
@@ -85,6 +87,7 @@ public:
Q_INVOKABLE int getEventId(int modelIndex, int index) const;
Q_INVOKABLE int getBindingLoopDest(int modelIndex, int index) const;
Q_INVOKABLE QColor getColor(int modelIndex, int index) const;
+ Q_INVOKABLE QVariantList getColorRGB(int modelIndex, int itemIndex) const;
Q_INVOKABLE float getHeight(int modelIndex, int index) const;
Q_INVOKABLE const QVariantList getLabelsForCategory(int modelIndex, int category) const;
diff --git a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp
index 8d7dc55a70..0633c183c7 100644
--- a/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp
+++ b/plugins/qmlprofilerextended/scenegraphtimelinemodel.cpp
@@ -200,7 +200,13 @@ int SceneGraphTimelineModel::getEventType(int index) const
// TODO fix
return QmlDebug::PixmapCacheEvent;
//return QmlDebug::SceneGraphFrameEvent;
-// return 0;
+ // return 0;
+}
+
+int SceneGraphTimelineModel::getEventCategory(int index) const
+{
+ Q_UNUSED(index);
+ return 0;
}
int SceneGraphTimelineModel::getEventRow(int index) const
diff --git a/plugins/qmlprofilerextended/scenegraphtimelinemodel.h b/plugins/qmlprofilerextended/scenegraphtimelinemodel.h
index ff6e72cf1d..d4fe1de012 100644
--- a/plugins/qmlprofilerextended/scenegraphtimelinemodel.h
+++ b/plugins/qmlprofilerextended/scenegraphtimelinemodel.h
@@ -70,6 +70,7 @@ public:
int findLastIndex(qint64 endTime) const;
int getEventType(int index) const;
+ int getEventCategory(int index) const;
int getEventRow(int index) const;
Q_INVOKABLE qint64 getDuration(int index) const;
Q_INVOKABLE qint64 getStartTime(int index) const;