michael@0: /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, function, uuid(2dea18fc-fbfa-4bf7-ad45-0efaf5495f5e)] michael@0: interface nsIFinishDumpingCallback : nsISupports michael@0: { michael@0: void callback(in nsISupports data); michael@0: }; michael@0: michael@0: [scriptable, builtinclass, uuid(815bf31b-f5bd-425d-85c3-4657a7a91dad)] michael@0: interface nsIMemoryInfoDumper : nsISupports michael@0: { michael@0: /** michael@0: * This dumps gzipped memory reports for this process and its child michael@0: * processes. If a file of the given name exists, it will be overwritten. michael@0: * michael@0: * @param aFilename The output file. michael@0: * michael@0: * Sample output: michael@0: * michael@0: * { michael@0: * "hasMozMallocUsableSize":true, michael@0: * "reports": [ michael@0: * {"process":"Main Process (pid 12345)", "path":"explicit/foo/bar", michael@0: * "kind":1, "units":0, "amount":2000000, "description":"Foo bar."}, michael@0: * {"process":"Main Process (pid 12345)", "path":"heap-allocated", michael@0: * "kind":1, "units":0, "amount":3000000, "description":"Heap allocated."}, michael@0: * {"process":"Main Process (pid 12345)", "path":"vsize", michael@0: * "kind":1, "units":0, "amount":10000000, "description":"Vsize."} michael@0: * ] michael@0: * } michael@0: * michael@0: * JSON schema for the output. michael@0: * michael@0: * { michael@0: * "properties": { michael@0: * "hasMozMallocUsableSize": { michael@0: * "type": "boolean", michael@0: * "description": "nsIMemoryReporterManager::hasMozMallocUsableSize", michael@0: * "required": true michael@0: * }, michael@0: * "reports": { michael@0: * "type": "array", michael@0: * "description": "The memory reports.", michael@0: * "required": true michael@0: * "minItems": 1, michael@0: * "items": { michael@0: * "type": "object", michael@0: * "properties": { michael@0: * "process": { michael@0: * "type": "string", michael@0: * "description": "nsIMemoryReporter::process", michael@0: * "required": true michael@0: * }, michael@0: * "path": { michael@0: * "type": "string", michael@0: * "description": "nsIMemoryReporter::path", michael@0: * "required": true, michael@0: * "minLength": 1 michael@0: * }, michael@0: * "kind": { michael@0: * "type": "integer", michael@0: * "description": "nsIMemoryReporter::kind", michael@0: * "required": true michael@0: * }, michael@0: * "units": { michael@0: * "type": "integer", michael@0: * "description": "nsIMemoryReporter::units", michael@0: * "required": true michael@0: * }, michael@0: * "amount": { michael@0: * "type": "integer", michael@0: * "description": "nsIMemoryReporter::amount", michael@0: * "required": true michael@0: * }, michael@0: * "description": { michael@0: * "type": "string", michael@0: * "description": "nsIMemoryReporter::description", michael@0: * "required": true michael@0: * } michael@0: * } michael@0: * } michael@0: * } michael@0: * } michael@0: * } michael@0: */ michael@0: void dumpMemoryReportsToNamedFile(in AString aFilename, michael@0: in nsIFinishDumpingCallback aFinishDumping, michael@0: in nsISupports aFinishDumpingData); michael@0: michael@0: /** michael@0: * Similar to dumpMemoryReportsToNamedFile, this method dumps gzipped memory michael@0: * reports for this process and its child processes to files in the tmp michael@0: * directory called memory-reports--.json.gz (or something michael@0: * similar, such as memory-reports---1.json.gz; no existing michael@0: * file will be overwritten). michael@0: * michael@0: * If DMD is enabled, this method also dumps gzipped DMD output to a file in michael@0: * the tmp directory called dmd--.txt.gz (or something michael@0: * similar; again, no existing file will be overwritten). michael@0: * michael@0: * @param aIdentifier this identifier will appear in the filename of our michael@0: * about:memory dump and those of our children. michael@0: * michael@0: * If the identifier is empty, the implementation may set it arbitrarily michael@0: * and use that new value for its own dump and the dumps of its child michael@0: * processes. For example, the implementation may set |aIdentifier| to the michael@0: * number of seconds since the epoch. michael@0: * michael@0: * @param aMinimizeMemoryUsage indicates whether we should run a series of michael@0: * gc/cc's in an attempt to reduce our memory usage before collecting our michael@0: * memory report. michael@0: */ michael@0: void dumpMemoryInfoToTempDir( michael@0: in AString aIdentifier, michael@0: in bool aMinimizeMemoryUsage); michael@0: michael@0: /** michael@0: * Dump GC and CC logs to files in the OS's temp directory (or in michael@0: * $MOZ_CC_LOG_DIRECTORY, if that environment variable is specified). michael@0: * michael@0: * @param aIdentifier If aIdentifier is non-empty, this string will appear in michael@0: * the filenames of the logs we create (both for this process and, if michael@0: * aDumpChildProcesses is true, for our child processes). michael@0: * michael@0: * If aIdentifier is empty, the implementation may set it to an michael@0: * arbitrary value; for example, it may set aIdentifier to the number michael@0: * of seconds since the epoch. michael@0: * michael@0: * @param aDumpAllTraces indicates whether we should run an all-traces CC michael@0: * log. An all-traces log visits all objects currently eligible for cycle michael@0: * collection, while a non-all-traces log avoids visiting some objects michael@0: * which we know are reachable. michael@0: * michael@0: * All-traces logs are much bigger than the alternative, but they may be michael@0: * helpful when trying to understand why a particular object is alive. For michael@0: * example, a non-traces-log will skip references held by an active michael@0: * document; if your object is being held alive by such a document, you michael@0: * probably want to see those references. michael@0: * michael@0: * @param aDumpChildProcesses indicates whether we should call michael@0: * DumpGCAndCCLogsToFile in our child processes. If so, the child processes michael@0: * will dump their children, and so on. michael@0: * michael@0: * @param aGCLogPath The full path of the file that the GC log was written to. michael@0: * michael@0: * @param aCCLogPath The full path of the file that the CC log was written to. michael@0: */ michael@0: void dumpGCAndCCLogsToFile(in AString aIdentifier, michael@0: in bool aDumpAllTraces, michael@0: in bool aDumpChildProcesses, michael@0: out AString aGCLogPath, michael@0: out AString aCCLogPath); michael@0: };