Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ProgressMeasurement.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4#include <chrono>
5#include <ostream>
6
7namespace storm {
8namespace utility {
9
14 public:
15 typedef decltype(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::seconds::zero()).count()) SecondType;
16 typedef decltype(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::milliseconds::zero()).count()) MilisecondType;
17 typedef decltype(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::nanoseconds::zero()).count()) NanosecondType;
18
23 ProgressMeasurement(std::string const& itemName = "items");
24
29 void startNewMeasurement(uint64_t startCount);
30
38 bool updateProgress(uint64_t count);
39
48 bool updateProgress(uint64_t count, std::ostream& outstream);
49
53 bool isMaxCountSet() const;
54
58 uint64_t getMaxCount() const;
59
63 void setMaxCount(uint64_t maxCount);
64
68 void unsetMaxCount();
69
73 uint64_t getShowProgressDelay() const;
74
79 void setShowProgressDelay(uint64_t delay);
80
84 std::string const& getItemName() const;
85
90 void setItemName(std::string const& name);
91
92 private:
93 // Whether progress should be printed to standard output.
94 bool showProgress;
95
96 // The delay (in seconds) between progress emission.
97 uint64_t delay;
98 // A name for what this is measuring (iterations, states, ...)
99 std::string itemName;
100
101 // The maximal count that can be achieved. numeric_limits<uint64_t>::max() means unspecified.
102 uint64_t maxCount;
103
104 // The last displayed count
105 uint64_t lastDisplayedCount;
106
107 std::chrono::high_resolution_clock::time_point timeOfStart;
108 std::chrono::high_resolution_clock::time_point timeOfLastMessage;
109};
110
111} // namespace utility
112} // namespace storm
A class that provides convenience operations to display run times.
decltype(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::seconds::zero()).count()) SecondType
bool isMaxCountSet() const
Returns whether a maximal count (which is required to achieve 100% progress) has been specified.
std::string const & getItemName() const
Returns the current name of what we are counting (e.g.
decltype(std::chrono::duration_cast< std::chrono::nanoseconds >(std::chrono::nanoseconds::zero()).count()) NanosecondType
bool updateProgress(uint64_t count)
Updates the progress to the current count and prints it if the delay passed.
uint64_t getShowProgressDelay() const
Returns the currently specified minimal delay (in seconds) between two progress messages.
void setMaxCount(uint64_t maxCount)
Sets the maximal possible count.
void startNewMeasurement(uint64_t startCount)
Starts a new measurement, dropping all progress information collected so far.
decltype(std::chrono::duration_cast< std::chrono::milliseconds >(std::chrono::milliseconds::zero()).count()) MilisecondType
void setItemName(std::string const &name)
Customizes the name of what we are counting (e.g.
uint64_t getMaxCount() const
Returns the maximal possible count (if specified).
void unsetMaxCount()
Erases a previously specified maximal count.
void setShowProgressDelay(uint64_t delay)
Customizes the minimal delay between two progress messages.
LabParser.cpp.
Definition cli.cpp:18