blob: da17550393ba83395b7a68539e25e1460b1c2c97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#ifndef PROFILETABLEMODEL_H
#define PROFILETABLEMODEL_H
#include <QAbstractTableModel>
#include "trace_profiler.hpp"
struct ProfileTableRow
{
ProfileTableRow(unsigned no)
: program(no),
uses(0),
gpuTime(0),
cpuTime(0),
pixels(0),
longestGpu(0),
longestCpu(0),
longestPixel(0)
{
}
unsigned program;
qulonglong uses;
qulonglong gpuTime;
qulonglong cpuTime;
qulonglong pixels;
const trace::Profile::Call* longestGpu;
const trace::Profile::Call* longestCpu;
const trace::Profile::Call* longestPixel;
};
class ProfileTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
ProfileTableModel(QObject *parent = NULL);
void setProfile(trace::Profile* profile);
void selectNone();
void selectProgram(unsigned program);
void selectTime(int64_t start, int64_t end);
int getRowIndex(unsigned program) const;
unsigned getProgram(const QModelIndex & index) const;
const trace::Profile::Call* getJumpCall(const QModelIndex & index) const;
virtual int rowCount(const QModelIndex & parent) const;
virtual int columnCount(const QModelIndex & parent) const;
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
private:
void updateModel();
ProfileTableRow* getRow(unsigned program);
private:
QList<ProfileTableRow> m_rowData;
trace::Profile *m_profile;
int64_t m_timeMin;
int64_t m_timeMax;
int m_sortColumn;
Qt::SortOrder m_sortOrder;
};
#endif // PROFILEMODEL_H
|