summaryrefslogtreecommitdiff
path: root/include/object/ptalog.h
blob: 6b00e78f48a83fe6e00e941d26692307e24c5657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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