nsIMemoryReporter 编辑

xpcom/base/nsIMemoryReporter.idlScriptable 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.

Note: This interface is undergoing heavy development, and is subject to rapid changes.

Attributes

AttributeTypeDescription
amountPRInt64

The numeric value reported by the memory reporter, specified in the units indicated by the units attribute. Read only.

Note: This attribute was called memoryUsed prior to Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), and its type was long long.
descriptionAUTF8StringA human-readable description of this memory usage report. Read only.
kindPRInt32The memory kind, one of the Memory reporter kind constants below. Read only.
pathAUTF8StringThe 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.
processACStringThe 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.
unitsPRInt32The 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.

ConstantValueDescription
KIND_MAPPED0This is deprecated synonym for KIND_NONHEAP. Deprecated since Gecko 8.0
KIND_NONHEAP0Allocated directly by OS calls e.g. mmap, VirtualAlloc, vm_allocate etc.
KIND_HEAP1Allocated by the heap allocator, e.g. malloc, new etc.
KIND_OTHER2An allocation that does not fit into another KIND category.
Requires Gecko 7.0(Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4)

The amount reported by a memory reporter may use one of the following units.

ConstantValueDescription
UNITS_BYTES0The amount is specified as a number of bytes.
UNITS_COUNT1The amount is an instantaneous count of things currently in existence. For example, the number of tabs currently open.
UNITS_COUNT_CUMULATIVE2The 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_PERCENTAGE3The 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:96 次

字数:6742

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文