Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMemoryStatisticsServer Class Reference

#include <kis_memory_statistics_server.h>

+ Inheritance diagram for KisMemoryStatisticsServer:

Classes

struct  Statistics
 

Public Slots

void notifyImageChanged ()
 
void tryForceUpdateMemoryStatisticsWhileIdle ()
 

Signals

void sigUpdateMemoryStatistics ()
 

Public Member Functions

Statistics fetchMemoryStatistics (KisImageSP image) const
 
 KisMemoryStatisticsServer ()
 
 Private (KisMemoryStatisticsServer *q)
 
 ~KisMemoryStatisticsServer () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Static Public Member Functions

static KisMemoryStatisticsServerinstance ()
 

Public Attributes

KisSignalCompressor updateCompressor
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Private Attributes

const QScopedPointer< Privatem_d
 

Detailed Description

Definition at line 20 of file kis_memory_statistics_server.cpp.

Constructor & Destructor Documentation

◆ KisMemoryStatisticsServer()

KisMemoryStatisticsServer::KisMemoryStatisticsServer ( )

The first instance() call may happen from non-gui thread, so we should ensure the signals and timers are running in the correct (GUI) thread.

Definition at line 31 of file kis_memory_statistics_server.cpp.

32 : m_d(new Private(this))
33{
39 moveToThread(qApp->thread());
40 connect(&m_d->updateCompressor, SIGNAL(timeout()), SIGNAL(sigUpdateMemoryStatistics()));
41}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
const QScopedPointer< Private > m_d

References connect(), m_d, and sigUpdateMemoryStatistics().

◆ ~KisMemoryStatisticsServer()

KisMemoryStatisticsServer::~KisMemoryStatisticsServer ( )
override

Definition at line 43 of file kis_memory_statistics_server.cpp.

44{
45}

Member Function Documentation

◆ fetchMemoryStatistics()

KisMemoryStatisticsServer::Statistics KisMemoryStatisticsServer::fetchMemoryStatistics ( KisImageSP image) const

Definition at line 128 of file kis_memory_statistics_server.cpp.

129{
132
133 Statistics stats;
134 if (image) {
135 stats.imageSize =
137 stats.layersSize,
138 stats.projectionsSize,
139 stats.lodSize);
140 }
141 stats.totalMemorySize = tileStats.totalMemorySize;
142 stats.realMemorySize = tileStats.realMemorySize;
143 stats.historicalMemorySize = tileStats.historicalMemorySize;
144 stats.poolSize = tileStats.poolSize;
145
146 stats.swapSize = tileStats.swapSize;
147
148 KisImageConfig cfg(true);
149
150 stats.tilesHardLimit = cfg.tilesHardLimit() * MiB;
151 stats.tilesSoftLimit = cfg.tilesSoftLimit() * MiB;
152 stats.tilesPoolLimit = cfg.poolLimit() * MiB;
153 stats.totalMemoryLimit = stats.tilesHardLimit + stats.tilesPoolLimit;
154
155 return stats;
156}
MemoryStatistics memoryStatistics()
static KisTileDataStore * instance()
#define MiB
qint64 calculateNodeMemoryHiBound(KisNodeSP node, qint64 &layersSize, qint64 &projectionsSize, qint64 &lodSize)

References calculateNodeMemoryHiBound(), KisMemoryStatisticsServer::Statistics::historicalMemorySize, KisTileDataStore::MemoryStatistics::historicalMemorySize, KisMemoryStatisticsServer::Statistics::imageSize, KisTileDataStore::instance(), KisMemoryStatisticsServer::Statistics::layersSize, KisMemoryStatisticsServer::Statistics::lodSize, KisTileDataStore::memoryStatistics(), MiB, KisImageConfig::poolLimit(), KisMemoryStatisticsServer::Statistics::poolSize, KisTileDataStore::MemoryStatistics::poolSize, KisMemoryStatisticsServer::Statistics::projectionsSize, KisMemoryStatisticsServer::Statistics::realMemorySize, KisTileDataStore::MemoryStatistics::realMemorySize, KisNodeFacade::root, KisMemoryStatisticsServer::Statistics::swapSize, KisTileDataStore::MemoryStatistics::swapSize, KisImageConfig::tilesHardLimit(), KisMemoryStatisticsServer::Statistics::tilesHardLimit, KisMemoryStatisticsServer::Statistics::tilesPoolLimit, KisImageConfig::tilesSoftLimit(), KisMemoryStatisticsServer::Statistics::tilesSoftLimit, KisMemoryStatisticsServer::Statistics::totalMemoryLimit, KisMemoryStatisticsServer::Statistics::totalMemorySize, and KisTileDataStore::MemoryStatistics::totalMemorySize.

◆ instance()

KisMemoryStatisticsServer * KisMemoryStatisticsServer::instance ( )
static

Definition at line 47 of file kis_memory_statistics_server.cpp.

48{
49 return s_instance;
50}

◆ notifyImageChanged

void KisMemoryStatisticsServer::notifyImageChanged ( )
slot

Definition at line 164 of file kis_memory_statistics_server.cpp.

165{
166 m_d->updateCompressor.start();
167}

References m_d.

◆ Private()

KisMemoryStatisticsServer::Private ( KisMemoryStatisticsServer * q)
inline

◆ sigUpdateMemoryStatistics

void KisMemoryStatisticsServer::sigUpdateMemoryStatistics ( )
signal

◆ tryForceUpdateMemoryStatisticsWhileIdle

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisMemoryStatisticsServer::m_d
private

Definition at line 81 of file kis_memory_statistics_server.h.

◆ updateCompressor

KisSignalCompressor KisMemoryStatisticsServer::updateCompressor

Definition at line 27 of file kis_memory_statistics_server.cpp.


The documentation for this class was generated from the following files: