mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3050 Add memory count to progress dialog.
This commit is contained in:
@@ -42,9 +42,6 @@ add_library( ${PROJECT_NAME}
|
|||||||
cafVecIjk.cpp
|
cafVecIjk.cpp
|
||||||
cafVecIjk.h
|
cafVecIjk.h
|
||||||
|
|
||||||
cafMemoryInspector.cpp
|
|
||||||
cafMemoryInspector.h
|
|
||||||
|
|
||||||
${MOC_FILES_CPP}
|
${MOC_FILES_CPP}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,8 @@ set( PROJECT_FILES
|
|||||||
QMinimizePanel.h
|
QMinimizePanel.h
|
||||||
cafQTreeViewStateSerializer.h
|
cafQTreeViewStateSerializer.h
|
||||||
cafQTreeViewStateSerializer.cpp
|
cafQTreeViewStateSerializer.cpp
|
||||||
|
cafMemoryInspector.h
|
||||||
|
cafMemoryInspector.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library( ${PROJECT_NAME}
|
add_library( ${PROJECT_NAME}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
#include "cafAssert.h"
|
#include "cafAssert.h"
|
||||||
|
#include "cafMemoryInspector.h"
|
||||||
#include "cafProgressState.h"
|
#include "cafProgressState.h"
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
@@ -45,6 +46,8 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -181,6 +184,30 @@ namespace caf {
|
|||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString createMemoryLabelText()
|
||||||
|
{
|
||||||
|
uint64_t currentUsage = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB();
|
||||||
|
uint64_t totalPhysicalMemory = caf::MemoryInspector::getTotalPhysicalMemoryMiB();
|
||||||
|
|
||||||
|
float currentUsageFraction = 0.0f;
|
||||||
|
float availVirtualFraction = 1.0f;
|
||||||
|
if (currentUsage > 0u && totalPhysicalMemory > 0u)
|
||||||
|
{
|
||||||
|
currentUsageFraction = std::min(1.0f, static_cast<float>(currentUsage) / totalPhysicalMemory);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString labelText("\n ");
|
||||||
|
if (currentUsageFraction > 0.5)
|
||||||
|
{
|
||||||
|
labelText = QString("Memory Used: %1 MiB, Total Physical Memory: %2 MiB\n").arg(currentUsage).arg(totalPhysicalMemory);
|
||||||
|
}
|
||||||
|
return labelText;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -301,7 +328,7 @@ namespace caf {
|
|||||||
if (!descriptionStack()[i].isEmpty()) labelText += descriptionStack()[i];
|
if (!descriptionStack()[i].isEmpty()) labelText += descriptionStack()[i];
|
||||||
if (!(titleStack()[i].isEmpty() && descriptionStack()[i].isEmpty())) labelText += "\n";
|
if (!(titleStack()[i].isEmpty() && descriptionStack()[i].isEmpty())) labelText += "\n";
|
||||||
}
|
}
|
||||||
labelText += "\n ";
|
labelText += createMemoryLabelText();
|
||||||
return labelText;
|
return labelText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user