File indexing completed on 2024-04-28 17:02:20

0001 /*
0002    This file is part of Massif Visualizer
0003 
0004    Copyright 2010 Milian Wolff <mail@milianw.de>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Lesser General Public
0008    License as published by the Free Software Foundation; either
0009    version 2.1 of the License, or (at your option) version 3, or any
0010    later version accepted by the membership of KDE e.V. (or its
0011    successor approved by the membership of KDE e.V.), which shall
0012    act as a proxy defined in Section 6 of version 3 of the license.
0013 
0014    This library is distributed in the hope that it will be useful,
0015    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017    Lesser General Public License for more details.
0018 
0019    You should have received a copy of the GNU Lesser General Public
0020    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #ifndef SNAPSHOTITEM_H
0024 #define SNAPSHOTITEM_H
0025 
0026 #include <qglobal.h>
0027 
0028 namespace Massif
0029 {
0030 
0031 class TreeLeafItem;
0032 
0033 class SnapshotItem
0034 {
0035 public:
0036     SnapshotItem();
0037     ~SnapshotItem();
0038 
0039     /**
0040      * Sets the number of this snapshot.
0041      */
0042     void setNumber(uint num);
0043     /**
0044      * @return The number of this snapshot.
0045      */
0046     uint number() const;
0047 
0048     /**
0049      * Sets the @p time at which this snapshot was taken.
0050      * The time can be measured in different formats,
0051      * @see FileData::timeUnit()
0052      */
0053     void setTime(double time);
0054     /**
0055      * @return The time at which this snapshot was taken.
0056      * The time can be measured in different formats,
0057      * @see FileData::timeUnit()
0058      */
0059     double time() const;
0060 
0061     /**
0062      * Sets the size of the memory heap in bytes.
0063      */
0064     void setMemHeap(quint64 bytes);
0065     /**
0066      * @return The size of the memory heap in bytes.
0067      */
0068     quint64 memHeap() const;
0069 
0070     /**
0071      * Sets the size of the extra memory heap in bytes.
0072      */
0073     void setMemHeapExtra(quint64 bytes);
0074     /**
0075      * @return The size of the extra memory heap in bytes.
0076      */
0077     quint64 memHeapExtra() const;
0078 
0079     /**
0080      * Sets the size of the memory stacks in bytes.
0081      */
0082     void setMemStacks(quint64 bytes);
0083     /**
0084      * @return The size of the memory stacks in bytes.
0085      */
0086     quint64 memStacks() const;
0087 
0088     /**
0089      * Sets @p root as root node of the detailed heap tree of this snapshot.
0090      */
0091     void setHeapTree(TreeLeafItem* root);
0092     /**
0093      * @return The root node of the detailed heap tree or zero if none is set.
0094      */
0095     TreeLeafItem* heapTree() const;
0096 
0097     /**
0098      * @return The total cost, i.e. sum of memory heap and stack.
0099      */
0100     quint64 cost() const;
0101 
0102 private:
0103     uint m_number;
0104     double m_time;
0105     quint64 m_memHeap;
0106     quint64  m_memHeapExtra;
0107     quint64 m_memStacks;
0108     TreeLeafItem* m_heapTree;
0109 };
0110 
0111 }
0112 
0113 #endif // SNAPSHOTITEM_H