I’m working with a P4 programmable switch (Intel Tofino-based) and using Open P4 Studio (SDE). I need to monitor the memory usage of my match-action tables, specifically the TCAM and SRAM utilization at the physical memory level, not just the number of entries installed.
I am aware that I can check the current number of entries via bfshell or bfrt commands like pm show table, but that only gives the logical occupancy (entries used vs. table size). What I really want is to see how much of the underlying TCAM and SRAM hardware blocks are actually occupied – for example, the percentage of TCAM banks used or SRAM slices consumed across different pipes.
I’ve tried using pm resource usage in ucli, which provides some high-level resource usage per pipe, but I’m not entirely sure if that reflects the real memory consumption of table entries, especially when tables have different widths or when multiple tables share the same memory pool.
My questions are:
-
Does Open P4 Studio (or the underlying BfRt/bfshell) provide a way to query the actual physical memory occupancy (TCAM/SRAM) by table entries?
-
If yes, what are the exact commands or APIs to retrieve this information?
-
Are there any differences between viewing per-table memory usage vs. overall chip memory usage?
-
Could anyone share examples or scripts that can help monitor these metrics dynamically?
Thanks in advance!
