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