ifw-ccf  3.0.0-pre2
utilities.hpp
Go to the documentation of this file.
1 
5 #ifndef CCF_COMMON_UTILITIES_HPP_H_
6 #define CCF_COMMON_UTILITIES_HPP_H_
7 
8 #include <string>
9 
10 #include <core/utils/param/parameterSet.hpp>
11 
12 namespace ccf::common {
13 
15  std::string GetImageDir();
16 
18  std::string PackParameters(const core::utils::param::ParameterSet& parameters);
19 
21  void UnpackParameters(const std::string& parameters,
22  core::utils::param::ParameterSet& par_set);
23 
26  public:
29 
31  void Reset();
32 
34  void SetNbOfSamples(const uint16_t nb);
35 
38  void Update(const double fr_recv_timestamp,
39  const double fr_handling_time,
40  const uint32_t fr_size);
41 
43  void SetLostFramesCounter(const uint64_t lost_frames);
44 
46  uint64_t IncSkippedFramesCounter();
47 
49  void GetDataSnapshot(FrameStatistics& trg_obj) const;
50 
52  std::string GetId() const;
53 
55  uint16_t GetNbOfSamples() const;
56 
58  double GetStartTime() const;
59 
61  double GetLastUpdate() const;
62 
64  double GetTimeFirstFrame() const;
65 
67  uint64_t GetFrameCount() const;
68 
70  uint64_t GetVolume() const;
71 
73  uint64_t GetSkippedFrames() const;
74 
76  uint64_t GetLostFrames() const;
77 
79  const std::vector<double>& GetFrRecvTimestamps() const;
80 
82  const std::vector<uint64_t>& GetFrRecvFrCounts() const;
83 
85  const std::vector<double>& GetFrHandlingTimes() const;
86 
88  std::string ToString() const;
89 
91 
92  protected:
93  std::string p_id;
94  uint16_t p_nb_samples;
95 
96  double p_start_time;
97  double p_last_update;
98  uint64_t p_frame_count;
99  uint64_t p_volume;
100  uint64_t p_lost_frames;
102  std::vector<double> p_fr_recv_timestamps;
104  std::vector<uint64_t> p_fr_recv_fr_counts;
105  std::vector<double> p_fr_handling_times;
106 
107  private:
108 
109  };
110 
111 }
112 
113 #endif // CCF_COMMON_UTILITIES_HPP_H_
Class used by the threads to store info for generating performance statistics.
Definition: utilities.hpp:25
void Update(const double fr_recv_timestamp, const double fr_handling_time, const uint32_t fr_size)
Definition: utilities.cpp:112
double p_last_update
Definition: utilities.hpp:97
void SetNbOfSamples(const uint16_t nb)
Set the number of samples to keep in the sliding window.
Definition: utilities.cpp:97
std::vector< double > p_fr_recv_timestamps
Definition: utilities.hpp:102
uint64_t GetFrameCount() const
Get the number of frames handled.
Definition: utilities.cpp:159
std::string ToString() const
Generate a string summery of the contents of the object.
Definition: utilities.cpp:244
FrameStatistics()
Definition: utilities.cpp:70
uint64_t p_skipped_frames
Definition: utilities.hpp:101
uint64_t p_lost_frames
Definition: utilities.hpp:100
double p_start_time
Definition: utilities.hpp:96
std::string p_id
Definition: utilities.hpp:93
void GetDataSnapshot(FrameStatistics &trg_obj) const
Get a snapshot of the data in the object.
Definition: utilities.cpp:184
uint64_t GetLostFrames() const
Get the number of lost frames.
Definition: utilities.cpp:239
const std::vector< double > & GetFrRecvTimestamps() const
Get a vector with the timestamps for receiving the frames.
Definition: utilities.cpp:169
double GetStartTime() const
Get the start time for the recording.
Definition: utilities.cpp:149
const std::vector< uint64_t > & GetFrRecvFrCounts() const
Get the frame counts of each frame for which data is stored in the object.
Definition: utilities.cpp:174
uint64_t IncSkippedFramesCounter()
Increment the frames handled counter.
Definition: utilities.cpp:227
uint64_t p_frame_count
Definition: utilities.hpp:98
uint16_t p_nb_samples
Definition: utilities.hpp:94
~FrameStatistics()
Definition: utilities.cpp:75
uint16_t GetNbOfSamples() const
Get the number of samples used in the sliding window.
Definition: utilities.cpp:144
FrameStatistics & operator=(const FrameStatistics &source)
Definition: utilities.cpp:202
void Reset()
Reset the frame statistics object.
Definition: utilities.cpp:79
double GetTimeFirstFrame() const
Get the time stamp of the first frame status registered.
Definition: utilities.cpp:134
std::vector< double > p_fr_handling_times
Definition: utilities.hpp:105
const std::vector< double > & GetFrHandlingTimes() const
Get vector with the timestamp for handling the frames.
Definition: utilities.cpp:179
uint64_t GetVolume() const
Get the volume (in bytes) of the frames handled.
Definition: utilities.cpp:164
double p_first_recv_time
Definition: utilities.hpp:103
uint64_t p_volume
Definition: utilities.hpp:99
std::string GetId() const
Get the ID of the object.
Definition: utilities.cpp:139
void SetLostFramesCounter(const uint64_t lost_frames)
Set the lost frames counter.
Definition: utilities.cpp:220
std::vector< uint64_t > p_fr_recv_fr_counts
Definition: utilities.hpp:104
double GetLastUpdate() const
Get the time for the last update of the samples.
Definition: utilities.cpp:154
uint64_t GetSkippedFrames() const
Get the number of skipped frames.
Definition: utilities.cpp:234
Definition: appBase.cpp:8
std::string PackParameters(const core::utils::param::ParameterSet &parameters)
Serialise the parameters contained in the parameter set.
Definition: utilities.cpp:42
std::string GetImageDir()
Get the name of the image output folder.
Definition: utilities.cpp:15
void UnpackParameters(const std::string &parameters, core::utils::param::ParameterSet &par_set)
Unpacke the serialised parameters and store the information in the provided parameter set object.
Definition: utilities.cpp:53