MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlProcessingTimeLine.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2013, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_PROCESSING_TIME_LINE_H
14#define ML_PROCESSING_TIME_LINE_H
15
17
18// ML-includes
19#include "mlInitSystemML.h"
20
21#include "mlTimeCounter.h"
22
23#include <string>
24#include <vector>
25
27
30{
31public:
34
37
40 {
41 public:
42 TimeLine(ProcessingTimeLine* owner, const std::string& name)
43 {
44 _name = name;
45 _owner = owner;
46 }
47
56
58 int startEntry(const std::string& info, int processingScope = 0);
61
62 void load(std::ifstream& stream);
63
64 void save(std::ofstream& stream);
65
67
70
73
74 void clear();
75
76 const std::vector<Entry>& getEntries() const
77 {
78 return _entries;
79 }
80
81 const std::string& name() const
82 {
83 return _name;
84 }
85
86 private:
87 ProcessingTimeLine* _owner;
88 std::string _name;
89 std::vector<Entry> _entries;
90 };
91
93 TimeLine* addTimeLine(const std::string& name);
94
97
99 int getNumTimeLines() const
100 {
101 return static_cast<int>(_timeLines.size());
102 }
103
106 {
107 return _timeLines[i];
108 }
109
112 {
113 _timer.reset();
114 }
115
118
121
126
128 void save(const std::string& fileName);
129
131 void load(const std::string& fileName);
132
134 void clear();
135
136private:
137 std::vector<TimeLine*> _timeLines;
138
139 TimeCounter _timer;
140
141 bool _firstEntry;
142};
143
145
146#endif
Timeline for a single thread.
double getMinimumTime()
Searches and returns the earliest time point measured.
int startEntry(const std::string &info, int processingScope=0)
Starts an entry and returns its index.
void copyFrom(TimeLine &timeline)
void stopEntry(int entryIndex)
Stops the entry at the given index.
const std::vector< Entry > & getEntries() const
double getMaximumTime()
Searches and returns the latest time point measured.
const std::string & name() const
TimeLine(ProcessingTimeLine *owner, const std::string &name)
void load(std::ifstream &stream)
void save(std::ofstream &stream)
Stores a processing timeline for multiple threads.
double getMinimumTime()
Searches and returns the earliest time point measured over all timelines.
void resetRunningTime()
Resets the running time, which affects getRunningTime().
void load(const std::string &fileName)
Reads timeline from disk.
void removeTimeLine(TimeLine *timeLine)
Removes the given timeline and deletes it.
TimeLine * getTimeLine(int i) const
Returns the timeline with given index i.
TimeLine * addTimeLine(const std::string &name)
Adds a timeline with the given name. The ownership stays with ProcessingTimeLine.
double getRunningTime()
Returns the current running time in seconds.
double getMaximumTime()
Searches and returns the latest time point measured over all timelines.
void clear()
Clears/removes the timelines.
void resetTimeLines()
Resets the timelines without deleting them.
void save(const std::string &fileName)
Saves timeline to disk.
int getNumTimeLines() const
Returns the number of timelines.
void copyFrom(ProcessingTimeLine &timeline)
Copies data from given timeline.
Class to measure precise time intervals.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217