// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module metrics.mojom;
import "mojo/public/mojom/base/byte_string.mojom";
import "mojo/public/mojom/base/time.mojom";
// |contents| is a serialized protobuf from
// src/third_party/metrics_proto/sampled_profile.proto.
//
// We pass this state via serialized protobuf because that is the ultimate
// metrics upload format.
struct SampledProfile {
mojo_base.mojom.ByteString contents;
};
// The type of data that's sampled in a profile.
enum ProfileType {
kCPU,
kHeap,
};
// Passes SampledProfile reports from a sampling profiler running in a child
// process to CallStackProfileMetricsProvider in the browser process, to be
// included in metrics uploads.
interface CallStackProfileCollector {
// Passes the report in `profile` to CallStackProfileMetricsProvider.
// `start_timestamp` is the timestamp of the oldest sample in the report, and
// `profile_type` is the type of sampled data in the report.
//
// Note that the `trigger_event` field of the SampledProfile proto should be
// PERIODIC_HEAP_COLLECTION iff `profile_type` is kHeap. But the profile
// comes from an untrusted process so the implementation must not depend on
// this.
Collect(mojo_base.mojom.TimeTicks start_timestamp,
ProfileType profile_type,
SampledProfile profile);
};