Print suggestion messages related to the use of --disable-blocklist-prefetch

master
Rogier 2015-03-10 13:25:38 +01:00
parent 0a5e24b7d7
commit 2ca8ce4c53
4 changed files with 53 additions and 4 deletions

View File

@ -1908,6 +1908,50 @@ void TileGenerator::renderMap()
}
if (progressIndicator && eraseProgress)
cout << std::setw(50) << "" << "\r";
if (m_generateNoPrefetch) {
double queryFactor = 1.0 * m_db->getBlocksQueriedCount() / m_db->getBlocksReadCount();
if (verboseStatistics >= 4) {
std::cout << std::fixed << std::setprecision(2);
std::cout << "disable-blocklist-prefetch statistics:" << std::endl
<< " Query factor: " << queryFactor << std::endl;
}
if (!(m_silenceSuggestions & SUGGESTION_PREFETCH) && queryFactor >= 10) {
std::cout << std::fixed << std::setprecision(2);
std::cout << "NOTE: amount of database blocks queried exceeds amount read by a factor " << queryFactor << "." << std::endl
<< " This makes --disable-blocklist-prefetch rather inefficient. Consider disabling it, or" << std::endl
<< " adjusting the vertical limits (e.g. --min-y=" << m_YMinMapped * 16 << " --max-y=" << m_YMaxMapped*16+15 << ")" << std::endl;
}
}
else {
double blocksFractionMapped = 1.0 * m_db->getBlocksReadCount() / m_worldBlocks;
long long worldVolumeMapped = (m_xMax-m_xMin+1) * (m_zMax-m_zMin+1) * (m_YMaxMapped-m_YMinMapped+1);
if (verboseStatistics >= 4) {
std::cout << std::fixed << std::setprecision(2);
std::cout << "disable-blocklist-prefetch statistics:" << std::endl
<< " World size (1M Blocks): " << m_worldBlocks / 1000.0 / 1000
<< " (" << MIN_NOPREFETCH_VOLUME / 1000.0 / 1000 << " .. "
<< MAX_NOPREFETCH_VOLUME / 1000.0 / 1000 << ")" << std::endl
<< " Fraction of world blocks mapped: "
<< 100 * blocksFractionMapped << "% (limit: 10%)" << std::endl
<< " Volume mapped: "
<< worldVolumeMapped / 10000.0 << "% (" << worldVolumeMapped << ")" << std::endl;
}
if (!(m_silenceSuggestions & SUGGESTION_PREFETCH)
&& m_worldBlocks >= MIN_NOPREFETCH_VOLUME
&& blocksFractionMapped < 0.1
&& worldVolumeMapped < MAX_NOPREFETCH_VOLUME) {
std::cout << "NOTE: Mapping speed may improve using the option --disable-blocklist-prefetch,"
<< " combined with vertical limits (" << m_YMinMapped * 16 << " .. " << m_YMaxMapped*16+15 << ")" << std::endl;
if (m_backend == "leveldb") {
std::cout << " The option --database-format=" << (m_recommendedDatabaseFormat != "" ? m_recommendedDatabaseFormat : "mixed")
<< " is also required for the (current) leveldb backend." << std::endl
<< " Use --verbose=2 or --database-format=query for details" << std::endl;
}
}
}
}
Color TileGenerator::computeMapHeightColor(int height)

View File

@ -55,6 +55,7 @@
#define HEIGHTSCALESIZE 60
#define SUGGESTION_ALL 0xffffffff
#define SUGGESTION_PREFETCH 0x00000001
class TileGenerator
{

View File

@ -282,7 +282,7 @@ Feedback / information options:
* ``--version`` : Print version ID of minetestmapper
* ``--verbose[=<n>]`` : Report world and map statistics (size, dimensions, number of blocks)
* ``--verbose-search-colors[=n]`` : Report which colors files are used and/or which locations are searched
* ``--silence-suggestions all`` : Do not bother doing suggestions
* ``--silence-suggestions all,prefetch`` : Do not bother doing suggestions
* ``--progress`` : Show a progress indicator while generating the map
Miscellaneous options
@ -1056,7 +1056,7 @@ Detailed Description of Options
.. image:: images/drawscale-both.png
.. image:: images/sidescale-interval.png
``--silence-suggestions all``
``--silence-suggestions all,prefetch``
......................................
Do not print usage suggestions of the specified types.
@ -1064,6 +1064,8 @@ Detailed Description of Options
if that may be advantageous. This option disables such messages.
:all: Silence all existing (and future) suggestions there may be.
:prefetch: Do not make suggestions a about the use of --disable-blocklist-prefetch,
and adjustment of --min-y and --max-y when using --disable-blocklist-prefetch.
``--sqlite-cacheworldrow``
..........................
@ -1775,7 +1777,7 @@ More information is available:
.. _--origincolor: `--origincolor <color>`_
.. _--output: `--output <output_image.png>`_
.. _--playercolor: `--playercolor <color>`_
.. _--silence-suggestions: `--silence-suggestions all`_
.. _--silence-suggestions: `--silence-suggestions all,prefetch`_
.. _--scalecolor: `--scalecolor <color>`_
.. _--scalefactor: `--scalefactor 1:<n>`_
.. _--height-level-0: `--height-level-0 <level>`_

View File

@ -125,7 +125,7 @@ void usage()
" --tilecenter <x>,<y>|world|map\n"
" --scalefactor 1:<n>\n"
" --chunksize <size>\n"
" --silence-suggestions all\n"
" --silence-suggestions all,prefetch\n"
" --verbose[=n]\n"
" --verbose-search-colors[=n]\n"
" --progress\n"
@ -883,6 +883,8 @@ int main(int argc, char *argv[])
}
else if (flag == "all")
generator.setSilenceSuggestion(SUGGESTION_ALL);
else if (flag == "prefetch")
generator.setSilenceSuggestion(SUGGESTION_PREFETCH);
else {
std::cerr << "Invalid flag to '" << long_options[option_index].name << "': '" << flag << "'" << std::endl;
usage();