nsIMemoryReporter 编辑
xpcom/base/nsIMemoryReporter.idl
Scriptable Reports memory usage information for a single area of the software. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports
Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)Any piece of code that wishes to allow its memory use to be monitored may create an nsIMemoryReporter
object and then register it by calling nsIMemoryReporterManager.registerReporter()
. Once that has been done, the reporter will be found by any client accessing the enumerator returned by nsIMemoryReporterManager.enumerateReporters()
. This includes the about:memory
page.
Attributes
Attribute | Type | Description |
amount | PRInt64 | The numeric value reported by the memory reporter, specified in the units indicated by the memoryUsed prior to Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), and its type was long long . |
description | AUTF8String | A human-readable description of this memory usage report. Read only. |
kind | PRInt32 | The memory kind, one of the Memory reporter kind constants below. Read only. |
path | AUTF8String | The path that this memory usage should be reported under. Paths are delimited with '/' characters to allow a hierarchy of memory to be displayed in about:memory. As of Gecko 6.0, the path should start with "explicit/ " if the memory report accounts for all memory reported under sub-paths. Read only. |
process | ACString | The name of the process containing this reporter. Each reporter starts with an empty string for this value, indicating that it applies to the current process; this is true even for reporters in a child process. When a reporter from a child process is copied into the main process, the copy's process field is set appropriately. Read only. |
units | PRInt32 | The units used by the amount attribute; this will be one of the Unit type constants. Read only. |
Constants
Unit type constants
Memory reporter kind constants
These allocation kind constants describe the types of memory allocation described by memory use reporters.
Constant | Value | Description |
KIND_MAPPED | 0 | This is deprecated synonym for KIND_NONHEAP . Deprecated since Gecko 8.0 |
KIND_NONHEAP | 0 | Allocated directly by OS calls e.g. mmap, VirtualAlloc, vm_allocate etc. |
KIND_HEAP | 1 | Allocated by the heap allocator, e.g. malloc, new etc. |
KIND_OTHER | 2 | An allocation that does not fit into another KIND category. |
The amount reported by a memory reporter may use one of the following units.
Constant | Value | Description |
UNITS_BYTES | 0 | The amount is specified as a number of bytes. |
UNITS_COUNT | 1 | The amount is an instantaneous count of things currently in existence. For example, the number of tabs currently open. |
UNITS_COUNT_CUMULATIVE | 2 | The amount contains the number of times some event has occurred since the application started up. For example, the number of times the user has opened a new tab. The amount returned must never decrease over the lifetime of the application. |
UNITS_PERCENTAGE | 3 | The amount contains a fraction that should be expressed as a percentage. Note: The amount field should be given a value 100 times the actual percentage; this number will be divided by 100 when shown. This allows a fractional percentage to be shown even though amount is an integer. For example if the actual percentage is 12.34%, amount should be 1234. |
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论