2013-08-08 13:28:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2013-08-08 13:28:08 +02:00
|
|
|
** 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 "qmlprofilertimelinemodelproxy.h"
|
|
|
|
|
#include "qmlprofilermodelmanager.h"
|
2014-02-18 17:32:20 +01:00
|
|
|
#include "qmlprofilerdatamodel.h"
|
2013-12-04 16:05:02 +01:00
|
|
|
#include "sortedtimelinemodel.h"
|
2014-06-12 16:01:04 +02:00
|
|
|
#include "abstracttimelinemodel_p.h"
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QUrl>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QStack>
|
|
|
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
class RangeTimelineModel::RangeTimelineModelPrivate :
|
|
|
|
|
public SortedTimelineModel<RangeTimelineModel::QmlRangeEventStartInstance,
|
2014-06-12 16:01:04 +02:00
|
|
|
AbstractTimelineModel::AbstractTimelineModelPrivate>
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// convenience functions
|
|
|
|
|
void computeNestingContracted();
|
|
|
|
|
void computeExpandedLevels();
|
|
|
|
|
void findBindingLoops();
|
|
|
|
|
|
2014-06-13 16:34:30 +02:00
|
|
|
QVector<int> expandedRowTypes;
|
2014-06-06 17:36:11 +02:00
|
|
|
int contractedRows;
|
2014-01-10 16:43:43 +01:00
|
|
|
bool seenPaintEvent;
|
2014-02-14 16:20:13 +01:00
|
|
|
private:
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_DECLARE_PUBLIC(RangeTimelineModel)
|
2013-08-08 13:28:08 +02:00
|
|
|
};
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
RangeTimelineModel::RangeTimelineModel(QmlDebug::RangeType rangeType, QObject *parent)
|
2014-06-12 16:01:04 +02:00
|
|
|
: AbstractTimelineModel(new RangeTimelineModelPrivate,
|
2014-06-06 17:36:11 +02:00
|
|
|
QLatin1String("RangeTimelineModel"), categoryLabel(rangeType),
|
|
|
|
|
QmlDebug::MaximumMessage, rangeType, parent)
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(RangeTimelineModel);
|
2014-02-25 18:12:11 +01:00
|
|
|
d->seenPaintEvent = false;
|
2014-06-13 16:34:30 +02:00
|
|
|
d->expandedRowTypes.clear();
|
|
|
|
|
d->expandedRowTypes << -1;
|
2014-06-06 17:36:11 +02:00
|
|
|
d->contractedRows = 1;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
void RangeTimelineModel::clear()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(RangeTimelineModel);
|
2014-04-09 16:25:10 +02:00
|
|
|
d->clear();
|
2014-06-13 16:34:30 +02:00
|
|
|
d->expandedRowTypes.clear();
|
|
|
|
|
d->expandedRowTypes << -1;
|
2014-06-06 17:36:11 +02:00
|
|
|
d->contractedRows = 1;
|
2014-01-10 16:43:43 +01:00
|
|
|
d->seenPaintEvent = false;
|
2014-06-06 17:36:11 +02:00
|
|
|
d->expanded = false;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
void RangeTimelineModel::loadData()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
clear();
|
2014-02-18 17:32:20 +01:00
|
|
|
QmlProfilerDataModel *simpleModel = d->modelManager->qmlModel();
|
2013-08-08 13:28:08 +02:00
|
|
|
if (simpleModel->isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// collect events
|
2014-06-13 16:34:30 +02:00
|
|
|
const QVector<QmlProfilerDataModel::QmlEventData> &eventList = simpleModel->getEvents();
|
|
|
|
|
const QVector<QmlProfilerDataModel::QmlEventTypeData> &typesList = simpleModel->getEventTypes();
|
2014-02-18 17:32:20 +01:00
|
|
|
foreach (const QmlProfilerDataModel::QmlEventData &event, eventList) {
|
2014-06-13 16:34:30 +02:00
|
|
|
const QmlProfilerDataModel::QmlEventTypeData &type = typesList[event.typeIndex];
|
|
|
|
|
if (!eventAccepted(type))
|
2013-08-08 13:28:08 +02:00
|
|
|
continue;
|
2014-06-13 16:34:30 +02:00
|
|
|
if (type.rangeType == QmlDebug::Painting)
|
2014-01-10 16:43:43 +01:00
|
|
|
d->seenPaintEvent = true;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
// store starttime-based instance
|
2014-06-13 16:34:30 +02:00
|
|
|
d->insert(event.startTime, event.duration, QmlRangeEventStartInstance(event.typeIndex));
|
2013-12-04 16:05:02 +01:00
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, d->count(), eventList.count() * 6);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 2, 6);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2013-12-04 16:05:02 +01:00
|
|
|
// compute range nesting
|
|
|
|
|
d->computeNesting();
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
// compute nestingLevel - nonexpanded
|
|
|
|
|
d->computeNestingContracted();
|
|
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 3, 6);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
// compute nestingLevel - expanded
|
|
|
|
|
d->computeExpandedLevels();
|
|
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 4, 6);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
d->findBindingLoops();
|
|
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 5, 6);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-02-14 16:20:13 +01:00
|
|
|
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
void RangeTimelineModel::RangeTimelineModelPrivate::computeNestingContracted()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
|
int i;
|
2013-12-04 16:05:02 +01:00
|
|
|
int eventCount = count();
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-06-12 15:34:38 +02:00
|
|
|
int nestingLevels = QmlDebug::Constants::QML_MIN_LEVEL;
|
|
|
|
|
contractedRows = nestingLevels + 1;
|
|
|
|
|
QVector<qint64> nestingEndTimes;
|
|
|
|
|
nestingEndTimes.fill(0, nestingLevels + 1);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
for (i = 0; i < eventCount; i++) {
|
2013-12-04 16:05:02 +01:00
|
|
|
qint64 st = ranges[i].start;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
// per type
|
2014-06-12 15:34:38 +02:00
|
|
|
if (nestingEndTimes[nestingLevels] > st) {
|
|
|
|
|
if (++nestingLevels == nestingEndTimes.length())
|
|
|
|
|
nestingEndTimes << 0;
|
|
|
|
|
if (nestingLevels == contractedRows)
|
|
|
|
|
++contractedRows;
|
2013-08-08 13:28:08 +02:00
|
|
|
} else {
|
2014-06-12 15:34:38 +02:00
|
|
|
while (nestingLevels > QmlDebug::Constants::QML_MIN_LEVEL &&
|
|
|
|
|
nestingEndTimes[nestingLevels-1] <= st)
|
|
|
|
|
nestingLevels--;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
2014-06-12 15:34:38 +02:00
|
|
|
nestingEndTimes[nestingLevels] = st + ranges[i].duration;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-06-12 15:34:38 +02:00
|
|
|
ranges[i].displayRowCollapsed = nestingLevels;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
void RangeTimelineModel::RangeTimelineModelPrivate::computeExpandedLevels()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
|
QHash<int, int> eventRow;
|
2013-12-04 16:05:02 +01:00
|
|
|
int eventCount = count();
|
2013-08-08 13:28:08 +02:00
|
|
|
for (int i = 0; i < eventCount; i++) {
|
2013-12-04 16:05:02 +01:00
|
|
|
int eventId = ranges[i].eventId;
|
2013-08-08 13:28:08 +02:00
|
|
|
if (!eventRow.contains(eventId)) {
|
2014-06-13 16:34:30 +02:00
|
|
|
eventRow[eventId] = expandedRowTypes.length();
|
|
|
|
|
expandedRowTypes << eventId;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
2013-12-04 16:05:02 +01:00
|
|
|
ranges[i].displayRowExpanded = eventRow[eventId];
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
void RangeTimelineModel::RangeTimelineModelPrivate::findBindingLoops()
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
if (rangeType != QmlDebug::Binding && rangeType != QmlDebug::HandlingSignal)
|
|
|
|
|
return;
|
|
|
|
|
|
2014-06-13 16:34:30 +02:00
|
|
|
typedef QPair<int, int> CallStackEntry;
|
2013-08-08 13:28:08 +02:00
|
|
|
QStack<CallStackEntry> callStack;
|
|
|
|
|
|
2013-12-04 16:05:02 +01:00
|
|
|
for (int i = 0; i < count(); ++i) {
|
|
|
|
|
Range *event = &ranges[i];
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2013-12-04 16:05:02 +01:00
|
|
|
const Range *potentialParent = callStack.isEmpty()
|
|
|
|
|
? 0 : &ranges[callStack.top().second];
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
while (potentialParent
|
2013-12-04 16:05:02 +01:00
|
|
|
&& !(potentialParent->start + potentialParent->duration > event->start)) {
|
2013-08-08 13:28:08 +02:00
|
|
|
callStack.pop();
|
|
|
|
|
potentialParent = callStack.isEmpty() ? 0
|
2013-12-04 16:05:02 +01:00
|
|
|
: &ranges[callStack.top().second];
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check whether event is already in stack
|
|
|
|
|
for (int ii = 0; ii < callStack.size(); ++ii) {
|
2014-06-13 16:34:30 +02:00
|
|
|
if (callStack.at(ii).first == event->eventId) {
|
2013-08-08 13:28:08 +02:00
|
|
|
event->bindingLoopHead = callStack.at(ii).second;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-06-13 16:34:30 +02:00
|
|
|
CallStackEntry newEntry(event->eventId, i);
|
2013-08-08 13:28:08 +02:00
|
|
|
callStack.push(newEntry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////// QML interface
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
int RangeTimelineModel::rowCount() const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
// special for paint events: show only when empty model or there's actual events
|
2014-06-06 17:36:11 +02:00
|
|
|
if (d->rangeType == QmlDebug::Painting && !d->seenPaintEvent)
|
2013-08-08 13:28:08 +02:00
|
|
|
return 0;
|
2014-06-06 17:36:11 +02:00
|
|
|
if (d->expanded)
|
2014-06-13 16:34:30 +02:00
|
|
|
return d->expandedRowTypes.length();
|
2013-08-08 13:28:08 +02:00
|
|
|
else
|
2014-06-06 17:36:11 +02:00
|
|
|
return d->contractedRows;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
QString RangeTimelineModel::categoryLabel(int categoryIndex)
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
|
switch (categoryIndex) {
|
|
|
|
|
case 0: return QCoreApplication::translate("MainView", "Painting"); break;
|
|
|
|
|
case 1: return QCoreApplication::translate("MainView", "Compiling"); break;
|
|
|
|
|
case 2: return QCoreApplication::translate("MainView", "Creating"); break;
|
|
|
|
|
case 3: return QCoreApplication::translate("MainView", "Binding"); break;
|
|
|
|
|
case 4: return QCoreApplication::translate("MainView", "Handling Signal"); break;
|
2014-03-06 14:49:03 +01:00
|
|
|
case 5: return QCoreApplication::translate("MainView", "JavaScript"); break;
|
2013-08-08 13:28:08 +02:00
|
|
|
default: return QString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
int RangeTimelineModel::getEventRow(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
|
|
|
|
if (d->expanded)
|
|
|
|
|
return d->range(index).displayRowExpanded;
|
2013-08-08 13:28:08 +02:00
|
|
|
else
|
2014-06-06 17:36:11 +02:00
|
|
|
return d->range(index).displayRowCollapsed;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
int RangeTimelineModel::getEventId(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-12-04 16:05:02 +01:00
|
|
|
return d->range(index).eventId;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
int RangeTimelineModel::getBindingLoopDest(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-12-04 16:05:02 +01:00
|
|
|
return d->range(index).bindingLoopHead;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
QColor RangeTimelineModel::getColor(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-02-26 17:42:04 +01:00
|
|
|
return getEventColor(index);
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
const QVariantList RangeTimelineModel::getLabels() const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
QVariantList result;
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
if (d->expanded) {
|
2014-06-13 16:34:30 +02:00
|
|
|
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
|
|
|
|
d->modelManager->qmlModel()->getEventTypes();
|
|
|
|
|
int eventCount = d->expandedRowTypes.count();
|
|
|
|
|
for (int i = 1; i < eventCount; i++) { // Ignore the -1 for the first row
|
2014-06-06 17:36:11 +02:00
|
|
|
QVariantMap element;
|
2014-06-13 16:34:30 +02:00
|
|
|
int typeId = d->expandedRowTypes[i];
|
|
|
|
|
element.insert(QLatin1String("displayName"), QVariant(types[typeId].displayName));
|
|
|
|
|
element.insert(QLatin1String("description"), QVariant(types[typeId].data));
|
|
|
|
|
element.insert(QLatin1String("id"), QVariant(typeId));
|
2014-06-06 17:36:11 +02:00
|
|
|
result << element;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
const QVariantList RangeTimelineModel::getEventDetails(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
QVariantList result;
|
|
|
|
|
int eventId = getEventId(index);
|
2014-06-13 16:34:30 +02:00
|
|
|
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
|
|
|
|
d->modelManager->qmlModel()->getEventTypes();
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
static const char trContext[] = "RangeDetails";
|
|
|
|
|
{
|
|
|
|
|
QVariantMap valuePair;
|
2014-06-06 17:36:11 +02:00
|
|
|
valuePair.insert(QLatin1String("title"), QVariant(categoryLabel(d->rangeType)));
|
2013-08-08 13:28:08 +02:00
|
|
|
result << valuePair;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// duration
|
|
|
|
|
{
|
|
|
|
|
QVariantMap valuePair;
|
2014-02-14 17:01:24 +01:00
|
|
|
valuePair.insert(QCoreApplication::translate(trContext, "Duration:"),
|
2014-02-18 17:32:20 +01:00
|
|
|
QVariant(QmlProfilerBaseModel::formatTime(d->range(index).duration)));
|
2013-08-08 13:28:08 +02:00
|
|
|
result << valuePair;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// details
|
|
|
|
|
{
|
|
|
|
|
QVariantMap valuePair;
|
2014-06-13 16:34:30 +02:00
|
|
|
QString detailsString = types[eventId].data;
|
2013-08-08 13:28:08 +02:00
|
|
|
if (detailsString.length() > 40)
|
|
|
|
|
detailsString = detailsString.left(40) + QLatin1String("...");
|
2014-06-13 16:34:30 +02:00
|
|
|
valuePair.insert(QCoreApplication::translate(trContext, "Details:"),
|
|
|
|
|
QVariant(detailsString));
|
2013-08-08 13:28:08 +02:00
|
|
|
result << valuePair;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// location
|
|
|
|
|
{
|
|
|
|
|
QVariantMap valuePair;
|
2014-06-13 16:34:30 +02:00
|
|
|
valuePair.insert(QCoreApplication::translate(trContext, "Location:"),
|
|
|
|
|
QVariant(types[eventId].displayName));
|
2013-08-08 13:28:08 +02:00
|
|
|
result << valuePair;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// isbindingloop
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
const QVariantMap RangeTimelineModel::getEventLocation(int index) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
QVariantMap result;
|
|
|
|
|
int eventId = getEventId(index);
|
|
|
|
|
|
|
|
|
|
QmlDebug::QmlEventLocation location
|
2014-06-13 16:34:30 +02:00
|
|
|
= d->modelManager->qmlModel()->getEventTypes().at(eventId).location;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
result.insert(QLatin1String("file"), location.filename);
|
|
|
|
|
result.insert(QLatin1String("line"), location.line);
|
|
|
|
|
result.insert(QLatin1String("column"), location.column);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 16:34:30 +02:00
|
|
|
int RangeTimelineModel::getEventIdForTypeIndex(int typeIndex) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2014-06-13 16:34:30 +02:00
|
|
|
if (typeIndex < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
const QmlProfilerDataModel::QmlEventTypeData &type =
|
|
|
|
|
d->modelManager->qmlModel()->getEventTypes().at(typeIndex);
|
|
|
|
|
if (type.message != d->message || type.rangeType != d->rangeType)
|
|
|
|
|
return -1;
|
|
|
|
|
return typeIndex;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
2014-06-06 17:36:11 +02:00
|
|
|
int RangeTimelineModel::getEventIdForLocation(const QString &filename, int line, int column) const
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
2014-06-06 17:36:11 +02:00
|
|
|
Q_D(const RangeTimelineModel);
|
2013-08-08 13:28:08 +02:00
|
|
|
// if this is called from v8 view, we don't have the column number, it will be -1
|
2014-06-13 16:34:30 +02:00
|
|
|
const QVector<QmlProfilerDataModel::QmlEventTypeData> &types =
|
|
|
|
|
d->modelManager->qmlModel()->getEventTypes();
|
|
|
|
|
for (int i = 0; i < d->expandedRowTypes.length(); ++i) {
|
|
|
|
|
int typeId = d->expandedRowTypes[i];
|
|
|
|
|
const QmlProfilerDataModel::QmlEventTypeData &eventData = types[typeId];
|
2013-08-08 13:28:08 +02:00
|
|
|
if (eventData.location.filename == filename &&
|
|
|
|
|
eventData.location.line == line &&
|
|
|
|
|
(column == -1 || eventData.location.column == column))
|
2014-06-13 16:34:30 +02:00
|
|
|
return typeId;
|
2013-08-08 13:28:08 +02:00
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|