// Proto messages related to latency measurement for Soapbox.
syntax = "proto2";

// TODO: Switch to package mediapipe.
package mediapipe;

// Contains the latency information for a packet stream in mediapipe. The
// following are provided
// 1. current latency
// 2. running average
// 3. histogram of latencies observed
// 4. cumulative sum of latencies observed
// NextId: 13
message PacketLatency {
  // Reserved tags.
  reserved 1, 3 to 6;

  // Current latency (delay in microseconds wrt a reference packet).
  optional int64 current_latency_usec = 8;

  // The latency histogram which stores the count recorded for each specified
  // interval.
  repeated int64 counts = 9;

  // Number of intervals for the latency histogram output.
  optional int64 num_intervals = 10 [default = 10];

  // Size of the histogram intervals (in microseconds). The first interval is
  // [0, interval_size_usec). The last interval extends to +inf.
  optional int64 interval_size_usec = 11 [default = 10000];

  // Running average of latencies observed so far.
  optional int64 avg_latency_usec = 2;

  // An identifier label for the packet.
  optional string label = 7;

  // Cumulative sum of individual packet latencies of all the packets output so
  // far.
  optional int64 sum_latency_usec = 12;
}
