1 #include "serializer.h"
13 using namespace std::chrono;
15 extern steady_clock::time_point start;
19 if (--limit_left > 0) {
22 dprintf("Done in %.1f ms, found %" PRId64 " matches.\n",
23 1e3 * duration<float>(steady_clock::now() - start).count(), limit_matches);
25 printf("%" PRId64 "\n", limit_matches);
30 void Serializer::print(uint64_t seq, uint64_t skip, const string msg)
39 if (next_seq != seq) {
40 pending.push(Element{ seq, skip, move(msg) });
46 printf("%s%c", msg.c_str(), 0);
48 printf("%s\n", msg.c_str());
54 // See if any delayed prints can now be dealt with.
55 while (!pending.empty() && pending.top().seq == next_seq) {
56 if (!pending.top().msg.empty()) {
58 printf("%s%c", pending.top().msg.c_str(), 0);
60 printf("%s\n", pending.top().msg.c_str());
64 next_seq += pending.top().skip;