#include "window.h" #include #include void observe_result(uint64_t sequence, CodeResult result) { printf("O %" PRIu64 " %d %" PRIu32 " %u\n", sequence, result.rc, result.value, result.retired); } static void observe_counters(uint64_t sequence, const CodeCounters *c) { printf("S %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64, sequence, c->serial, c->installs, c->patches); printf(" %" PRIu64 " %" PRIu64 " %" PRIu64, c->drops, c->executions, c->writes); printf(" %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", c->sync_calls, c->sync_words, c->rejected); } static void observe_slot(uint64_t sequence, unsigned index, const CodeSlot *slot) { printf("B %" PRIu64 " %u %u %u %" PRIu64 "\n", sequence, index, slot->active, slot->length, slot->generation); printf("D %" PRIu64 " %u", sequence, index); if (slot->active) { for (unsigned word = 0; word < slot->length && word < CW_CAPACITY; ++word) { printf(" %u", (unsigned)slot->data[word]); } } putchar('\n'); printf("X %" PRIu64 " %u", sequence, index); if (slot->active) { for (unsigned word = 0; word < slot->length && word < CW_CAPACITY; ++word) { printf(" %u", (unsigned)slot->execution[word]); } } putchar('\n'); } void observe_state(uint64_t sequence, const CodeWorkbench *work) { observe_counters(sequence, &work->counts); for (unsigned slot = 0; slot < CW_SLOTS; ++slot) { observe_slot(sequence, slot, &work->slots[slot]); } }