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
|
|
|
|
2016-05-04 18:54:59 +02:00
|
|
|
#include "qmleventlocation.h"
|
2016-05-02 12:18:57 +02:00
|
|
|
#include "qmlprofilereventtypes.h"
|
|
|
|
|
#include "qmlprofilerdatamodel.h"
|
2016-04-26 12:26:46 +02:00
|
|
|
#include "qmlnote.h"
|
2016-05-02 12:18:57 +02:00
|
|
|
|
2015-02-10 20:29:54 +01:00
|
|
|
#include <QFutureInterface>
|
2013-08-08 13:28:08 +02:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
2016-05-10 13:27:48 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QFile)
|
2013-08-08 13:28:08 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QIODevice)
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QXmlStreamReader)
|
|
|
|
|
|
|
|
|
|
namespace QmlProfiler {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class QmlProfilerFileReader : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit QmlProfilerFileReader(QObject *parent = 0);
|
|
|
|
|
|
2015-02-17 14:25:24 +01:00
|
|
|
void setFuture(QFutureInterface<void> *future);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2016-05-10 13:27:48 +02:00
|
|
|
bool loadQtd(QIODevice *device);
|
|
|
|
|
bool loadQzt(QIODevice *device);
|
|
|
|
|
|
2015-06-30 15:55:33 +02:00
|
|
|
quint64 loadedFeatures() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2016-02-08 16:51:48 +01:00
|
|
|
qint64 traceStart() const { return m_traceStart; }
|
|
|
|
|
qint64 traceEnd() const { return m_traceEnd; }
|
|
|
|
|
|
2013-08-08 13:28:08 +02:00
|
|
|
signals:
|
2016-05-10 13:27:48 +02:00
|
|
|
void typesLoaded(const QVector<QmlProfiler::QmlEventType> &types);
|
|
|
|
|
void notesLoaded(const QVector<QmlProfiler::QmlNote> ¬es);
|
2016-11-08 17:26:39 +01:00
|
|
|
void qmlEventsLoaded(const QVector<QmlProfiler::QmlEvent> &event);
|
2013-08-08 13:28:08 +02:00
|
|
|
void error(const QString &error);
|
2016-02-08 16:51:48 +01:00
|
|
|
void success();
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-04-26 11:50:59 +02:00
|
|
|
void loadEventTypes(QXmlStreamReader &reader);
|
|
|
|
|
void loadEvents(QXmlStreamReader &reader);
|
|
|
|
|
void loadNotes(QXmlStreamReader &reader);
|
2016-05-10 13:27:48 +02:00
|
|
|
void updateProgress(QIODevice *device);
|
2015-02-17 14:25:24 +01:00
|
|
|
bool isCanceled() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2016-02-08 16:51:48 +01:00
|
|
|
qint64 m_traceStart, m_traceEnd;
|
2015-02-17 14:25:24 +01:00
|
|
|
QFutureInterface<void> *m_future;
|
2016-04-26 11:50:59 +02:00
|
|
|
QVector<QmlEventType> m_eventTypes;
|
|
|
|
|
QVector<QmlNote> m_notes;
|
2015-06-30 15:55:33 +02:00
|
|
|
quint64 m_loadedFeatures;
|
2013-08-08 13:28:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QmlProfilerFileWriter : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit QmlProfilerFileWriter(QObject *parent = 0);
|
|
|
|
|
|
|
|
|
|
void setTraceTime(qint64 startTime, qint64 endTime, qint64 measturedTime);
|
2016-04-29 14:43:32 +02:00
|
|
|
void setData(const QmlProfilerDataModel *model);
|
2016-04-26 11:50:59 +02:00
|
|
|
void setNotes(const QVector<QmlNote> ¬es);
|
2015-02-10 20:29:54 +01:00
|
|
|
void setFuture(QFutureInterface<void> *future);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2016-05-10 13:27:48 +02:00
|
|
|
void saveQtd(QIODevice *device);
|
|
|
|
|
void saveQzt(QFile *file);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
private:
|
2014-06-13 16:34:30 +02:00
|
|
|
void calculateMeasuredTime();
|
2015-02-10 20:29:54 +01:00
|
|
|
void incrementProgress();
|
|
|
|
|
bool isCanceled() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
qint64 m_startTime, m_endTime, m_measuredTime;
|
2015-02-10 20:29:54 +01:00
|
|
|
QFutureInterface<void> *m_future;
|
2016-04-29 14:43:32 +02:00
|
|
|
const QmlProfilerDataModel *m_model;
|
2016-04-26 11:50:59 +02:00
|
|
|
QVector<QmlNote> m_notes;
|
2015-02-10 20:29:54 +01:00
|
|
|
int m_newProgressValue;
|
2013-08-08 13:28:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfiler
|