• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.14
  • kdesdk
  • kcachegrind
  • libviews
functionlistmodel.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2010 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef FUNCTIONLISTMODEL_H
20 #define FUNCTIONLISTMODEL_H
21 
22 #include <QAbstractItemModel>
23 #include <QPixmap>
24 #include <QRegExp>
25 #include <QList>
26 
27 #include "tracedata.h"
28 #include "subcost.h"
29 
30 
31 class FunctionListModel : public QAbstractItemModel
32 {
33  Q_OBJECT
34 
35 public:
36  FunctionListModel();
37  ~FunctionListModel();
38 
39  /* Data to show: all functions from <data>
40  * - which are part of function group <group>
41  * - whose name contains <filter>
42  */
43  void resetModelData(TraceData* data, TraceCostItem* group, QString filter,
44  EventType* eventType);
45 
46  // reimplemented from QAbstractItemModel
47  QVariant data(const QModelIndex&, int) const;
48  Qt::ItemFlags flags(const QModelIndex&) const;
49  QVariant headerData(int section, Qt::Orientation orientation,
50  int role = Qt::DisplayRole) const;
51  QModelIndex index(int row, int column = 0,
52  const QModelIndex &parent = QModelIndex()) const;
53  QModelIndex parent(const QModelIndex &index) const;
54  int rowCount(const QModelIndex &parent = QModelIndex()) const;
55  int columnCount(const QModelIndex &parent = QModelIndex()) const;
56  void sort(int column, Qt::SortOrder order);
57 
58  void setFilter(QString filter);
59  void setEventType(EventType*);
60  void setMaxCount(int);
61 
62  TraceFunction* function(const QModelIndex &index);
63  // get index of an entry showing a function, optionally adding it if needed
64  QModelIndex indexForFunction(TraceFunction *f, bool add = false);
65 
66  class FunctionLessThan
67  {
68  public:
69  FunctionLessThan(int column, Qt::SortOrder order, EventType* et)
70  { _column = column; _order = order; _eventType = et; }
71 
72  bool operator()(TraceFunction *left, TraceFunction *right);
73 
74  private:
75  int _column;
76  Qt::SortOrder _order;
77  EventType* _eventType;
78  };
79 
80 private:
81  QString getName(TraceFunction *f) const;
82  QPixmap getNamePixmap(TraceFunction *f) const;
83  QString getInclCost(TraceFunction *f) const;
84  QPixmap getInclPixmap(TraceFunction *f) const;
85  QString getSelfCost(TraceFunction *f) const;
86  QPixmap getSelfPixmap(TraceFunction *f) const;
87  QString getCallCount(TraceFunction *f) const;
88  QString getLocation(TraceFunction *f) const;
89  QString getSkippedCost(TraceFunction *f, QPixmap *pixmap) const;
90 
91  // compute the list of candidates to show, ignoring order
92  void computeFilteredList();
93  // computes entries to show from candidates using current order
94  void computeTopList();
95 
96  QList<QVariant> _headerData;
97  EventType *_eventType;
98  ProfileContext::Type _groupType;
99  int _maxCount;
100 
101  QList<TraceFunction*> _list;
102  QList<TraceFunction*> _filteredList;
103  QList<TraceFunction*> _topList;
104 
105  // functions with max values at col.0/1/2 from candidate list:
106  // these are always shown to have same column widths when resorting
107  TraceFunction *_max0, *_max1, *_max2;
108 
109  int _sortColumn;
110  Qt::SortOrder _sortOrder;
111  QRegExp _filter;
112  QString _filterString;
113 };
114 
115 #endif
FunctionListModel::setFilter
void setFilter(QString filter)
Definition: functionlistmodel.cpp:186
FunctionListModel::flags
Qt::ItemFlags flags(const QModelIndex &) const
Definition: functionlistmodel.cpp:120
QModelIndex
FunctionListModel::setMaxCount
void setMaxCount(int)
Definition: functionlistmodel.cpp:204
FunctionListModel::~FunctionListModel
~FunctionListModel()
Definition: functionlistmodel.cpp:41
FunctionListModel::FunctionLessThan
Definition: functionlistmodel.h:66
FunctionListModel::index
QModelIndex index(int row, int column=0, const QModelIndex &parent=QModelIndex()) const
Definition: functionlistmodel.cpp:137
TraceFunction
A traced function.
Definition: tracedata.h:1122
TraceCostItem
Definition: tracedata.h:980
FunctionListModel::setEventType
void setEventType(EventType *)
Definition: functionlistmodel.cpp:196
EventType
A cost type, e.g.
Definition: eventtype.h:43
QRegExp
tracedata.h
FunctionListModel::sort
void sort(int column, Qt::SortOrder order)
Definition: functionlistmodel.cpp:179
subcost.h
FunctionListModel::indexForFunction
QModelIndex indexForFunction(TraceFunction *f, bool add=false)
Definition: functionlistmodel.cpp:149
FunctionListModel::FunctionLessThan::operator()
bool operator()(TraceFunction *left, TraceFunction *right)
Definition: functionlistmodel.cpp:432
FunctionListModel::FunctionListModel
FunctionListModel()
Definition: functionlistmodel.cpp:24
QString
QList< QVariant >
QPixmap
FunctionListModel::data
QVariant data(const QModelIndex &, int) const
Definition: functionlistmodel.cpp:66
FunctionListModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: functionlistmodel.cpp:44
ProfileContext::Type
Type
Definition: context.h:36
FunctionListModel::FunctionLessThan::FunctionLessThan
FunctionLessThan(int column, Qt::SortOrder order, EventType *et)
Definition: functionlistmodel.h:69
FunctionListModel::resetModelData
void resetModelData(TraceData *data, TraceCostItem *group, QString filter, EventType *eventType)
Definition: functionlistmodel.cpp:211
QAbstractItemModel
TraceData
This class holds profiling data of multiple tracefiles generated with cachegrind on one command...
Definition: tracedata.h:1363
QObject::parent
QObject * parent() const
FunctionListModel
Definition: functionlistmodel.h:31
FunctionListModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: functionlistmodel.cpp:128
FunctionListModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: functionlistmodel.cpp:49
QVariant
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal