xref: /aosp_15_r20/external/cronet/components/metrics/public/mojom/call_stack_profile_collector.mojom (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1// Copyright 2016 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5module metrics.mojom;
6
7import "mojo/public/mojom/base/byte_string.mojom";
8import "mojo/public/mojom/base/time.mojom";
9
10// |contents| is a serialized protobuf from
11// src/third_party/metrics_proto/sampled_profile.proto.
12//
13// We pass this state via serialized protobuf because that is the ultimate
14// metrics upload format.
15struct SampledProfile {
16  mojo_base.mojom.ByteString contents;
17};
18
19// The type of data that's sampled in a profile.
20enum ProfileType {
21  kCPU,
22  kHeap,
23};
24
25// Passes SampledProfile reports from a sampling profiler running in a child
26// process to CallStackProfileMetricsProvider in the browser process, to be
27// included in metrics uploads.
28interface CallStackProfileCollector {
29
30  // Passes the report in `profile` to CallStackProfileMetricsProvider.
31  // `start_timestamp` is the timestamp of the oldest sample in the report, and
32  // `profile_type` is the type of sampled data in the report.
33  //
34  // Note that the `trigger_event` field of the SampledProfile proto should be
35  // PERIODIC_HEAP_COLLECTION iff `profile_type` is kHeap. But the profile
36  // comes from an untrusted process so the implementation must not depend on
37  // this.
38  Collect(mojo_base.mojom.TimeTicks start_timestamp,
39          ProfileType profile_type,
40          SampledProfile profile);
41};
42