CCIMXDesktop
 
Loading...
Searching...
No Matches
MemoryInfoFetcher.h
1#ifndef MEMORYINFOFETCHER_H
2#define MEMORYINFOFETCHER_H
3
4#include <QObject>
5#include <QTimer>
6
7/* Forward declaration of the driver */
9
15class MemoryInfoFetcher : public QObject {
16 Q_OBJECT
17public:
24 static QString format_size(quint64 size);
25
30 explicit MemoryInfoFetcher(QObject* parent = nullptr);
31
41
52
58 void set_flush_freq(const int msecs) { flush_msecs = msecs; }
59
65 void set_capture_state(bool st);
66
67signals:
74
75private slots:
80 void flush_once();
81
82private:
83 CCIMX_AbstractMemoryInfoDriver* platform_driver_base { nullptr };
84
89 void setup_platform_relative();
90
91 QTimer flush_timer;
92 int flush_msecs { 1500 };
93};
94
101public:
103 virtual ~CCIMX_AbstractMemoryInfoDriver() = default;
104
110 virtual void factory(MemoryInfoFetcher::MemoryStat& stat) = 0;
111};
112
113#endif // MEMORYINFOFETCHER_H
The CCIMX_AbstractMemoryInfoDriver class Abstract base class for platform-specific memory information...
Definition MemoryInfoFetcher.h:100
virtual void factory(MemoryInfoFetcher::MemoryStat &stat)=0
factory Populate the MemoryStat structure with current memory info.
The MemoryInfoFetcher class Provides memory usage information in a platform-independent manner....
Definition MemoryInfoFetcher.h:15
Q_DISABLE_COPY(MemoryInfoFetcher)
disable copy
static QString format_size(quint64 size)
format_size Utility function to format byte size into human-readable string.
Definition MemoryInfoFetcher.cpp:8
~MemoryInfoFetcher()
Destructor to clean up resources.
Definition MemoryInfoFetcher.cpp:27
void finish_detect_memory(const MemoryInfoFetcher::MemoryStat &mem_stat)
finish_detect_memory Signal emitted when memory information is updated.
struct MemoryInfoFetcher::MemoryStat mem_stat
memory stat holder
void set_capture_state(bool st)
set_capture_state Enables or disables memory information capturing.
Definition MemoryInfoFetcher.cpp:34
void set_flush_freq(const int msecs)
set_flush_freq Sets the frequency in milliseconds at which memory info is refreshed.
Definition MemoryInfoFetcher.h:58
The MemoryStat struct Holds memory statistics at the byte level.
Definition MemoryInfoFetcher.h:46
quint64 avail_virt_memory
Available virtual memory in bytes.
Definition MemoryInfoFetcher.h:50
quint64 total_virt_memory
Total virtual memory in bytes.
Definition MemoryInfoFetcher.h:49
quint64 total_phys_memory
Total physical memory in bytes.
Definition MemoryInfoFetcher.h:47
quint64 avail_phys_memory
Available physical memory in bytes.
Definition MemoryInfoFetcher.h:48