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 #include "snapshotitem.h"
0024 #include "treeleafitem.h"
0025 
0026 using namespace Massif;
0027 
0028 SnapshotItem::SnapshotItem()
0029     : m_number(0), m_time(0), m_memHeap(0), m_memHeapExtra(0), m_memStacks(0), m_heapTree(0)
0030 {
0031 }
0032 
0033 SnapshotItem::~SnapshotItem()
0034 {
0035     delete m_heapTree;
0036 }
0037 
0038 void SnapshotItem::setNumber(uint num)
0039 {
0040     m_number = num;
0041 }
0042 
0043 uint SnapshotItem::number() const
0044 {
0045     return m_number;
0046 }
0047 
0048 void SnapshotItem::setTime(double time)
0049 {
0050     m_time = time;
0051 }
0052 
0053 double SnapshotItem::time() const
0054 {
0055     return m_time;
0056 }
0057 
0058 void SnapshotItem::setMemHeap(quint64 bytes)
0059 {
0060     m_memHeap = bytes;
0061 }
0062 
0063 quint64 SnapshotItem::memHeap() const
0064 {
0065     return m_memHeap;
0066 }
0067 
0068 void SnapshotItem::setMemHeapExtra(quint64 bytes)
0069 {
0070     m_memHeapExtra = bytes;
0071 }
0072 
0073 quint64 SnapshotItem::memHeapExtra() const
0074 {
0075     return m_memHeapExtra;
0076 }
0077 
0078 void SnapshotItem::setMemStacks(quint64 bytes)
0079 {
0080     m_memStacks = bytes;
0081 }
0082 
0083 quint64 SnapshotItem::memStacks() const
0084 {
0085     return m_memStacks;
0086 }
0087 
0088 void SnapshotItem::setHeapTree(TreeLeafItem* root)
0089 {
0090     m_heapTree = root;
0091 }
0092 
0093 TreeLeafItem* SnapshotItem::heapTree() const
0094 {
0095     return m_heapTree;
0096 }
0097 
0098 quint64 SnapshotItem::cost() const
0099 {
0100     return m_memHeap + m_memStacks;
0101 }