Extending stat printing with hit/miss info
@@ -81,14 +81,26 @@ for name in parser_state_names:
#[ stats_counter = 0;
#[ bool is_used;
+#[ bool is_hit;
+#[ bool is_miss;
#[ bool is_hidden;
#[ bool cond;
for table in hlir.tables:
+ #[ is_hit = (is_on && t4p4s_stats->table_hit__${table.name}) || (!is_on && !t4p4s_stats->table_hit__${table.name});
+ #[ is_miss = (is_on && t4p4s_stats->table_miss__${table.name}) || (!is_on && !t4p4s_stats->table_miss__${table.name});
+ #[ if (hidden) {
#[ is_used = t4p4s_stats->table_apply__${table.name};
+ #[ } else {
+ #[ is_used = !(is_on ^ (is_hit || is_miss));
+ #[ }
#[ is_hidden = ${"true" if table.is_hidden else "false"};
#[ cond = !(is_used ^ is_on) && !(hidden ^ is_hidden);
#{ if (cond) {
+ #[ if (hidden) {
#[ printout += sprintf(printout, "$$[table]{table.name}, ");
+ #[ } else {
+ #[ printout += sprintf(printout, "$$[table]{table.name}[%s%s], ", is_hit ? "hit": "", is_miss ? "miss": "");
+ #[ }
#[ ++stats_counter;
#} }
