• 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
subcost.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2002-2004 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 SUBCOST_H
20 #define SUBCOST_H
21 
22 #include <QVector>
23 #include <QList>
24 
25 #include "utils.h"
26 
27 typedef unsigned long long uint64;
28 
32 class SubCost
33 {
34  public:
35  SubCost() { v=0; }
36  SubCost(uint64 i) { v=i; }
37  SubCost(unsigned i) { v=i; }
38  SubCost(int i) { v=(unsigned)i; }
39  SubCost(double d) { v= (uint64)(d + .5); }
40 
41  SubCost& operator=(uint64 i) { v = i; return *this; }
42  SubCost& operator=(unsigned i) { v = i; return *this; }
43  SubCost& operator=(int i) { v = i; return *this; }
44  SubCost& operator=(double d) { v = (uint64)(d + .5); return *this; }
45 
46  bool set(const char** s);
47  bool set(FixString& s) { return s.stripUInt64(v); }
48 
49  operator uint64&() { return v; }
50 
51  bool operator==(unsigned i) const { return v == i; }
52  bool operator==(int i) const { return v == (unsigned)i; }
53  bool operator<(unsigned i) const { return v < i; }
54  bool operator<(int i) const { return v < (unsigned)i; }
55  bool operator<(const SubCost& s) const { return v < s.v; }
56  bool operator>(unsigned i) const { return v > i; }
57  bool operator>(int i) const { return v > (unsigned)i; }
58  bool operator>(const SubCost& s) const { return v > s.v; }
59 
64  QString pretty(char sep = ' ') const;
65 
66  uint64 v;
67 };
68 
69 class ProfileCostArray;
70 class EventType;
71 typedef QList<ProfileCostArray*> TraceCostList;
72 
78 class HighestCostList
79 {
80  public:
81  HighestCostList();
82 
83  void clear(int maxSize);
84  void addCost(ProfileCostArray*, SubCost);
85  int count() { return _count; }
86  int realCount() { return (_count > _maxSize) ? _maxSize:_count; }
87  int maxSize() { return _maxSize; }
88  bool hasMore() { return _count > _maxSize; }
89  ProfileCostArray* operator[] (int i)
90  { return (i>=0 && i<_count && i<_maxSize) ? _item[i] : 0; }
91 
92  private:
93  TraceCostList _list;
94  int _maxSize, _count;
95  EventType* _costType;
96  QVector<ProfileCostArray*> _item;
97  QVector<SubCost> _cost;
98 };
99 
100 
101 #endif
HighestCostList::operator[]
ProfileCostArray * operator[](int i)
Definition: subcost.h:89
HighestCostList::maxSize
int maxSize()
Definition: subcost.h:87
SubCost::SubCost
SubCost(unsigned i)
Definition: subcost.h:37
SubCost::operator<
bool operator<(unsigned i) const
Definition: subcost.h:53
HighestCostList::HighestCostList
HighestCostList()
Definition: subcost.cpp:69
SubCost::operator>
bool operator>(int i) const
Definition: subcost.h:57
HighestCostList::clear
void clear(int maxSize)
Definition: subcost.cpp:75
uint64
unsigned long long uint64
Definition: subcost.h:27
SubCost::operator==
bool operator==(unsigned i) const
Definition: subcost.h:51
EventType
A cost type, e.g.
Definition: eventtype.h:43
SubCost::v
uint64 v
Definition: subcost.h:66
SubCost::operator=
SubCost & operator=(double d)
Definition: subcost.h:44
utils.h
ProfileCostArray
An array of basic cost metrics for a trace item.
Definition: costitem.h:144
SubCost::SubCost
SubCost(double d)
Definition: subcost.h:39
HighestCostList::realCount
int realCount()
Definition: subcost.h:86
SubCost::SubCost
SubCost(int i)
Definition: subcost.h:38
SubCost::set
bool set(FixString &s)
Definition: subcost.h:47
SubCost::operator>
bool operator>(const SubCost &s) const
Definition: subcost.h:58
HighestCostList
A class to calculate the ProfileCostArray items with highest cost.
Definition: subcost.h:78
SubCost::operator=
SubCost & operator=(unsigned i)
Definition: subcost.h:42
SubCost::operator<
bool operator<(int i) const
Definition: subcost.h:54
FixString
A simple, constant string class.
Definition: utils.h:38
SubCost::operator=
SubCost & operator=(uint64 i)
Definition: subcost.h:41
HighestCostList::addCost
void addCost(ProfileCostArray *, SubCost)
Definition: subcost.cpp:83
HighestCostList::count
int count()
Definition: subcost.h:85
SubCost::SubCost
SubCost(uint64 i)
Definition: subcost.h:36
HighestCostList::hasMore
bool hasMore()
Definition: subcost.h:88
SubCost
Cost event counter, simple wrapper around a 64bit entity.
Definition: subcost.h:32
FixString::stripUInt64
bool stripUInt64(uint64 &, bool stripSpaces=true)
Definition: utils.cpp:210
SubCost::pretty
QString pretty(char sep= ' ') const
Convert SubCost value into a QString, spaced every 3 digits.
Definition: subcost.cpp:46
SubCost::operator>
bool operator>(unsigned i) const
Definition: subcost.h:56
SubCost::operator==
bool operator==(int i) const
Definition: subcost.h:52
SubCost::operator=
SubCost & operator=(int i)
Definition: subcost.h:43
SubCost::set
bool set(const char **s)
Definition: subcost.cpp:29
SubCost::SubCost
SubCost()
Definition: subcost.h:35
QList
TraceCostList
QList< ProfileCostArray * > TraceCostList
Definition: subcost.h:70
SubCost::operator<
bool operator<(const SubCost &s) const
Definition: subcost.h:55
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