diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-02-22 13:44:45 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-02-22 13:44:45 +0100 |
commit | ec36f93ef364f4f7724a459539dcd10daaea3420 (patch) | |
tree | b99548c1179e07b0be462f91d3eed20b067f7ee1 /include | |
parent | a7368c39959b697ab7cc15ca0c5ea4ec0d865c6a (diff) |
Add PTALog class
Diffstat (limited to 'include')
-rw-r--r-- | include/object/ptalog.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/object/ptalog.h b/include/object/ptalog.h new file mode 100644 index 0000000..6b00e78 --- /dev/null +++ b/include/object/ptalog.h @@ -0,0 +1,51 @@ +#ifndef PTALOG_H +#define PTALOG_H + +#include <stdlib.h> +#include "driver/stdout.h" + +class PTALog { + public: + typedef struct { + uint8_t transition_id; + } log_entry; + + log_entry log[32]; + uint8_t log_index; + + PTALog() : log_index(0) {} + + void passTransition(uint8_t transition_id) + { + log[log_index].transition_id = transition_id; + log_index++; + } + + void reset() + { + log_index = 0; + } + + void startBenchmark(uint8_t id) + { + kout << "[PTA] benchmark start, id=" << dec << id << endl; + } + + void stopBenchmark() + { + kout << "[PTA] benchmark stop" << endl; + } + + void dump() + { + kout << "[PTA] trace, count=" << dec << log_index << endl; + for (uint8_t i = 0; i < log_index; i++) { + kout << "[PTA] transition=" << log[i].transition_id << endl; + } + } + + private: + PTALog(const PTALog& copy); +}; + +#endif |