Datagen #46
+8
-2
@@ -150,7 +150,7 @@ static void WriteToFile(const Game &game, const std::string &filename) {
|
||||
file.close();
|
||||
}
|
||||
|
||||
void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch) {
|
||||
void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch, int threads) {
|
||||
double elapsed = stopwatch.GetElapsedSec();
|
||||
double positionsPerSec = elapsed > 0 ? positions / elapsed : 0;
|
||||
|
||||
@@ -190,6 +190,12 @@ void PrintProgress(int positions, int targetPositions, Stopwatch &stopwatch) {
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
std::string threadsText = "Threads: " + std::to_string(static_cast<int>(threads));
|
||||
int threadsTextPadding = (width - threadsText.length()) / 2;
|
||||
std::cout << std::setw(threadsTextPadding + threadsText.length()) << threadsText << std::endl;
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
int barWidth = 50;
|
||||
double progress = (double)positions / targetPositions;
|
||||
int pos = (int)(progress * barWidth);
|
||||
@@ -268,7 +274,7 @@ void Run(int targetPositions, int threads) {
|
||||
|
||||
if (positions / 100 > lastPrintedPosition) {
|
||||
lastPrintedPosition = positions / 1000;
|
||||
PrintProgress(positions, targetPositions * 1000000, stopwatch);
|
||||
PrintProgress(positions, targetPositions * 1000000, stopwatch, threads);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user