45 #include <OpenFlipper/Utils/Memory/RAMInfo.hh> 50 #define GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 51 #define GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 59 void MemInfoPlugin::pluginsInitialized() {
74 gpuMemBar_->setFormat(
"GPU Mem %p% %v/%m MB" );
108 MemInfoPlugin::MemInfoPlugin():
116 MemInfoPlugin::~MemInfoPlugin() {
124 GLint total_mem_kb = 0;
125 glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &total_mem_kb);
128 GLint cur_avail_mem_kb = 0;
129 glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &cur_avail_mem_kb);
131 gpuMemBar_->setRange( 0 , total_mem_kb/1024 );
132 gpuMemBar_->setValue( (total_mem_kb-cur_avail_mem_kb)/1024);
140 unsigned long totalRamMB = Utils::Memory::queryTotalRAM();
141 unsigned long freeRamMB = Utils::Memory::queryFreeRAM();
152 const int val = _bar->value();
153 const int maxVal = _bar->maximum();
156 float redPerc = (val > 0.5f*maxVal) ? 2.f*(val-0.5f*maxVal) : 0.f;
157 const quint32 red = 255.f*redPerc/maxVal;
158 const quint32 green = 255u-red;
159 const quint32 blue = 0u;
162 const quint32 color = (red<<16)+(green<<8)+blue;
163 _bar->setStyleSheet(QString(
" QProgressBar { border: 2px solid grey; border-radius: 2px; text-align: center; } QProgressBar::chunk {background-color: #%1; width: 1px;}").arg(color,6,16,QChar(
'0')));
void nvidiaMemoryInfoUpdate()
Update statusbar with NVIDIA memory infos.
void initializePlugin()
BaseInterface.
QProgressBar * mainMemBar_
Status bar for Main memory.
QTimer * updateTimer_
Timer that triggers an update of the bars.
QProgressBar * gpuMemBar_
Status bar for GPU memory.
void setProgressBarStyleSheet(QProgressBar *_bar)
Sets the Qt Stylesheet for the progress bars.
void cpuMemoryInfoUpdate()
Update statusbar with main memory infos.
bool checkExtensionSupported(const std::string &_extension)