mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 07:27:46 +00:00
Add max_count parameter to limit the number of positions read.
This commit is contained in:
@@ -4,6 +4,14 @@
|
|||||||
|
|
||||||
Simplest usage: `stockfish.exe gather_statistics all input_file a.binpack`
|
Simplest usage: `stockfish.exe gather_statistics all input_file a.binpack`
|
||||||
|
|
||||||
|
Any name that doesn't designate an argument name or is not an argument will be interpreted as a group name.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`input_file` - the path to the .bin or .binpack input file to read
|
||||||
|
|
||||||
|
`max_count` - the maximum number of positions to process. Default: no limit.
|
||||||
|
|
||||||
## Groups
|
## Groups
|
||||||
|
|
||||||
`all`
|
`all`
|
||||||
|
|||||||
+7
-3
@@ -125,7 +125,8 @@ namespace Learner::Stats
|
|||||||
|
|
||||||
void do_gather_statistics(
|
void do_gather_statistics(
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
std::vector<std::unique_ptr<StatisticGathererBase>>& statistic_gatherers)
|
std::vector<std::unique_ptr<StatisticGathererBase>>& statistic_gatherers,
|
||||||
|
std::uint64_t max_count)
|
||||||
{
|
{
|
||||||
Thread* th = Threads.main();
|
Thread* th = Threads.main();
|
||||||
Position& pos = th->rootPos;
|
Position& pos = th->rootPos;
|
||||||
@@ -154,7 +155,7 @@ namespace Learner::Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t num_processed = 0;
|
uint64_t num_processed = 0;
|
||||||
for (;;)
|
while (num_processed < max_count)
|
||||||
{
|
{
|
||||||
auto v = in->next();
|
auto v = in->next();
|
||||||
if (!v.has_value())
|
if (!v.has_value())
|
||||||
@@ -196,6 +197,7 @@ namespace Learner::Stats
|
|||||||
std::vector<std::unique_ptr<StatisticGathererBase>> statistic_gatherers;
|
std::vector<std::unique_ptr<StatisticGathererBase>> statistic_gatherers;
|
||||||
|
|
||||||
std::string input_file;
|
std::string input_file;
|
||||||
|
std::uint64_t max_count = std::numeric_limits<std::uint64_t>::max();
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
@@ -207,11 +209,13 @@ namespace Learner::Stats
|
|||||||
|
|
||||||
if (token == "input_file")
|
if (token == "input_file")
|
||||||
is >> input_file;
|
is >> input_file;
|
||||||
|
else if (token == "max_count")
|
||||||
|
is >> max_count;
|
||||||
else
|
else
|
||||||
registry.add_statistic_gatherers_by_group(statistic_gatherers, token);
|
registry.add_statistic_gatherers_by_group(statistic_gatherers, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_gather_statistics(input_file, statistic_gatherers);
|
do_gather_statistics(input_file, statistic_gatherers, max_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user