2014-05-27 16:30:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2013 Digia Plc
|
|
|
|
|
** All rights reserved.
|
|
|
|
|
** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/>
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** a written agreement between you and Digia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please use
|
|
|
|
|
** contact form at http://qt.digia.com <http://qt.digia.com/>
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef MEMORYUSAGEMODEL_H
|
|
|
|
|
#define MEMORYUSAGEMODEL_H
|
|
|
|
|
|
2014-06-12 16:03:40 +02:00
|
|
|
#include "qmlprofiler/abstracttimelinemodel.h"
|
2014-05-27 16:30:48 +02:00
|
|
|
#include "qmlprofiler/qmlprofilerdatamodel.h"
|
|
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
|
|
namespace QmlProfilerExtension {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-06-12 16:03:40 +02:00
|
|
|
class MemoryUsageModel : public QmlProfiler::AbstractTimelineModel
|
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-07-08 14:53:47 +02:00
|
|
|
int row(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
|