Skip to content

Commit c5b888c

Browse files
committed
add time measurements to proof compression output
1 parent 652a46f commit c5b888c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

metamath/DRuleParser.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ using namespace xamidi::logic;
2020
namespace xamidi {
2121
namespace metamath {
2222

23+
namespace {
24+
inline string myTime() {
25+
time_t time = chrono::system_clock::to_time_t(chrono::system_clock::now());
26+
return strtok(ctime(&time), "\n");
27+
}
28+
}
29+
2330
vector<string> DRuleParser::readFromMmsolitaireFile(const string& file, vector<string>* optOut_dProofNamesInFile, bool debug) {
2431
vector<string> dProofsInFile;
2532
chrono::time_point<chrono::steady_clock> startTime;
@@ -2024,7 +2031,8 @@ void DRuleParser::compressAbstractDProof(vector<string>& retractedDProof, vector
20242031
iota(allIndices.begin(), allIndices.end(), 0);
20252032
vector<size_t> fundamentalLengths = measureFundamentalLengthsInAbstractDProof(allIndices, retractedDProof, abstractDProofConclusions, helperRules, helperRulesConclusions);
20262033
//#cout << "fundamentalLengths = " << FctHelper::vectorString(fundamentalLengths) << endl;
2027-
cout << "[Proof compression (rule search), round " << compressionRound << "] Started. There are " << accumulate(fundamentalLengths.begin(), fundamentalLengths.end(), 0uLL) << " proof steps in total." << (concurrentDRuleSearch ? " Using up to " + to_string(thread::hardware_concurrency()) + " hardware thread contexts for D-rule replacement search." : "") << endl;
2034+
chrono::time_point<chrono::steady_clock> startTime = chrono::steady_clock::now();
2035+
cout << "[Proof compression (rule search), round " << compressionRound << "] " << myTime() << ": Started. There are " << accumulate(fundamentalLengths.begin(), fundamentalLengths.end(), 0uLL) << " proof steps in total." << (concurrentDRuleSearch ? " Using up to " + to_string(thread::hardware_concurrency()) + " hardware thread contexts for D-rule replacement search." : "") << endl;
20282036

20292037
// 3. Group elements based on fundamental lengths.
20302038
map<size_t, vector<size_t>> indicesByLen;
@@ -2216,7 +2224,7 @@ void DRuleParser::compressAbstractDProof(vector<string>& retractedDProof, vector
22162224
}
22172225
}
22182226

2219-
cout << "[Proof compression (rule search), round " << compressionRound << "] Complete. Applied " << newImprovements << " shortening replacement" << (newImprovements == 1 ? "" : "s") << "." << endl;
2227+
cout << "[Proof compression (rule search), round " << compressionRound << "] " << myTime() << ": Complete after " << FctHelper::durationStringMs(chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now() - startTime)) << ". Applied " << newImprovements << " shortening replacement" << (newImprovements == 1 ? "" : "s") << "." << endl;
22202228
compressionRound++;
22212229
} while (newImprovements);
22222230

0 commit comments

Comments
 (0)