23 #ifndef BM_BM_SIM_EVENT_LOGGER_H_
24 #define BM_BM_SIM_EVENT_LOGGER_H_
26 #include <bm/config.h>
32 #include "device_id.h"
33 #include "phv_forward.h"
34 #include "transport.h"
46 class MatchTableAbstract;
54 using entry_handle_t = uint32_t;
71 explicit EventLogger(std::unique_ptr<TransportIface> transport,
72 device_id_t device_id = 0)
73 : transport_instance(std::move(transport)), device_id(device_id) { }
81 void parser_start(
const Packet &packet,
const Parser &parser);
82 void parser_done(
const Packet &packet,
const Parser &parser);
83 void parser_extract(
const Packet &packet, header_id_t header);
85 void deparser_start(
const Packet &packet,
const Deparser &deparser);
86 void deparser_done(
const Packet &packet,
const Deparser &deparser);
87 void deparser_emit(
const Packet &packet, header_id_t header);
89 void checksum_update(
const Packet &packet,
const Checksum &checksum);
91 void pipeline_start(
const Packet &packet,
const Pipeline &pipeline);
92 void pipeline_done(
const Packet &packet,
const Pipeline &pipeline);
94 void condition_eval(
const Packet &packet,
95 const Conditional &cond,
bool result);
96 void table_hit(
const Packet &packet,
97 const MatchTableAbstract &table, entry_handle_t handle);
98 void table_miss(
const Packet &packet,
const MatchTableAbstract &table);
100 void action_execute(
const Packet &packet,
101 const ActionFn &action_fn,
const ActionData &action_data);
103 void config_change();
106 static EventLogger event_logger(TransportIface::make_dummy());
107 return &event_logger;
110 static void init(std::unique_ptr<TransportIface> transport,
111 device_id_t device_id = 0) {
112 get()->transport_instance = std::move(transport);
113 get()->device_id = device_id;
117 std::unique_ptr<TransportIface> transport_instance{
nullptr};
118 device_id_t device_id{};
131 #define BMELOG(fn, ...) bm::EventLogger::get()->fn(__VA_ARGS__)
133 #define BMELOG(fn, ...)
136 #endif // BM_BM_SIM_EVENT_LOGGER_H_