2013-08-08 13:28:08 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2013-08-08 13:28:08 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
#include "qmlprofiler_global.h"
|
2016-05-02 12:18:57 +02:00
|
|
|
#include "qmlprofilereventtypes.h"
|
2016-05-04 18:54:59 +02:00
|
|
|
#include "qmleventlocation.h"
|
2016-04-28 16:19:17 +02:00
|
|
|
#include "qmlevent.h"
|
|
|
|
|
#include "qmleventtype.h"
|
2016-12-19 18:47:06 +01:00
|
|
|
#include "qmlprofilertextmark.h"
|
2013-09-02 14:04:12 +02:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
#include <utils/fileinprojectfinder.h>
|
2018-05-03 09:50:11 +02:00
|
|
|
#include <tracing/timelinetracemanager.h>
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2013-09-02 14:04:12 +02:00
|
|
|
#include <QObject>
|
2016-04-28 16:19:17 +02:00
|
|
|
#include <functional>
|
2013-09-02 14:04:12 +02:00
|
|
|
|
2017-09-27 14:56:00 +02:00
|
|
|
namespace ProjectExplorer { class Target; }
|
2017-05-29 16:04:31 +02:00
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
namespace QmlProfiler {
|
|
|
|
|
class QmlProfilerModelManager;
|
2014-10-27 17:41:22 +01:00
|
|
|
class QmlProfilerNotesModel;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
// Interface between the Data Model and the Engine/Tool
|
2018-04-05 09:47:33 +02:00
|
|
|
class QMLPROFILER_EXPORT QmlProfilerModelManager : public Timeline::TimelineTraceManager
|
2013-08-08 13:28:08 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-04-05 09:47:33 +02:00
|
|
|
typedef std::function<void(const QmlEvent &, const QmlEventType &)> QmlEventLoader;
|
2018-05-07 17:08:12 +02:00
|
|
|
typedef std::function<QmlEventLoader(QmlEventLoader)> QmlEventFilter;
|
2016-04-28 16:19:17 +02:00
|
|
|
|
2018-04-12 10:04:55 +02:00
|
|
|
explicit QmlProfilerModelManager(QObject *parent = nullptr);
|
2018-04-05 09:34:29 +02:00
|
|
|
~QmlProfilerModelManager() override;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2018-03-28 08:57:46 +02:00
|
|
|
Internal::QmlProfilerTextMarkModel *textMarkModel() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2018-04-05 09:47:33 +02:00
|
|
|
void registerFeatures(quint64 features, QmlEventLoader eventLoader,
|
|
|
|
|
Initializer initializer = nullptr, Finalizer finalizer = nullptr,
|
|
|
|
|
Clearer clearer = nullptr);
|
2016-05-11 14:43:26 +02:00
|
|
|
|
2016-12-28 16:39:57 +01:00
|
|
|
void addEvents(const QVector<QmlEvent> &events);
|
|
|
|
|
void addEventTypes(const QVector<QmlEventType> &types);
|
2018-03-28 09:42:28 +02:00
|
|
|
const QmlEventType &eventType(int typeId) const;
|
2016-12-29 14:26:29 +01:00
|
|
|
|
2018-05-07 17:08:12 +02:00
|
|
|
void replayQmlEvents(QmlEventLoader loader, Initializer initializer, Finalizer finalizer,
|
2018-04-19 13:10:49 +02:00
|
|
|
ErrorHandler errorHandler, QFutureInterface<void> &future) const;
|
2015-06-30 15:55:33 +02:00
|
|
|
|
2018-04-05 09:47:33 +02:00
|
|
|
void finalize() override;
|
2015-09-10 17:11:21 +02:00
|
|
|
|
2017-09-27 14:56:00 +02:00
|
|
|
void populateFileFinder(const ProjectExplorer::Target *target = nullptr);
|
2016-12-29 14:26:29 +01:00
|
|
|
QString findLocalFile(const QString &remoteFile);
|
|
|
|
|
|
2016-05-02 12:18:57 +02:00
|
|
|
static const char *featureName(ProfileFeature feature);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2018-04-05 09:47:33 +02:00
|
|
|
void addEventType(const QmlEventType &type);
|
|
|
|
|
void addEvent(const QmlEvent &event);
|
2017-09-07 14:07:10 +02:00
|
|
|
|
2018-05-07 15:56:13 +02:00
|
|
|
void restrictToRange(qint64 start, qint64 end);
|
|
|
|
|
bool isRestrictedToRange() const;
|
|
|
|
|
|
2018-05-07 17:08:12 +02:00
|
|
|
QmlEventFilter rangeFilter(qint64 start, qint64 end) const;
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
signals:
|
2018-03-27 15:58:43 +02:00
|
|
|
void typeDetailsChanged(int typeId);
|
|
|
|
|
void typeDetailsFinished();
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
private:
|
2016-12-29 15:02:06 +01:00
|
|
|
void detailsChanged(int typeId, const QString &newString);
|
2018-05-07 17:08:12 +02:00
|
|
|
void restrictByFilter(QmlEventFilter filter);
|
2018-04-05 09:47:33 +02:00
|
|
|
|
|
|
|
|
void clearEventStorage() override;
|
|
|
|
|
void clearTypeStorage() override;
|
|
|
|
|
|
|
|
|
|
const Timeline::TraceEventType &lookupType(int typeId) const override;
|
|
|
|
|
Timeline::TimelineTraceFile *createTraceFile() override;
|
2018-05-07 17:08:12 +02:00
|
|
|
void replayEvents(TraceEventLoader loader, Initializer initializer, Finalizer finalizer,
|
2018-04-05 09:47:33 +02:00
|
|
|
ErrorHandler errorHandler, QFutureInterface<void> &future) const override;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
class QmlProfilerModelManagerPrivate;
|
|
|
|
|
QmlProfilerModelManagerPrivate *d;
|
|
|
|
|
};
|
|
|
|
|
|
2016-04-28 16:02:54 +02:00
|
|
|
} // namespace QmlProfiler
|