# Obtaining More Accurate Timestamps from simple\_switch Logs for bmV2

**URL:** <https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76>\
**Category:** Architecture Working Group\
**Created:** [June 17, 2021, 1:28pm UTC](https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76 "2021-06-17T13:28:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mharrist](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mharrist](https://forum.p4.org/u/mharrist)\
**Post date:** [June 17, 2021, 1:28pm UTC](https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76/1 "2021-06-17T13:28:40Z")

</div>

Hi,

Is there any way to get more accurate timestamps for the simple\_switch logs?

For example, take a look at the logs below:

> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Processing packet received on port 2  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Parser ‘parser’: start  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Parser ‘parser’ entering state ‘start’  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Extracting header ‘ethernet’  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Parser state ‘start’: key is 0027  
> [16:24:38.133] [bmv2] [T] [thread 28315] [794.0] [cxt 0] Bytes parsed: 14  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Parser ‘parser’: end  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Pipeline ‘ingress’: start  
> [16:24:38.133] [bmv2] [T] [thread 28315] [794.0] [cxt 0] Applying table ‘MyIngress.phy\_forward’  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Looking up key:
> 
> - standard\_metadata.ingress\_port: 0002
> 
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Table ‘MyIngress.phy\_forward’: hit with handle 0  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Dumping entry 0  
> Match key:
> 
> - standard\_metadata.ingress\_port: EXACT 0002  
> Action entry: MyIngress.forward - 1,
> 
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Action entry is MyIngress.forward - 1,  
> [16:24:38.133] [bmv2] [T] [thread 28315] [794.0] [cxt 0] Action MyIngress.forward  
> [16:24:38.133] [bmv2] [T] [thread 28315] [794.0] [cxt 0] parsertest.p4(220) Primitive standard\_metadata.egress\_spec = port  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Pipeline ‘ingress’: end  
> [16:24:38.133] [bmv2] [D] [thread 28315] [794.0] [cxt 0] Egress port is 1  
> [16:24:38.133] [bmv2] [D] [thread 28317] [794.0] [cxt 0] Pipeline ‘egress’: start  
> [16:24:38.133] [bmv2] [D] [thread 28317] [794.0] [cxt 0] Pipeline ‘egress’: end  
> [16:24:38.133] [bmv2] [D] [thread 28317] [794.0] [cxt 0] Deparser ‘deparser’: start  
> [16:24:38.133] [bmv2] [D] [thread 28317] [794.0] [cxt 0] Deparsing header ‘ethernet’  
> [16:24:38.133] [bmv2] [D] [thread 28317] [794.0] [cxt 0] Deparser ‘deparser’: end  
> [16:24:38.133] [bmv2] [D] [thread 28320] [794.0] [cxt 0] Transmitting packet of size 60 out of port 1

As of now, each process of the bmv2 is timestamped to milliseconds. Is there any way to obtain much more accurate timestamps that is precise upto micro or nano seconds?

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [June 27, 2021, 3:43pm UTC](https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76/2 "2021-06-27T15:43:51Z")

</div>

The only way I know to do this would be to modify the source code of BMv2, recompile it, and install that modified binary on your system.

---

<div class="post-metadata">

**Author:** ![mharrist](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mharrist](https://forum.p4.org/u/mharrist)\
**Post date:** [July 5, 2021, 10:59am UTC](https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76/3 "2021-07-05T10:59:13Z")

</div>

Oh I see. Thank you very much. Are there any ongoing projects for making bmv2 production grade?

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [July 5, 2021, 3:17pm UTC](https://forum.p4.org/t/obtaining-more-accurate-timestamps-from-simple-switch-logs-for-bmv2/76/4 "2021-07-05T15:17:35Z")

</div>

It depends on what you mean by “production grade”. If you mean “intended to forward packets in a production environment, as efficiently as any other software switch can do”, then I suspect the answer is “no”. There are significant development efforts being put right now into the open source p4c compiler’s DPDK back end, I believe with the intent of making it become useful in production scenarios.
