// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package bmcmetrics.metricproto;

message BmcMemoryMetric {
  int32 mem_available = 1;
  int32 slab = 2;
  int32 kernel_stack = 3;
}

message BmcUptimeMetric {
  float uptime = 1;                   // Uptime (wall clock time)
  float idle_process_time = 2;        // Idle process time across all cores
  float firmware_boot_time_sec = 3;   // Time (seconds) elapsed in firmware process
  float loader_boot_time_sec = 4;     // Time (seconds) elapsed in loader process
  float kernel_boot_time_sec = 5;     // Time (seconds) elapsed in kernel process
  float initrd_boot_time_sec = 6;     // Time (seconds) elapsed in initrd process
  float userspace_boot_time_sec = 7;  // Time (seconds) elapsed in userspace process
}

message BmcDiskSpaceMetric {
  int32 rwfs_kib_available = 1;  // Free space in RWFS in KiB
}

// The following messages use string tables to save space
message BmcProcStatMetric {
  message BmcProcStat {
    int32 sidx_cmdline = 1;  // complete command line
    float utime = 2;         // Time (seconds) in user mode
    float stime = 3;         // Time (seconds) in kernel mode
  }
  repeated BmcProcStat stats = 10;
}

message BmcFdStatMetric {
  message BmcFdStat {
    int32 sidx_cmdline = 1;  // complete command line
    int32 fd_count = 2;      // count of open FD's
  }
  repeated BmcFdStat stats = 10;
}

message BmcStringTable {
  message StringEntry {
    string value = 1;
  }
  repeated StringEntry entries = 10;
}

message BmcMetricSnapshot {
  BmcStringTable string_table = 1;
  BmcMemoryMetric memory_metric = 2;
  BmcUptimeMetric uptime_metric = 3;
  BmcDiskSpaceMetric storage_space_metric = 4;
  BmcProcStatMetric procstat_metric = 5;
  BmcFdStatMetric fdstat_metric = 6;
}
