p4runtime-shell icon indicating copy to clipboard operation
p4runtime-shell copied to clipboard

Using Direct meter

Open Hoangttrieu opened this issue 5 years ago • 3 comments

Hello, I found a tutorial for using meter in https://github.com/haoyuz/p4-tutorials/blob/master/examples/meter/. In this tutorial, they use "meter_array_set_rates" to set the data rate for the flow. Now, I want to set the data rates by using p4runtime. Do P4runtime-shell supports to do this? Thanks you very much

Hoangttrieu avatar Aug 05 '20 14:08 Hoangttrieu

Yes. For an indirect meter, try:

P4Runtime sh >>> me = meter_entry["<name of meter object>"]

P4Runtime sh >>> me?

You should be getting a help message about how to set rates.

antoninbas avatar Aug 05 '20 18:08 antoninbas

Hello, I did me.cir = to set the value. But I have another question about the unit. Do the rates in the P4runtime is units/microseconds? Thanks in advance.

Hoangttrieu avatar Aug 06 '20 15:08 Hoangttrieu

Units per second: https://github.com/p4lang/p4runtime/blob/v1.2.0/proto/p4/v1/p4runtime.proto#L346

antoninbas avatar Aug 06 '20 17:08 antoninbas