// Copyright 2023 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

option optimize_for = LITE_RUNTIME;

option go_package = "chromiumos/system_api/stack_sampled_metrics_status_proto";

package stack_sampled_metrics_status;

// Used to send the status of the stack sampling metrics code to the
// ui.StackSampledMetricsV2 tast test in the /tmp/stack-sampling-data[-lacros]
// file.
message StackSampledMetricsStatus {
  message ThreadCountMap {
    // A map from the type of thread to the number of times the process+thread
    // has been successfully sampled since Chrome startup.
    // The key is a value in the the Thread enum from
    // https://source.chromium.org/chromium/chromium/src/+/main:third_party/metrics_proto/execution_context.proto.
    // It is *not* the thread ID.
    // We don't use the Thread enum directly here because
    //   a) It's not available in ChromeOS and
    //   b) Protobufs don't allow enums as map keys.
    map<int32, int32> thread_type_to_success_count = 1;
  }

  // A map from the type of process to number of times the process's threads
  // have been successfully sampled. The key is a value from the Process enum
  // from
  // https://source.chromium.org/chromium/chromium/src/+/main:third_party/metrics_proto/execution_context.proto.
  map<int32, ThreadCountMap> process_type_to_thread_count_map = 1;
}
