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
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLPROFILERTRACEFILE_H
|
|
|
|
|
#define QMLPROFILERTRACEFILE_H
|
|
|
|
|
|
2015-02-10 20:29:54 +01:00
|
|
|
#include <QFutureInterface>
|
2013-08-08 13:28:08 +02:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
|
|
#include <qmldebug/qmlprofilereventlocation.h>
|
|
|
|
|
#include <qmldebug/qmlprofilereventtypes.h>
|
|
|
|
|
|
2014-02-18 17:32:20 +01:00
|
|
|
#include "qmlprofilerdatamodel.h"
|
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);
|
|
|
|
|
|
2014-08-12 13:39:22 +02:00
|
|
|
void setQmlDataModel(QmlProfilerDataModel *dataModel);
|
2015-02-17 14:25:24 +01:00
|
|
|
void setFuture(QFutureInterface<void> *future);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
bool load(QIODevice *device);
|
2015-06-30 15:55:33 +02:00
|
|
|
quint64 loadedFeatures() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void error(const QString &error);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void loadEventData(QXmlStreamReader &reader);
|
|
|
|
|
void loadProfilerDataModel(QXmlStreamReader &reader);
|
2014-09-24 18:23:01 +02:00
|
|
|
void loadNoteData(QXmlStreamReader &reader);
|
2015-02-17 14:25:24 +01:00
|
|
|
void progress(QIODevice *device);
|
|
|
|
|
bool isCanceled() const;
|
2013-08-08 13:28:08 +02:00
|
|
|
|
2014-08-12 13:39:22 +02:00
|
|
|
QmlProfilerDataModel *m_qmlModel;
|
2015-02-17 14:25:24 +01:00
|
|
|
QFutureInterface<void> *m_future;
|
2014-06-13 16:34:30 +02:00
|
|
|
QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents;
|
|
|
|
|
QVector<QmlProfilerDataModel::QmlEventData> m_ranges;
|
2014-09-24 18:23:01 +02:00
|
|
|
QVector<QmlProfilerDataModel::QmlEventNoteData> 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);
|
2014-06-13 16:34:30 +02:00
|
|
|
void setQmlEvents(const QVector<QmlProfilerDataModel::QmlEventTypeData> &types,
|
|
|
|
|
const QVector<QmlProfilerDataModel::QmlEventData> &events);
|
2014-09-24 18:23:01 +02:00
|
|
|
void setNotes(const QVector<QmlProfilerDataModel::QmlEventNoteData> ¬es);
|
2015-02-10 20:29:54 +01:00
|
|
|
void setFuture(QFutureInterface<void> *future);
|
2013-08-08 13:28:08 +02:00
|
|
|
|
|
|
|
|
void save(QIODevice *device);
|
|
|
|
|
|
|
|
|
|
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;
|
2014-06-13 16:34:30 +02:00
|
|
|
QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents;
|
|
|
|
|
QVector<QmlProfilerDataModel::QmlEventData> m_ranges;
|
2014-09-24 18:23:01 +02:00
|
|
|
QVector<QmlProfilerDataModel::QmlEventNoteData> 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
|
|
|
|
|
|
|
|
|
|
#endif // QMLPROFILERTRACEFILE_H
|