ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
utilities.hpp
Go to the documentation of this file.
1
6
7#ifndef CCF_COMMON_UTILITIES_HPP_H_
8#define CCF_COMMON_UTILITIES_HPP_H_
9
10#include <execinfo.h>
11#include <string>
12
13#include <ifw/core/utils/param/parameterSet.hpp>
14
15
16namespace ifw::ccf::common {
17
19 std::string GetImageDir();
20
22 std::string PackParameters(const ifw::core::utils::param::ParameterSet& parameters);
23
25 void UnpackParameters(const std::string& parameters,
26 ifw::core::utils::param::ParameterSet& par_set);
27
30 public:
33
36 void Reset(double deferred_start_time=0.);
37
39 void SetNbOfSamples(const uint16_t nb);
40
43 void Update(const double fr_recv_timestamp,
44 const double fr_handling_time,
45 const uint32_t fr_size);
46
48 void SetLostFramesCounter(const uint64_t lost_frames);
49
51 uint64_t IncSkippedFramesCounter();
52
54 void GetDataSnapshot(FrameStatistics& trg_obj) const;
55
57 std::string GetId() const;
58
60 uint16_t GetNbOfSamples() const;
61
63 double GetStartTime() const;
64
66 double GetLastUpdate() const;
67
69 double GetTimeFirstFrame() const;
70
72 uint64_t GetFrameCount() const;
73
75 uint64_t GetTotalFrameCount() const;
76
78 uint64_t GetVolume() const;
79
81 uint64_t GetSkippedFrames() const;
82
84 uint64_t GetLostFrames() const;
85
87 const std::vector<double>& GetFrRecvTimestamps() const;
88
90 const std::vector<uint64_t>& GetFrRecvFrCounts() const;
91
93 const std::vector<double>& GetFrHandlingTimes() const;
94
96 std::string ToString() const;
97
99
100 protected:
101 std::string p_id;
102 uint16_t p_nb_samples;
103
104 double p_start_time{0};
106 uint64_t p_frame_count{0};
108 uint64_t p_volume{0};
109 uint64_t p_lost_frames{0};
110 uint64_t p_skipped_frames{0};
111 std::vector<double> p_fr_recv_timestamps;
113 std::vector<uint64_t> p_fr_recv_fr_counts;
114 std::vector<double> p_fr_handling_times;
115
116 private:
117
118 };
119
120
121 // TODO: Move to ifw-fnd.
122 std::vector<std::string> get_call_stack(int max_frames = 64);
123
124}
125
126#endif // CCF_COMMON_UTILITIES_HPP_H_
void SetLostFramesCounter(const uint64_t lost_frames)
Set the lost frames counter.
Definition utilities.cpp:233
double p_start_time
Definition utilities.hpp:104
uint64_t p_lost_frames
Definition utilities.hpp:109
std::vector< double > p_fr_handling_times
Definition utilities.hpp:114
double GetLastUpdate() const
Get the time for the last update of the samples.
Definition utilities.cpp:160
std::vector< double > p_fr_recv_timestamps
Definition utilities.hpp:111
FrameStatistics()
Definition utilities.cpp:70
void SetNbOfSamples(const uint16_t nb)
Set the number of samples to keep in the sliding window.
Definition utilities.cpp:102
uint16_t GetNbOfSamples() const
Get the number of samples used in the sliding window.
Definition utilities.cpp:150
uint16_t p_nb_samples
Definition utilities.hpp:102
double GetStartTime() const
Get the start time for the recording.
Definition utilities.cpp:155
FrameStatistics & operator=(const FrameStatistics &source)
Definition utilities.cpp:214
uint64_t GetVolume() const
Get the volume (in bytes) of the frames handled.
Definition utilities.cpp:175
std::string p_id
Definition utilities.hpp:101
std::string ToString() const
Generate a string summery of the contents of the object.
Definition utilities.cpp:257
double GetTimeFirstFrame() const
Get the time stamp of the first frame status registered.
Definition utilities.cpp:140
~FrameStatistics()
Definition utilities.cpp:75
double p_last_update
Definition utilities.hpp:105
const std::vector< double > & GetFrRecvTimestamps() const
Get a vector with the timestamps for receiving the frames.
Definition utilities.cpp:180
uint64_t p_skipped_frames
Definition utilities.hpp:110
double p_first_recv_time
Definition utilities.hpp:112
void GetDataSnapshot(FrameStatistics &trg_obj) const
Get a snapshot of the data in the object.
Definition utilities.cpp:195
uint64_t p_total_frame_count
Definition utilities.hpp:107
std::string GetId() const
Get the ID of the object.
Definition utilities.cpp:145
uint64_t GetLostFrames() const
Get the number of lost frames.
Definition utilities.cpp:252
uint64_t GetFrameCount() const
Get the number of frames handled.
Definition utilities.cpp:165
std::vector< uint64_t > p_fr_recv_fr_counts
Definition utilities.hpp:113
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:185
uint64_t IncSkippedFramesCounter()
Increment the frames handled counter.
Definition utilities.cpp:240
const std::vector< double > & GetFrHandlingTimes() const
Get vector with the timestamp for handling the frames.
Definition utilities.cpp:190
uint64_t p_volume
Definition utilities.hpp:108
void Update(const double fr_recv_timestamp, const double fr_handling_time, const uint32_t fr_size)
Definition utilities.cpp:117
uint64_t GetTotalFrameCount() const
Get the total number of frames handled.
Definition utilities.cpp:170
uint64_t p_frame_count
Definition utilities.hpp:106
uint64_t GetSkippedFrames() const
Get the number of skipped frames.
Definition utilities.cpp:247
void Reset(double deferred_start_time=0.)
Definition utilities.cpp:79
Definition appBase.cpp:10
std::string PackParameters(const ifw::core::utils::param::ParameterSet &parameters)
Serialise the parameters contained in the parameter set.
Definition utilities.cpp:35
std::vector< std::string > get_call_stack(int max_frames=64)
Definition utilities.cpp:273
void UnpackParameters(const std::string &parameters, ifw::core::utils::param::ParameterSet &par_set)
Unpack the serialised parameters and store the information in the provided parameter set object.
Definition utilities.cpp:46
std::string GetImageDir()
Get the name of the image output folder.
Definition utilities.cpp:17