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