MeVisLab Toolbox Reference
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 _name = name;
44 _owner = owner;
45 }
46
54
56 int startEntry(const std::string& info, int processingScope = 0);
59
60 void load(std::ifstream& stream);
61
62 void save(std::ofstream& stream);
63
65
68
71
72 void clear();
73
74 const std::vector<Entry>& getEntries() const { return _entries; }
75
76 const std::string& name() const { return _name; }
77
78 private:
79 ProcessingTimeLine* _owner;
80 std::string _name;
81 std::vector<Entry> _entries;
82 };
83
85 TimeLine* addTimeLine(const std::string& name);
86
89
91 int getNumTimeLines() const { return static_cast<int>(_timeLines.size()); }
92
94 TimeLine* getTimeLine(int i) const { return _timeLines[i]; }
95
97 void resetRunningTime() { _timer.reset(); }
98
101
104
109
111 void save(const std::string& fileName);
112
114 void load(const std::string& fileName);
115
117 void clear();
118
119private:
120 std::vector<TimeLine*> _timeLines;
121
122 TimeCounter _timer;
123
124 bool _firstEntry;
125};
126
128
129#endif
130
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