Mercurial > hg > svcore
diff base/StorageAdviser.cpp @ 383:94fc0591ea43 1.2-stable
* merge from trunk (1.2 ended up being tracked from trunk, but we may want
this branch for fixes later)
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 10:32:45 +0000 |
parents | aa8dbac62024 |
children |
line wrap: on
line diff
--- a/base/StorageAdviser.cpp Fri Nov 30 17:36:14 2007 +0000 +++ b/base/StorageAdviser.cpp Wed Feb 27 10:32:45 2008 +0000 @@ -22,6 +22,8 @@ #include <iostream> +//#define DEBUG_STORAGE_ADVISER 1 + long StorageAdviser::m_discPlanned = 0; long StorageAdviser::m_memoryPlanned = 0; @@ -30,9 +32,11 @@ int minimumSize, int maximumSize) { +#ifdef DEBUG_STORAGE_ADVISER std::cerr << "StorageAdviser::recommend: Criteria " << criteria << ", minimumSize " << minimumSize << ", maximumSize " << maximumSize << std::endl; +#endif QString path = TempDirectory::getInstance()->getPath(); int discFree = GetDiscSpaceMBAvailable(path.toLocal8Bit()); @@ -51,7 +55,9 @@ memoryFree = 0; } +#ifdef DEBUG_STORAGE_ADVISER std::cerr << "Disc space: " << discFree << ", memory free: " << memoryFree << ", memory total: " << memoryTotal << ", min " << minimumSize << ", max " << maximumSize << std::endl; +#endif //!!! We have a potentially serious problem here if multiple //recommendations are made in advance of any of the resulting @@ -77,6 +83,7 @@ else if (minmb > (memoryFree / 3)) memoryStatus = Marginal; else if (memoryTotal == -1 || minmb > (memoryTotal / 10)) memoryStatus = Marginal; + else if (memoryFree < memoryTotal / 4) memoryStatus = Marginal; else memoryStatus = Sufficient; if (discFree == -1) discStatus = Unknown; @@ -85,8 +92,10 @@ else if (minmb > (discFree / 10)) discStatus = Marginal; else discStatus = Sufficient; +#ifdef DEBUG_STORAGE_ADVISER std::cerr << "Memory status: " << memoryStatus << ", disc status " << discStatus << std::endl; +#endif int recommendation = NoRecommendation;