2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
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-11-24 12:14:44 +01:00
|
|
|
using QmlEventLoader = std::function<void (const QmlEvent &, const QmlEventType &)>;
|
|
|
|
|
using QmlEventFilter = std::function<QmlEventLoader (QmlEventLoader)>;
|
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
|
|
|
|
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-05-29 18:04:07 +02:00
|
|
|
void initialize() override;
|
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);
|
2022-06-20 12:35:13 +02:00
|
|
|
Utils::FilePath findLocalFile(const QString &remoteFile);
|
2016-12-29 14:26:29 +01:00
|
|
|
|
2016-05-02 12:18:57 +02:00
|
|
|
static const char *featureName(ProfileFeature feature);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2018-05-04 17:19:08 +02:00
|
|
|
int appendEventType(QmlEventType &&type);
|
|
|
|
|
void setEventType(int typeId, QmlEventType &&type);
|
2018-05-07 13:26:05 +02:00
|
|
|
void appendEvent(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-05-28 16:21:03 +02:00
|
|
|
void traceChanged();
|
2018-03-27 15:58:43 +02:00
|
|
|
void typeDetailsChanged(int typeId);
|
|
|
|
|
void typeDetailsFinished();
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
private:
|
2018-05-30 13:32:29 +02:00
|
|
|
void setTypeDetails(int typeId, const QString &details);
|
2018-05-07 17:08:12 +02:00
|
|
|
void restrictByFilter(QmlEventFilter filter);
|
2018-04-05 09:47:33 +02:00
|
|
|
|
2018-05-28 16:21:03 +02:00
|
|
|
void clearEventStorage() final;
|
2018-05-29 18:04:07 +02:00
|
|
|
void clearTypeStorage() final;
|
2018-05-28 16:21:03 +02:00
|
|
|
|
2018-04-05 09:47:33 +02:00
|
|
|
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
|