Dear @1418915702,
The number of SRAM and TCAM blocks (as well as other resources) occupied by each table is determined during the program compilation and does not change afterwards. If these are the numbers you are after, the information can be easily obtained.
If you have access to the original Intel P4 Studio SDE (the latest version being SDE-9.13.4), it includes the tool, called P4Insight (p4i) that shows this in great detail (as well as a lot of other useful information).
If you have access to Open-P4Studio only, you will need to rely on the compiler log files, that contain most of this information, either in text or in JSON format.
Make sure you compile your program using -g command line parameter and then look inside the output directory (myprog.tofino). you will see a directory named pipe/logs that contain all the compiler log files. Note, that the name pipe is actually the name of your Pipeline() package instance, so if you named it differently, then adjust the name accordingly.
Here is what you’ll see:
$ bf-p4c -g myprog.p4
$ ls myprog.tofino/pipe/logs/
flexible_packing.log phv_allocation_3.log resources_deparser.json
mau.characterize.log phv_allocation_6.log table_dependency_graph.log
mau.json phv_allocation_history_0.log table_dependency_summary.log
mau.resources.log phv_allocation_history_3.log table_placement_1.log
metrics.json phv_allocation_history_6.log table_placement_2.log
pa.characterize.log phv_allocation_summary_0.log table_placement_4.log
pa.results.log phv_allocation_summary_3.log table_placement_5.log
parser.characterize.log phv_allocation_summary_6.log table_placement_7.log
parser.log power.json table_summary.log
phv.json pragmas.log
phv_allocation_0.log resources.json
The main files that contain the information you are looking for are:
mau.characterize.log(text version) /mau.json(machine-readable JSON)mau.resources.log
Please note that this information is static: when entries are placed into the tables at run time, the resources for those tables have already been allocated and thus the entries do not occupy any additional resources beyond that. The actual placement (physical addresses) of the individual entries is transparent, depends on a lot of circumstances, and there is no easy way to get it. Most importantly, it should not matter.
Just to re-iterate, you do not need to actually run the program to see this information – you only need to compile it.
Happy hacking,
Vladimir
PS: You might consider making your handle a little more human-readable, so that we can address you by name and not by some random number ![]()