|
1 /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 [scriptable, function, uuid(2dea18fc-fbfa-4bf7-ad45-0efaf5495f5e)] |
|
9 interface nsIFinishDumpingCallback : nsISupports |
|
10 { |
|
11 void callback(in nsISupports data); |
|
12 }; |
|
13 |
|
14 [scriptable, builtinclass, uuid(815bf31b-f5bd-425d-85c3-4657a7a91dad)] |
|
15 interface nsIMemoryInfoDumper : nsISupports |
|
16 { |
|
17 /** |
|
18 * This dumps gzipped memory reports for this process and its child |
|
19 * processes. If a file of the given name exists, it will be overwritten. |
|
20 * |
|
21 * @param aFilename The output file. |
|
22 * |
|
23 * Sample output: |
|
24 * |
|
25 * { |
|
26 * "hasMozMallocUsableSize":true, |
|
27 * "reports": [ |
|
28 * {"process":"Main Process (pid 12345)", "path":"explicit/foo/bar", |
|
29 * "kind":1, "units":0, "amount":2000000, "description":"Foo bar."}, |
|
30 * {"process":"Main Process (pid 12345)", "path":"heap-allocated", |
|
31 * "kind":1, "units":0, "amount":3000000, "description":"Heap allocated."}, |
|
32 * {"process":"Main Process (pid 12345)", "path":"vsize", |
|
33 * "kind":1, "units":0, "amount":10000000, "description":"Vsize."} |
|
34 * ] |
|
35 * } |
|
36 * |
|
37 * JSON schema for the output. |
|
38 * |
|
39 * { |
|
40 * "properties": { |
|
41 * "hasMozMallocUsableSize": { |
|
42 * "type": "boolean", |
|
43 * "description": "nsIMemoryReporterManager::hasMozMallocUsableSize", |
|
44 * "required": true |
|
45 * }, |
|
46 * "reports": { |
|
47 * "type": "array", |
|
48 * "description": "The memory reports.", |
|
49 * "required": true |
|
50 * "minItems": 1, |
|
51 * "items": { |
|
52 * "type": "object", |
|
53 * "properties": { |
|
54 * "process": { |
|
55 * "type": "string", |
|
56 * "description": "nsIMemoryReporter::process", |
|
57 * "required": true |
|
58 * }, |
|
59 * "path": { |
|
60 * "type": "string", |
|
61 * "description": "nsIMemoryReporter::path", |
|
62 * "required": true, |
|
63 * "minLength": 1 |
|
64 * }, |
|
65 * "kind": { |
|
66 * "type": "integer", |
|
67 * "description": "nsIMemoryReporter::kind", |
|
68 * "required": true |
|
69 * }, |
|
70 * "units": { |
|
71 * "type": "integer", |
|
72 * "description": "nsIMemoryReporter::units", |
|
73 * "required": true |
|
74 * }, |
|
75 * "amount": { |
|
76 * "type": "integer", |
|
77 * "description": "nsIMemoryReporter::amount", |
|
78 * "required": true |
|
79 * }, |
|
80 * "description": { |
|
81 * "type": "string", |
|
82 * "description": "nsIMemoryReporter::description", |
|
83 * "required": true |
|
84 * } |
|
85 * } |
|
86 * } |
|
87 * } |
|
88 * } |
|
89 * } |
|
90 */ |
|
91 void dumpMemoryReportsToNamedFile(in AString aFilename, |
|
92 in nsIFinishDumpingCallback aFinishDumping, |
|
93 in nsISupports aFinishDumpingData); |
|
94 |
|
95 /** |
|
96 * Similar to dumpMemoryReportsToNamedFile, this method dumps gzipped memory |
|
97 * reports for this process and its child processes to files in the tmp |
|
98 * directory called memory-reports-<identifier>-<pid>.json.gz (or something |
|
99 * similar, such as memory-reports-<identifier>-<pid>-1.json.gz; no existing |
|
100 * file will be overwritten). |
|
101 * |
|
102 * If DMD is enabled, this method also dumps gzipped DMD output to a file in |
|
103 * the tmp directory called dmd-<identifier>-<pid>.txt.gz (or something |
|
104 * similar; again, no existing file will be overwritten). |
|
105 * |
|
106 * @param aIdentifier this identifier will appear in the filename of our |
|
107 * about:memory dump and those of our children. |
|
108 * |
|
109 * If the identifier is empty, the implementation may set it arbitrarily |
|
110 * and use that new value for its own dump and the dumps of its child |
|
111 * processes. For example, the implementation may set |aIdentifier| to the |
|
112 * number of seconds since the epoch. |
|
113 * |
|
114 * @param aMinimizeMemoryUsage indicates whether we should run a series of |
|
115 * gc/cc's in an attempt to reduce our memory usage before collecting our |
|
116 * memory report. |
|
117 */ |
|
118 void dumpMemoryInfoToTempDir( |
|
119 in AString aIdentifier, |
|
120 in bool aMinimizeMemoryUsage); |
|
121 |
|
122 /** |
|
123 * Dump GC and CC logs to files in the OS's temp directory (or in |
|
124 * $MOZ_CC_LOG_DIRECTORY, if that environment variable is specified). |
|
125 * |
|
126 * @param aIdentifier If aIdentifier is non-empty, this string will appear in |
|
127 * the filenames of the logs we create (both for this process and, if |
|
128 * aDumpChildProcesses is true, for our child processes). |
|
129 * |
|
130 * If aIdentifier is empty, the implementation may set it to an |
|
131 * arbitrary value; for example, it may set aIdentifier to the number |
|
132 * of seconds since the epoch. |
|
133 * |
|
134 * @param aDumpAllTraces indicates whether we should run an all-traces CC |
|
135 * log. An all-traces log visits all objects currently eligible for cycle |
|
136 * collection, while a non-all-traces log avoids visiting some objects |
|
137 * which we know are reachable. |
|
138 * |
|
139 * All-traces logs are much bigger than the alternative, but they may be |
|
140 * helpful when trying to understand why a particular object is alive. For |
|
141 * example, a non-traces-log will skip references held by an active |
|
142 * document; if your object is being held alive by such a document, you |
|
143 * probably want to see those references. |
|
144 * |
|
145 * @param aDumpChildProcesses indicates whether we should call |
|
146 * DumpGCAndCCLogsToFile in our child processes. If so, the child processes |
|
147 * will dump their children, and so on. |
|
148 * |
|
149 * @param aGCLogPath The full path of the file that the GC log was written to. |
|
150 * |
|
151 * @param aCCLogPath The full path of the file that the CC log was written to. |
|
152 */ |
|
153 void dumpGCAndCCLogsToFile(in AString aIdentifier, |
|
154 in bool aDumpAllTraces, |
|
155 in bool aDumpChildProcesses, |
|
156 out AString aGCLogPath, |
|
157 out AString aCCLogPath); |
|
158 }; |