blob: b6d0ecbe74c0d1b2f5777fb8f9be4f9f6a767626 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module profiling.mojom;
import "chrome/common/profiling/profiling_client.mojom";
import "mojo/common/file.mojom";
import "mojo/common/process_id.mojom";
import "mojo/common/values.mojom";
struct SharedBufferWithSize {
handle<shared_buffer> buffer;
uint32 size;
mojo.common.mojom.ProcessId pid;
};
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum ProcessType {
OTHER = 0,
BROWSER = 1,
RENDERER = 2,
GPU = 3,
LAST = GPU
};
// This interface is how the browser process sends commands to the profiling
// process.
interface ProfilingService {
// Adds a new profiling client.
//
// The "client" interface will be for the instrumented process. It allows the
// profiling process to talk to the new process.
//
// Both ends of a platform-specific pipe to read memlog trace data from is
// passed in. The sender end will be forwarded to the client process.
//
// |stack_mode| refers to the type of stacks that the client should record for
// allocations.
AddProfilingClient(mojo.common.mojom.ProcessId pid,
ProfilingClient client,
handle memlog_pipe_sender,
handle memlog_pipe_receiver,
ProcessType process_type,
StackMode stack_mode);
// Dumps the memory log of all profiled processes into shared buffers. The
// contents of each shared buffer is a JSON string compatible with
// TRACE_EVENT* macros. Processes that fail to dump will be omitted from
// |buffers|. When |strip_path_from_mapped_files| is true, only the base name
// of mapped files is emitted. This prevents usernames from sneaking into the
// trace.
// |strip_path_from_mapped_files| should only be true for traces that will be
// uploaded to the crash servers - this strips potential PII, but prevents
// symbolization of local builds.
DumpProcessesForTracing(bool keep_small_allocations,
bool strip_path_from_mapped_files) =>
(array<SharedBufferWithSize> buffers);
// Returns the pids of all profiled processes.
GetProfiledPids() => (array<mojo.common.mojom.ProcessId> pids);
};