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 MASSIF_FILEDATA_H
0024 #define MASSIF_FILEDATA_H
0025 
0026 #include <QtCore/QObject>
0027 #include <QtCore/QVector>
0028 
0029 namespace Massif {
0030 
0031 class SnapshotItem;
0032 
0033 /**
0034  * This structure holds all information that can be extracted from a massif output file.
0035  */
0036 class FileData : public QObject
0037 {
0038     Q_OBJECT
0039 public:
0040     FileData(QObject* parent = 0);
0041     virtual ~FileData();
0042 
0043     /**
0044      * Set the @p cmd that was profiled with massif.
0045      */
0046     void setCmd(const QString& cmd);
0047     /**
0048      * @return Command that was profiled with massif.
0049      */
0050     QString cmd() const;
0051 
0052     /**
0053      * Set a @p description.
0054      */
0055     void setDescription(const QString& description);
0056     /**
0057      * @return Description for this massif run.
0058      */
0059     QString description() const;
0060 
0061     /**
0062      * Set the @p unit that times are measured in.
0063      */
0064     void setTimeUnit(const QString& unit);
0065     /**
0066      * @return The unit that times are measured in.
0067      */
0068     QString timeUnit() const;
0069 
0070     /**
0071      * Adds @p snapshot to this dataset and takes ownership.
0072      */
0073     void addSnapshot(SnapshotItem* snapshot);
0074     /**
0075      * @return List of all snapshots that make up this dataset.
0076      */
0077     QVector<SnapshotItem*> snapshots() const;
0078 
0079     /**
0080      * Marks @p snapshot as peak of this dataset.
0081      * The snapshot should already been added to the dataset.
0082      */
0083     void setPeak(SnapshotItem* snapshot);
0084     /**
0085      * @return The peak snapshot in this dataset.
0086      */
0087     SnapshotItem* peak() const;
0088 
0089 private:
0090     QString m_cmd;
0091     QString m_description;
0092     QString m_timeUnit;
0093     QVector<SnapshotItem*> m_snapshots;
0094     SnapshotItem* m_peak;
0095 };
0096 
0097 }
0098 
0099 #endif // MASSIF_FILEDATA_H