[ovs-discuss] Clear counters?

Justin Pettit jpettit at nicira.com
Sun Jul 17 07:48:42 UTC 2011


There's no explicit way to reset counters.  The primary reason is that ovs-ofctl uses OpenFlow to communicate with ovs-vswitchd.  It's possible to have multiple controllers attached to the same datapath, and we didn't want to have to maintain separate "views" for each controller.  This becomes especially difficult when you have ephemeral "controllers" like ovs-ofctl.  We assume that if controllers need to "reset" counters, they maintain a watermark of the current count and do some subtraction.

That said, looking at the source code for replace-flows, it appears that it's doing an OFPFC_ADD which should be resetting the counters for existing entries.  Had it been an OFPFC_MODIFY, then it would maintain the existing counters.  (If you're interested, it's in section 4.6 of the OpenFlow spec.)  I'm seeing some odd behavior when I OFPFC_ADD an existing flow in the master branch, which I believe is a bug in OVS.  What version of OVS are you running?  I'm not sure if it's the same problem, but we may need to check these corner-y cases.

--Justin


On Jul 16, 2011, at 11:50 AM, Jed Daniels wrote:

> Forgive me if this is simple an RTFM question, I've looked in the FM
> (man pages, etc.), and if it is in there, I must have missed it. Just
> point me to the right place and I'll look it up:
> 
> Is it possible to reset the packet and byte counters for a flow, or
> even for all flows? E.g. when I do "ovs-ofctl dump-flows <bridge>", I
> see the n_packets and n_bytes counters:
> 
> NXST_FLOW reply (xid=0x4):
> cookie=0xffff, duration=523.756s, table_id=0, n_packets=1001172,
> n_bytes=98114856, priority=65534 actions=drop
> 
> I'd like to reset them to zero, so I can see what the current numbers
> are (since ovs-ofctl replace-flows doesn't reset the counters when I
> change the flows, those numbers are "stale", because they are actually
> for a different action).
> 
> Thanks,
> 
> --jed
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss




More information about the discuss mailing list