ROSE 0.11.145.147
WorkerStatus.h
1#ifndef ROSE_BinaryAnalysis_ModelChecker_WorkerStatus_H
2#define ROSE_BinaryAnalysis_ModelChecker_WorkerStatus_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_MODEL_CHECKER
5
6#include <Rose/BinaryAnalysis/ModelChecker/BasicTypes.h>
7
8#include <Rose/Progress.h>
9#include <boost/filesystem.hpp>
10
11namespace Rose {
12namespace BinaryAnalysis {
13namespace ModelChecker {
14
16class WorkerStatus {
17public:
19 using Ptr = WorkerStatusPtr;
20
21private:
22 boost::filesystem::path fileName_;
23 int fd_ = -1;
24
25 struct Status {
26 WorkerState state = WorkerState::STARTING; // current state
27 time_t stateChange = 0; // time of last state change
28 Progress::Ptr progress; // progress reports
29 uint64_t pathHash = 0; // if working, the current path
30 };
31
32 std::vector<Status> workers_;
33 time_t lastFileUpdate_ = 0; // last time that file was updated
34
35 static constexpr time_t fileUpdatePeriod_ = 1; // update the file every so many seconds
36 static constexpr size_t workersPerLine_ = 4; // number of worker information per line
37 static constexpr size_t barWidth_ = 20; // width of the bar that says how long since a state change
38
39protected:
40 WorkerStatus(const boost::filesystem::path &fileName);
41
42public:
43 ~WorkerStatus();
44
45public:
47 static Ptr instance(const boost::filesystem::path &fileName);
48
52 void insert(size_t workerIdx, const Progress::Ptr&);
53
57 void setState(size_t workerIdx, WorkerState, uint64_t pathHash);
58
60 const boost::filesystem::path& fileName() const;
61
63 void updateFile();
64
66 void updateFileNow();
67};
68
69} // namespace
70} // namespace
71} // namespace
72
73#endif
74#endif
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
The ROSE library.
const char * WorkerState(int64_t)
Convert Rose::BinaryAnalysis::ModelChecker::WorkerState enum constant to a string.