Hello everyone,
As you may see in the title, I am trying to obtain the time spent in the ingress control block of a packet. But I am not sure what is the best way to do (approximate) this.
What I can think of is by calculating: standard_metadata.egress_global_timestamp - standard_metadata.enq_timestamp.
Any idea or advice is greatly appreciated!
Dear @maxpeng,
I would recommend you read this post and edit your question accordingly, so that we can provide you with a proper answer.
Happy hacking,
Vladimir
Thank you for providing a clearer way to ask questions!
I am doing experiments using BMv2, which uses the V1Model.
I would like to also supply some more background information on why am I asking this question. I have implemented a sketch design that does the flow size estimation. All update or query operations are done within the ingress control block. Right now I need to know the time needed for a query operation, approximated if it’s infeasible to obtain the exact time. Since the query operation is done in the ingress control block, I believe the time of a query packet spent in the ingress control block can be regarded as the time needed for a query operation.
@maxpeng ,
Thank you for the clarification.
In this case, the best way to measure the time it took to process the packet in the ingress pipeline would be to subtract standard_metadata.ingress_global_timestamp
from standard_metadata.enq_timestamp
. Please, note that the former has the type bit<48>
, whereas the latter is a bit<32>
value, so casting will be needed.
Having said that, please be aware that due to the software nature of BMv2 and its overall architecture (that emphasizes fidelity and modularity rather than performance), that number will most probably be quite useless as will be most other performance measurements done on that target. Certainly, you can try to understand the performance of the program on the target in a given set of circumstances, but any conclusions you might draw from those numbers will probably be incorrect.
Happy hacking,
Vladimir
@p4prof ,
Thank you so much for your answer, it is quite inspiring.
Just one more thing, does this mean that any performance test like throughput or the query time that I have mentioned ought to be carried out on hardware switches like a Tofino switch?
Pretty much all throughput or latency tests will be specific to the target device on which you obtain them, and might not tell you much, if anything, that would help you predict performance on another different target device.
@andyfingerhut ,
I understand now. Thank you very much for this information!