Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: services/resource_coordinator/public/interfaces/memory/memory_instrumentation.mojom

Issue 2871223002: memory-infra: add ProcessType and expose data in RequestGlobalDump() (Closed)
Patch Set: review comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module memory_instrumentation.mojom; 5 module memory_instrumentation.mojom;
6 6
7 import "mojo/common/process_id.mojom"; 7 import "mojo/common/process_id.mojom";
8 8
9 enum DumpType { 9 enum DumpType {
10 PERIODIC_INTERVAL, 10 PERIODIC_INTERVAL,
11 EXPLICITLY_TRIGGERED, 11 EXPLICITLY_TRIGGERED,
12 PEAK_MEMORY_USAGE, 12 PEAK_MEMORY_USAGE,
13 SUMMARY_ONLY 13 SUMMARY_ONLY
14 }; 14 };
15 15
16 enum LevelOfDetail { 16 enum LevelOfDetail {
17 BACKGROUND, 17 BACKGROUND,
18 LIGHT, 18 LIGHT,
19 DETAILED 19 DETAILED
20 }; 20 };
21 21
22 struct RequestArgs { 22 struct RequestArgs {
23 uint64 dump_guid; 23 uint64 dump_guid;
(...skipping 14 matching lines...) Expand all
38 PlatformPrivateFootprint platform_private_footprint; 38 PlatformPrivateFootprint platform_private_footprint;
39 }; 39 };
40 40
41 struct ChromeMemDump { 41 struct ChromeMemDump {
42 uint32 malloc_total_kb = 0; 42 uint32 malloc_total_kb = 0;
43 uint32 partition_alloc_total_kb = 0; 43 uint32 partition_alloc_total_kb = 0;
44 uint32 blink_gc_total_kb = 0; 44 uint32 blink_gc_total_kb = 0;
45 uint32 v8_total_kb = 0; 45 uint32 v8_total_kb = 0;
46 }; 46 };
47 47
48 struct MemoryDumpCallbackResult { 48 enum ProcessType {
49 OTHER,
50 BROWSER,
51 RENDERER,
52 GPU,
53 UTILITY,
54 PLUGIN
55 };
56
57 // This struct is used both for:
58 // 1) The internal communication between the memory service (Coordinator) and
59 // the client library (ProcessLocalDumpManager).
60 // 2) The public-facing API Coordinator::RequestGlobalMemoryDump().
61 struct ProcessMemoryDump {
62 ProcessType process_type;
49 OSMemDump os_dump; 63 OSMemDump os_dump;
50 ChromeMemDump chrome_dump; 64 ChromeMemDump chrome_dump;
65
66 // TODO(hjd): add the computed Consistent Memory Metrics footprints here.
67
68 // This is used only in the use-case (1) and only on Linux/CrOS to get
69 // around sandboxing. See crbug.com/461788 .
51 map<mojo.common.mojom.ProcessId, OSMemDump> extra_processes_dump; 70 map<mojo.common.mojom.ProcessId, OSMemDump> extra_processes_dump;
52 }; 71 };
53 72
54 // There should be at most one implementation of this interface per process. 73
55 interface ProcessLocalDumpManager { 74 // This struct is returned by the public-facing API
56 // When successful, the dump is appended in the process-local trace buffer of 75 // Coordinator::RequestGlobalMemoryDump().
57 // the target process and an ACK. A summary of the dump is also returned in 76 struct GlobalMemoryDump {
58 // case of success. 77 array<ProcessMemoryDump> process_dumps;
59 RequestProcessMemoryDump(RequestArgs args) =>
60 (uint64 dump_guid, bool success, MemoryDumpCallbackResult? result);
61 }; 78 };
62 79
63 // Memory Infra service implements this interface. ProcessLocalDumpManagers 80 // This is the interface implemented by the client library. This allows a
64 // register themselves using the RegisterProcessLocalDumpManager method and 81 // remote process to contribute to memory-infra dumps. There should be at
65 // suggest a global memory dump using the RequestGlobalMemoryDump method. 82 // most one instance of this per hosting process.
83 interface ProcessLocalDumpManager {
84 // When |success| == true the dump is appended in the process-local trace
85 // buffer of the target process and an ACK. A summary of the dump is also
86 // returned in case of success.
87 RequestProcessMemoryDump(RequestArgs args) =>
88 (uint64 dump_guid, bool success, ProcessMemoryDump? process_memory_dump);
89 };
90
91 // The memory-infra service implements this interface.
66 interface Coordinator { 92 interface Coordinator {
93 // Used to register a client library to obtain a process-local dump from it
94 // when RequestGlobalMemoryDump() is called.
67 RegisterProcessLocalDumpManager(ProcessLocalDumpManager local_manager); 95 RegisterProcessLocalDumpManager(ProcessLocalDumpManager local_manager);
68 RequestGlobalMemoryDump(RequestArgs args) => (uint64 dump_guid, bool success); 96
97 // Broadcasts a dump request to all registered client libraries, injects the
98 // dump in the trace buffer (if tracing is enabled) and returns a summarized
99 // dump back if args.dump_type == SUMMARY_ONLY.
100 RequestGlobalMemoryDump(RequestArgs args) =>
101 (uint64 dump_guid, bool success, GlobalMemoryDump? global_memory_dump);
69 }; 102 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698