2014-05-27 16:30:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-01-15 10:33:32 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd
|
2014-05-27 16:30:48 +02:00
|
|
|
** All rights reserved.
|
2015-01-15 10:33:32 +01:00
|
|
|
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
|
2014-05-27 16:30:48 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on.
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Enterprise licenses may use this file in
|
|
|
|
|
** accordance with the Qt Enterprise License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-15 10:33:32 +01:00
|
|
|
** a written agreement between you and The Qt Company.
|
2014-05-27 16:30:48 +02:00
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please use
|
2015-01-15 10:33:32 +01:00
|
|
|
** contact form at http://www.qt.io/contact-us
|
2014-05-27 16:30:48 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef MEMORYUSAGEMODEL_H
|
|
|
|
|
#define MEMORYUSAGEMODEL_H
|
|
|
|
|
|
2014-10-29 10:31:28 +01:00
|
|
|
#include "qmlprofiler/qmlprofilertimelinemodel.h"
|
2014-05-27 16:30:48 +02:00
|
|
|
#include "qmlprofiler/qmlprofilerdatamodel.h"
|
|
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
|
|
namespace QmlProfilerExtension {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-10-29 10:31:28 +01:00
|
|
|
class MemoryUsageModel : public QmlProfiler::QmlProfilerTimelineModel
|
2014-05-27 16:30:48 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
struct MemoryAllocation {
|
2014-10-28 14:30:04 +01:00
|
|
|
int typeId;
|
2014-05-27 16:30:48 +02:00
|
|
|
qint64 size;
|
2014-07-11 11:01:47 +02:00
|
|
|
qint64 allocated;
|
|
|
|
|
qint64 deallocated;
|
|
|
|
|
int allocations;
|
|
|
|
|
int deallocations;
|
2014-06-24 11:53:47 +02:00
|
|
|
int originTypeIndex;
|
2014-07-11 11:01:47 +02:00
|
|
|
|
2014-10-28 14:30:04 +01:00
|
|
|
MemoryAllocation(int typeId = -1, qint64 baseAmount = 0, int originTypeIndex = -1);
|
2014-07-11 11:01:47 +02:00
|
|
|
void update(qint64 amount);
|
2014-05-27 16:30:48 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-28 17:39:23 +01:00
|
|
|
MemoryUsageModel(QmlProfiler::QmlProfilerModelManager *manager, QObject *parent = 0);
|
2014-05-27 16:30:48 +02:00
|
|
|
|
2014-06-24 11:53:19 +02:00
|
|
|
int rowMaxValue(int rowNumber) const;
|
2014-05-27 16:30:48 +02:00
|
|
|
|
2014-11-17 13:30:53 +01:00
|
|
|
int expandedRow(int index) const;
|
|
|
|
|
int collapsedRow(int index) const;
|
2014-10-28 14:30:04 +01:00
|
|
|
int typeId(int index) const;
|
2014-07-08 14:53:47 +02:00
|
|
|
QColor color(int index) const;
|
2014-09-02 12:30:40 +02:00
|
|
|
float relativeHeight(int index) const;
|
2014-05-27 16:30:48 +02:00
|
|
|
|
2014-07-08 14:53:47 +02:00
|
|
|
QVariantMap location(int index) const;
|
2014-06-24 11:53:47 +02:00
|
|
|
|
2014-07-08 14:53:47 +02:00
|
|
|
QVariantList labels() const;
|
2014-07-07 14:41:44 +02:00
|
|
|
QVariantMap details(int index) const;
|
2014-05-27 16:30:48 +02:00
|
|
|
|
2014-09-11 11:15:48 +02:00
|
|
|
protected:
|
2014-05-27 16:30:48 +02:00
|
|
|
void loadData();
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
private:
|
2014-10-27 19:54:23 +01:00
|
|
|
static QString memoryTypeName(int type);
|
|
|
|
|
|
|
|
|
|
QVector<MemoryAllocation> m_data;
|
|
|
|
|
qint64 m_maxSize;
|
2014-05-27 16:30:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProfilerExtension
|
|
|
|
|
|
|
|
|
|
#endif // MEMORYUSAGEMODEL_H
|