9 #include "serializer.h"
12 using namespace std::chrono;
14 extern steady_clock::time_point start;
18 if (--limit_left > 0) {
21 dprintf("Done in %.1f ms, found %" PRId64 " matches.\n",
22 1e3 * duration<float>(steady_clock::now() - start).count(), limit_matches);
24 printf("%" PRId64 "\n", limit_matches);
29 void Serializer::print(uint64_t seq, uint64_t skip, const string msg)
38 if (next_seq != seq) {
39 pending.push(Element{ seq, skip, move(msg) });
45 printf("%s%c", msg.c_str(), 0);
47 printf("%s\n", msg.c_str());
53 // See if any delayed prints can now be dealt with.
54 while (!pending.empty() && pending.top().seq == next_seq) {
55 if (!pending.top().msg.empty()) {
57 printf("%s%c", pending.top().msg.c_str(), 0);
59 printf("%s\n", pending.top().msg.c_str());
63 next_seq += pending.top().skip;