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

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libcore
fixcost.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2003 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 FIXCOST_H
20 #define FIXCOST_H
21 
27 #define USE_FIXCOST 1
28 
29 #include "tracedata.h"
30 #include "pool.h"
31 
32 class PositionSpec
33 {
34  public:
35  PositionSpec()
36  { fromLine = 0, toLine = 0, fromAddr = 0, toAddr = 0; }
37  PositionSpec(uint l1, uint l2, Addr a1, Addr a2)
38  { fromLine = l1, toLine = l2, fromAddr = a1, toAddr = a2; }
39 
40  bool isLineRegion() const { return (fromLine != toLine); }
41  bool isAddrRegion() const { return (fromAddr != toAddr); }
42 
43  uint fromLine, toLine;
44  Addr fromAddr, toAddr;
45 };
46 
53 class FixCost
54 {
55 
56  public:
57  FixCost(TracePart*, FixPool*,
58  TraceFunctionSource*,
59  PositionSpec&,
60  TracePartFunction*,
61  FixString&);
62 
63  void *operator new(size_t size, FixPool*);
64 
65  void addTo(ProfileCostArray*);
66 
67  TracePart* part() const { return _part; }
68  bool isLineRegion() const { return _pos.isLineRegion(); }
69  bool isAddrRegion() const { return _pos.isAddrRegion(); }
70  uint fromLine() const { return _pos.fromLine; }
71  uint line() const { return _pos.fromLine; }
72  uint toLine() const { return _pos.toLine; }
73  Addr fromAddr() const { return _pos.fromAddr; }
74  Addr addr() const { return _pos.fromAddr; }
75  Addr toAddr() const { return _pos.toAddr; }
76  TraceFunctionSource* functionSource() const { return _functionSource; }
77 
78  FixCost* nextCostOfPartFunction() const
79  { return _nextCostOfPartFunction; }
80 
81  private:
82  int _count;
83  SubCost* _cost;
84  PositionSpec _pos;
85 
86  TracePart* _part;
87  TraceFunctionSource* _functionSource;
88  FixCost *_nextCostOfPartFunction;
89 };
90 
96 class FixCallCost
97 {
98 
99  public:
100  FixCallCost(TracePart*, FixPool*,
101  TraceFunctionSource*,
102  unsigned int line,
103  Addr addr,
104  TracePartCall*,
105  SubCost, FixString&);
106 
107  void *operator new(size_t size, FixPool*);
108 
109  void addTo(TraceCallCost*);
110  void setMax(ProfileCostArray*);
111 
112  TracePart* part() const { return _part; }
113  unsigned int line() const { return _line; }
114  Addr addr() const { return _addr; }
115  SubCost callCount() const { return _cost[_count]; }
116  TraceFunctionSource* functionSource() const { return _functionSource; }
117  FixCallCost* nextCostOfPartCall() const
118  { return _nextCostOfPartCall; }
119 
120  private:
121  // we use 1 SubCost more than _count: _cost[_count] is the call count
122  int _count;
123  SubCost* _cost;
124  unsigned int _line;
125  Addr _addr;
126 
127  TracePart* _part;
128  TraceFunctionSource* _functionSource;
129  FixCallCost* _nextCostOfPartCall;
130 };
131 
135 class FixJump
136 {
137 
138  public:
139  FixJump(TracePart*, FixPool*,
140  /* source position */
141  unsigned int line, Addr addr,
142  TracePartFunction*, TraceFunctionSource*,
143  /* target position */
144  unsigned int targetLine, Addr targetAddr,
145  TraceFunction*, TraceFunctionSource*,
146  bool isCondJump,
147  SubCost, SubCost);
148 
149  void *operator new(size_t size, FixPool*);
150 
151  void addTo(TraceJumpCost*);
152 
153  TracePart* part() const { return _part; }
154  unsigned int line() const { return _line; }
155  Addr addr() const { return _addr; }
156  TraceFunctionSource* source() const { return _source; }
157  TraceFunction* targetFunction() const { return _targetFunction; }
158  unsigned int targetLine() const { return _targetLine; }
159  Addr targetAddr() const { return _targetAddr; }
160  TraceFunctionSource* targetSource() const { return _targetSource; }
161  bool isCondJump() const { return _isCondJump; }
162  SubCost executedCount() const { return _cost[0]; }
163  SubCost followedCount() const
164  { return _isCondJump ? _cost[1] : SubCost(0); }
165 
166  FixJump* nextJumpOfPartFunction() const
167  { return _nextJumpOfPartFunction; }
168 
169  private:
170  bool _isCondJump;
171  SubCost* _cost;
172  unsigned int _line, _targetLine;
173  Addr _addr, _targetAddr;
174 
175  TracePart* _part;
176  TraceFunctionSource *_source, *_targetSource;
177  TraceFunction* _targetFunction;
178  FixJump *_nextJumpOfPartFunction;
179 };
180 
181 #endif
182 
183 
FixCallCost::nextCostOfPartCall
FixCallCost * nextCostOfPartCall() const
Definition: fixcost.h:117
FixCost::line
uint line() const
Definition: fixcost.h:71
FixJump::executedCount
SubCost executedCount() const
Definition: fixcost.h:162
FixCost::toAddr
Addr toAddr() const
Definition: fixcost.h:75
FixJump::FixJump
FixJump(TracePart *, FixPool *, unsigned int line, Addr addr, TracePartFunction *, TraceFunctionSource *, unsigned int targetLine, Addr targetAddr, TraceFunction *, TraceFunctionSource *, bool isCondJump, SubCost, SubCost)
Definition: fixcost.cpp:146
FixCallCost::FixCallCost
FixCallCost(TracePart *, FixPool *, TraceFunctionSource *, unsigned int line, Addr addr, TracePartCall *, SubCost, FixString &)
Definition: fixcost.cpp:75
pool.h
FixJump::isCondJump
bool isCondJump() const
Definition: fixcost.h:161
PositionSpec::PositionSpec
PositionSpec()
Definition: fixcost.h:35
PositionSpec
Definition: fixcost.h:32
TraceFunction
A traced function.
Definition: tracedata.h:1122
PositionSpec::toLine
uint toLine
Definition: fixcost.h:43
FixCost::nextCostOfPartFunction
FixCost * nextCostOfPartFunction() const
Definition: fixcost.h:78
FixCost::FixCost
FixCost(TracePart *, FixPool *, TraceFunctionSource *, PositionSpec &, TracePartFunction *, FixString &)
Definition: fixcost.cpp:25
PositionSpec::toAddr
Addr toAddr
Definition: fixcost.h:44
FixJump::line
unsigned int line() const
Definition: fixcost.h:154
Addr
Addresses are 64bit values like costs to be able to always load profile data produced on 64bit archit...
Definition: addr.h:31
FixJump::source
TraceFunctionSource * source() const
Definition: fixcost.h:156
FixCost::fromLine
uint fromLine() const
Definition: fixcost.h:70
FixCallCost::functionSource
TraceFunctionSource * functionSource() const
Definition: fixcost.h:116
FixCost::isAddrRegion
bool isAddrRegion() const
Definition: fixcost.h:69
FixCost
A class holding an unchangable cost item of an input file.
Definition: fixcost.h:53
PositionSpec::PositionSpec
PositionSpec(uint l1, uint l2, Addr a1, Addr a2)
Definition: fixcost.h:37
tracedata.h
FixPool
FixPool.
Definition: pool.h:34
ProfileCostArray
An array of basic cost metrics for a trace item.
Definition: costitem.h:144
FixCallCost::part
TracePart * part() const
Definition: fixcost.h:112
FixCost::isLineRegion
bool isLineRegion() const
Definition: fixcost.h:68
TraceFunctionSource
A container helper class for TraceFunction for source lines where a function is implemented in...
Definition: tracedata.h:1029
FixCallCost::setMax
void setMax(ProfileCostArray *)
Definition: fixcost.cpp:131
FixCallCost::addTo
void addTo(TraceCallCost *)
Definition: fixcost.cpp:114
FixString
A simple, constant string class.
Definition: utils.h:38
FixCost::addTo
void addTo(ProfileCostArray *)
Definition: fixcost.cpp:58
FixCost::part
TracePart * part() const
Definition: fixcost.h:67
TracePartFunction
Cost of a function, from a single trace file.
Definition: tracedata.h:543
FixCallCost::line
unsigned int line() const
Definition: fixcost.h:113
TracePartCall
Cost of a call at a function to another function, from a single trace file.
Definition: tracedata.h:516
FixJump::followedCount
SubCost followedCount() const
Definition: fixcost.h:163
TracePart
A Trace Part: All data read from a trace file, containing all costs that happened in a specified time...
Definition: tracedata.h:655
PositionSpec::isLineRegion
bool isLineRegion() const
Definition: fixcost.h:40
FixCallCost::addr
Addr addr() const
Definition: fixcost.h:114
FixJump::addTo
void addTo(TraceJumpCost *)
Definition: fixcost.cpp:182
FixJump
A class holding a jump (mostly) inside of a function.
Definition: fixcost.h:135
SubCost
Cost event counter, simple wrapper around a 64bit entity.
Definition: subcost.h:32
FixCost::toLine
uint toLine() const
Definition: fixcost.h:72
FixJump::part
TracePart * part() const
Definition: fixcost.h:153
FixJump::targetLine
unsigned int targetLine() const
Definition: fixcost.h:158
TraceCallCost
Cost item with additional call count metric.
Definition: tracedata.h:228
FixCost::addr
Addr addr() const
Definition: fixcost.h:74
FixJump::targetSource
TraceFunctionSource * targetSource() const
Definition: fixcost.h:160
PositionSpec::fromAddr
Addr fromAddr
Definition: fixcost.h:44
FixCallCost::callCount
SubCost callCount() const
Definition: fixcost.h:115
FixJump::targetAddr
Addr targetAddr() const
Definition: fixcost.h:159
FixCost::fromAddr
Addr fromAddr() const
Definition: fixcost.h:73
FixJump::targetFunction
TraceFunction * targetFunction() const
Definition: fixcost.h:157
TraceJumpCost
Cost of a (conditional) jump.
Definition: tracedata.h:201
FixJump::addr
Addr addr() const
Definition: fixcost.h:155
PositionSpec::fromLine
uint fromLine
Definition: fixcost.h:43
PositionSpec::isAddrRegion
bool isAddrRegion() const
Definition: fixcost.h:41
FixJump::nextJumpOfPartFunction
FixJump * nextJumpOfPartFunction() const
Definition: fixcost.h:166
FixCallCost
A FixCallCost will be inserted into a.
Definition: fixcost.h:96
FixCost::functionSource
TraceFunctionSource * functionSource() const
Definition: fixcost.h:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:27 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
  • okteta
  • 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