ifw-ccf 5.0.2
Loading...
Searching...
No Matches
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 <execinfo.h>
9#include <string>
10
11#include <ifw/core/utils/param/parameterSet.hpp>
12
13
14namespace ifw::ccf::common {
15
17 std::string GetImageDir();
18
20 std::string PackParameters(const ifw::core::utils::param::ParameterSet& parameters);
21
23 void UnpackParameters(const std::string& parameters,
24 ifw::core::utils::param::ParameterSet& par_set);
25
28 public:
31
34 void Reset(double deferred_start_time=0.);
35
37 void SetNbOfSamples(const uint16_t nb);
38
41 void Update(const double fr_recv_timestamp,
42 const double fr_handling_time,
43 const uint32_t fr_size);
44
46 void SetLostFramesCounter(const uint64_t lost_frames);
47
49 uint64_t IncSkippedFramesCounter();
50
52 void GetDataSnapshot(FrameStatistics& trg_obj) const;
53
55 std::string GetId() const;
56
58 uint16_t GetNbOfSamples() const;
59
61 double GetStartTime() const;
62
64 double GetLastUpdate() const;
65
67 double GetTimeFirstFrame() const;
68
70 uint64_t GetFrameCount() const;
71
73 uint64_t GetTotalFrameCount() const;
74
76 uint64_t GetVolume() const;
77
79 uint64_t GetSkippedFrames() const;
80
82 uint64_t GetLostFrames() const;
83
85 const std::vector<double>& GetFrRecvTimestamps() const;
86
88 const std::vector<uint64_t>& GetFrRecvFrCounts() const;
89
91 const std::vector<double>& GetFrHandlingTimes() const;
92
94 std::string ToString() const;
95
97
98 protected:
99 std::string p_id;
100 uint16_t p_nb_samples;
101
102 double p_start_time{0};
104 uint64_t p_frame_count{0};
106 uint64_t p_volume{0};
107 uint64_t p_lost_frames{0};
108 uint64_t p_skipped_frames{0};
109 std::vector<double> p_fr_recv_timestamps;
111 std::vector<uint64_t> p_fr_recv_fr_counts;
112 std::vector<double> p_fr_handling_times;
113
114 private:
115
116 };
117
118
119 // TODO: Move to ifw-fnd.
120 std::vector<std::string> get_call_stack(int max_frames = 64);
121
122}
123
124#endif // CCF_COMMON_UTILITIES_HPP_H_
Class used by the threads to store info for generating performance statistics.
Definition utilities.hpp:27
void SetLostFramesCounter(const uint64_t lost_frames)
Set the lost frames counter.
Definition utilities.cpp:233
double p_start_time
Definition utilities.hpp:102
uint64_t p_lost_frames
Definition utilities.hpp:107
std::vector< double > p_fr_handling_times
Definition utilities.hpp:112
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:109
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:100
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:99
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:103
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:108
double p_first_recv_time
Definition utilities.hpp:110
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:105
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:111
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:106
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:104
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:9
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