File: partgraph.h

package info (click to toggle)
kcachegrind 4%3A16.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,844 kB
  • ctags: 3,250
  • sloc: cpp: 28,541; perl: 325; python: 235; makefile: 7; sh: 5
file content (133 lines) | stat: -rw-r--r-- 3,392 bytes parent folder | download
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* This file is part of KCachegrind.
   Copyright (c) 2003-2015 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>

   KCachegrind is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation, version 2.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

/*
 * TracePart Graph
 */

#ifndef PARTGRAPH_H
#define PARTGRAPH_H

#include <QPixmap>

#include "treemap.h"
#include "tracedata.h"

class PartAreaWidget: public TreeMapWidget
{
  Q_OBJECT

public:
  // Visualization inside of trace parts
  enum VisualizationMode { NoVisualization, Partitioning, Inclusive };

  explicit PartAreaWidget(QWidget* parent=0);

  void setData(TraceData* d);
  void setEventType(EventType* ct);
  void setGroupType(ProfileContext::Type gt);
  void setVisualization(VisualizationMode);
  void setZoomFunction(bool zoomFunction);
  void setCallLevels(int callLevels);
  void setFunction(TraceFunction* f);

  EventType* eventType() const { return _eventType; }
  ProfileContext::Type groupType() const { return _groupType; }
  TraceFunction* function() const { return _function; }
  VisualizationMode visualization() const { return _visualization; }
  bool zoomFunction() const { return _zoomFunction; }
  int callLevels() const { return _callLevels; }

  QColor groupColor(TraceFunction*) const;
  QString tipString(TreeMapItem*) const;

  void changeHidden(const TracePartList& list);
  bool isHidden(TracePart*) const;

private:
  void refreshParts();

  TraceData* _data;
  EventType* _eventType;
  ProfileContext::Type _groupType;
  TraceFunction* _function;
  VisualizationMode _visualization;
  bool _zoomFunction;
  int _callLevels;

  TracePartList _hiddenParts;
};

class BasePartItem: public TreeMapItem
{
public:
  BasePartItem();

  void setData(TraceData* d);

  int rtti() const { return 1; }
  double value() const;
  QString text(int) const;
  int borderWidth() const { return 0; }
  TreeMapItemList* children();
  QColor backColor() const;

private:
  TraceData* _data;
};

class PartItem: public TreeMapItem
{
public:
  explicit PartItem(TracePart* p);
  int rtti() const { return 2; }
  TracePart* part() { return _p; }
  double value() const;
  double sum() const;
  int borderWidth() const { return 0; }
  QString text(int) const;
  QPixmap pixmap(int) const;
  TreeMapItemList* children();
  QColor backColor() const;

private:
  TracePart* _p;
  unsigned int _factor;
};

class SubPartItem: public TreeMapItem
{
public:
  explicit SubPartItem(ProfileCostArray*);
  int rtti() const { return 3; }
  ProfileCostArray* partCostItem() { return _partCostItem; }
  double value() const;
  double sum() const;
  SplitMode splitMode() const { return Vertical; }
  QString text(int) const;
  QPixmap pixmap(int) const;
  TreeMapItemList* children();
  QColor backColor() const;

private:
  ProfileCostArray* _partCostItem;
  unsigned int _factor;
};


#endif