// 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
  int32 tmpfs_kib_available = 2;  // Free space in TMPFS 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 BmcECCMetric {
  int32 correctable_error_count = 1;
  int32 uncorrectable_error_count = 2;
}

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;
  reserved 7;
  reserved 8;
  BmcECCMetric ecc_metric = 9;
}
