| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 metrics.mojom; | 5 module metrics.mojom; |
| 6 | 6 |
| 7 struct LeakDetectorParams { | 7 struct LeakDetectorParams { |
| 8 float sampling_rate; | 8 float sampling_rate; |
| 9 uint32 max_stack_depth; | 9 uint32 max_stack_depth; |
| 10 uint64 analysis_interval_bytes; | 10 uint64 analysis_interval_bytes; |
| 11 uint32 size_suspicion_threshold; | 11 uint32 size_suspicion_threshold; |
| 12 uint32 call_stack_suspicion_threshold; | 12 uint32 call_stack_suspicion_threshold; |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 struct AllocationBreakdown { | 15 struct AllocationBreakdown { |
| 16 array<uint32> counts_by_size; | 16 array<uint32> counts_by_size; |
| 17 uint32 count_for_call_stack; | 17 uint32 count_for_call_stack; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 struct MemoryLeakReport { | 20 struct MemoryLeakReport { |
| 21 uint32 size_bytes; | 21 uint32 size_bytes; |
| 22 array<uint64> call_stack; | 22 array<uint64> call_stack; |
| 23 uint32 num_rising_intervals; | |
| 24 uint32 num_allocs_increase; | |
| 25 | 23 |
| 26 array<AllocationBreakdown> alloc_breakdown_history; | 24 array<AllocationBreakdown> alloc_breakdown_history; |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 // Provides a remote interface for enabling LeakDetector on remote processes. | 27 // Provides a remote interface for enabling LeakDetector on remote processes. |
| 30 interface LeakDetector { | 28 interface LeakDetector { |
| 31 // Returns a LeakDetectorParams struct. Used to indicate to the remote process | 29 // Returns a LeakDetectorParams struct. Used to indicate to the remote process |
| 32 // what parameters to use when initializing LeakDetector. Can also return | 30 // what parameters to use when initializing LeakDetector. Can also return |
| 33 // |params.sampling_rate| == 0 to indicate that LeakDetector should not be | 31 // |params.sampling_rate| == 0 to indicate that LeakDetector should not be |
| 34 // initialized on a particular process. | 32 // initialized on a particular process. |
| 35 GetParams() => (LeakDetectorParams params); | 33 GetParams() => (LeakDetectorParams params); |
| 36 | 34 |
| 37 // When a remote process running LeakDetector gets some leak reports, it | 35 // When a remote process running LeakDetector gets some leak reports, it |
| 38 // should call this function to return the leak reports back to the main | 36 // should call this function to return the leak reports back to the main |
| 39 // process that implements this function. The reports should be sent back as | 37 // process that implements this function. The reports should be sent back as |
| 40 // an array of serialized MemoryLeakReportProtos. | 38 // an array of serialized MemoryLeakReportProtos. |
| 41 SendLeakReports(array<MemoryLeakReport> reports); | 39 SendLeakReports(array<MemoryLeakReport> reports); |
| 42 }; | 40 }; |
| OLD | NEW |