Skip to content
Snippets Groups Projects
Commit c134a480 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: #1526: add a per-instance default ram value in StreamingManager

parent 24823227
No related branches found
No related tags found
No related merge requests found
......@@ -88,6 +88,9 @@ public:
* GetNumberOfSplits() returns. */
virtual RegionType GetSplit(unsigned int i);
itkSetMacro(DefaultRAM, MemoryPrintType);
itkGetMacro(DefaultRAM, MemoryPrintType);
protected:
StreamingManager();
~StreamingManager() ITK_OVERRIDE;
......@@ -111,11 +114,13 @@ private:
StreamingManager(const StreamingManager &); //purposely not implemented
void operator =(const StreamingManager&); //purposely not implemented
/* Compute the available RAM from configuration settings if the input parameter is 0,
* otherwise, simply returns the input parameter */
/** Compute the available RAM in Bytes from an input value in MByte.
* If the input value is 0, it uses the m_DefaultRAM value.
* If m_DefaultRAM is also 0, it uses the configuration settings */
MemoryPrintType GetActualAvailableRAMInBytes(MemoryPrintType availableRAMInMB);
/** Default available RAM in MB */
MemoryPrintType m_DefaultRAM;
};
} // End namespace otb
......
......@@ -31,6 +31,7 @@ namespace otb
template <class TImage>
StreamingManager<TImage>::StreamingManager()
: m_ComputedNumberOfSplits(0)
, m_DefaultRAM(0)
{
}
......@@ -47,9 +48,16 @@ StreamingManager<TImage>::GetActualAvailableRAMInBytes(MemoryPrintType available
if (availableRAMInBytes == 0)
{
otbMsgDevMacro(<< "Retrieving available RAM size from configuration");
// Retrieve it from the configuration
availableRAMInBytes = 1024*1024*ConfigurationManager::GetMaxRAMHint();
if (m_DefaultRAM != 0)
{
availableRAMInBytes = 1024*1024*m_DefaultRAM;
}
else
{
otbMsgDevMacro(<< "Retrieving available RAM size from configuration");
// Retrieve it from the configuration
availableRAMInBytes = 1024*1024*ConfigurationManager::GetMaxRAMHint();
}
}
otbMsgDevMacro("RAM used to estimate memory footprint : " << availableRAMInBytes / 1024 / 1024 << " MB")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment