GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmRunProgressStatsItem.h
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_RUN_PROGRESS_STATS_ITEM_H_
25#define _GEMA_RUN_PROGRESS_STATS_ITEM_H_
26
27#include "gmRunProgressStats.h"
28
29#include <QObject>
30#include <QElapsedTimer>
31
39{
40 Q_OBJECT
41
42private:
43 friend class GmRunProgressStats;
44
46
48 GmRunProgressStatsItem(const QObject* owner, QString name, int options)
49 : _id(-1), _owner(owner), _name(name), _userData(NULL), _level(GmRunProgressStats::defLevel()),
50 _track(options), _father(NULL), _maxAttrLength(0), _timeAttrId(-1), _memAttrId(-1),
51 _count(0), _firstNestedItem(-1), _report(NULL)
52 {}
53
55 QString reducedName() const { return _father ? _name.right(_name.size() - _father->_name.size() - 1) : _name; }
56
61 int addAttribute(int attrId, QString name)
62 {
63 assert(!_attributeIds.contains(attrId));
64 _attributeIds.append(attrId);
65 if(name.size() > _maxAttrLength)
66 _maxAttrLength = name.size();
67 return _attributeIds.size() - 1;
68 }
69
71 void setTimeAttributeId(int attrId) { assert(attrId >= 0 && attrId < _attributeIds.size()); _timeAttrId = attrId; }
72
74 void setMemoryAttributeId(int attrId) { assert(attrId >= 0 && attrId < _attributeIds.size()); _memAttrId = attrId; }
75
77 void setFather(GmRunProgressStatsItem* father) { _father = father; }
78
80 void addChild(GmRunProgressStatsItem* child) { assert(!_children.contains(child)); _children.append(child); }
81
82 int _id;
83 const QObject* _owner;
85 void* _userData;
86
88 int _track;
89
92
98 quint64 _count;
100
102 {
106 };
107
110
113
120
121};
122
123
124
125#endif
126
A class used to create formatted reports based on ProgressStats item attribute values.
Definition gmRunProgressReport.h:40
A class used to store time, memory and additional values statistics related to the simulation loading...
Definition gmRunProgressStats.h:42
Level
Definition gmRunProgressStats.h:47
An item used to store time, memory and additional values statistics related to the simulation loading...
Definition gmRunProgressStatsItem.h:39
QVector< NestedItemData > _nestedAttributeControl
The vector with information about each nested tracked item.
Definition gmRunProgressStatsItem.h:112
void setFather(GmRunProgressStatsItem *father)
Sets the item father.
Definition gmRunProgressStatsItem.h:77
GmRunProgressReport * _report
The report that this item is tied to, if any. NULL otherwise.
Definition gmRunProgressStatsItem.h:99
void setMemoryAttributeId(int attrId)
Sets the LOCAL id of the execution memory attribute, if any. The attribute MUST already have been reg...
Definition gmRunProgressStatsItem.h:74
void * _userData
A user value that can be used by user code on reports to hav the needed context. Just stored.
Definition gmRunProgressStatsItem.h:85
int addAttribute(int attrId, QString name)
Adds a new Global(Result data) attribute to the set of item attributes. Returns the LOCAL attribute i...
Definition gmRunProgressStatsItem.h:61
void setTimeAttributeId(int attrId)
Sets the LOCAL id of the execution time attribute, if any. The attribute MUST already have been regis...
Definition gmRunProgressStatsItem.h:71
GmRunProgressStatsItem(const QObject *owner, QString name, int options)
Constructor.
Definition gmRunProgressStatsItem.h:48
GmRunProgressStats::Level _level
The requested collection level.
Definition gmRunProgressStatsItem.h:87
int _track
The requested track options + default attribute stats options.
Definition gmRunProgressStatsItem.h:88
int _firstNestedItem
The index in _attributeIds for the first nested attribute, if any. Stores -1 if there is none.
Definition gmRunProgressStatsItem.h:109
QVector< int > _attributeIds
The set of registered attribute ids (registered in GmResultsData)
Definition gmRunProgressStatsItem.h:93
QElapsedTimer _timer
Timer used to measure elapsed time when _timeAttrId is different from -1.
Definition gmRunProgressStatsItem.h:97
int _timeAttrId
The index in _attributeIds for the execution time attribute. -1 if there is none.
Definition gmRunProgressStatsItem.h:95
QVector< GmRunProgressStatsItem * > _children
A list with the item children.
Definition gmRunProgressStatsItem.h:91
QString _name
The full item name, including the parent name.
Definition gmRunProgressStatsItem.h:84
QVector< int > _nestedAttributes
Stores the index of the tracked attributes in the tracked item. If _nestedAttributeControl[i]....
Definition gmRunProgressStatsItem.h:119
int _maxAttrLength
The maximum length of an attribute name.
Definition gmRunProgressStatsItem.h:94
GmRunProgressStatsItem * _father
The item father or NULL if there is none.
Definition gmRunProgressStatsItem.h:90
void addChild(GmRunProgressStatsItem *child)
Adds a new child to the items list.
Definition gmRunProgressStatsItem.h:80
int _id
The item id.
Definition gmRunProgressStatsItem.h:82
int _memAttrId
The index in _attributeIds for the execution memory attribute. -1 if there is none.
Definition gmRunProgressStatsItem.h:96
quint64 _count
The number of times that this item was started.
Definition gmRunProgressStatsItem.h:98
QString reducedName() const
If the item has a father, returns name() without the father prefix. Otherwise, returns name()
Definition gmRunProgressStatsItem.h:55
const QObject * _owner
The object that owns this item. Might be NULL.
Definition gmRunProgressStatsItem.h:83
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of the GmRunProgressStats class.
Q_DISABLE_COPY(Class)
QString right(int n) const const
int size() const const
Definition gmRunProgressStatsItem.h:102
int _itemId
The id of the nested tracked item.
Definition gmRunProgressStatsItem.h:103
int _numAttr
The number of consecutive attributes in _attributeIds belonging to the nested item.
Definition gmRunProgressStatsItem.h:105
int _attrIndex
The index in _attributeIds for the first tracked attribute from the nested item.
Definition gmRunProgressStatsItem.h:104