/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-*/ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" #include "nsIArray.idl" #include "nsIDOMWindow.idl" /** * Mechanisms for querying the current process about performance * information. * * JavaScript clients should rather use PerformanceStats.jsm. */ /** * Snapshot of the performance of a component, e.g. an add-on, a web * page, system built-ins, or the entire process itself. * * All values are monotonic and are updated only when * `nsIPerformanceStatsService.isStopwatchActive` is `true`. */ [scriptable, uuid(47f8d36d-1d67-43cb-befd-d2f4720ac568)] interface nsIPerformanceStats: nsISupports { /** * An identifier unique to the component. * * This identifier is somewhat human-readable to aid with debugging, * but clients should not rely upon the format. */ readonly attribute AString groupId; /** * The name of the component: * - for the process itself, ""; * - for platform code, ""; * - for an add-on, the identifier of the addon (e.g. "myaddon@foo.bar"); * - for a webpage, the url of the page. */ readonly attribute AString name; /** * If the component is an add-on, the ID of the addon, * otherwise an empty string. */ readonly attribute AString addonId; /** * If the component is code executed in a window, the ID of the topmost * outer window (i.e. the tab), otherwise 0. */ readonly attribute uint64_t windowId; /** * If the component is code executed in a window, the title of the topmost * window (i.e. the tab), otherwise an empty string. */ readonly attribute AString title; /** * Total amount of time spent executing code in this group, in * microseconds. */ readonly attribute unsigned long long totalUserTime; readonly attribute unsigned long long totalSystemTime; readonly attribute unsigned long long totalCPOWTime; /** * Total number of times code execution entered this group, * since process launch. This may be greater than the number * of times we have entered the event loop. */ readonly attribute unsigned long long ticks; /** * `true` if this component is executed with system privileges * (e.g. the platform itself or an add-on), `false` otherwise * (e.g. webpages). */ readonly attribute bool isSystem; /** * Jank indicator. * * durations[i] == number of times execution of this group * lasted at lest 2^i ms. */ void getDurations([optional] out unsigned long aCount, [retval, array, size_is(aCount)]out unsigned long long aNumberOfOccurrences); }; /** * A snapshot of the performance data of the process. */ [scriptable, uuid(29ecebd0-908a-4b34-8f62-a6015dea1141)] interface nsIPerformanceSnapshot: nsISupports { /** * Data on all individual components. */ nsIArray getComponentsData(); /** * Information on the process itself. * * This contains the total amount of time spent executing JS code, * the total amount of time spent waiting for system calls while * executing JS code, the total amount of time performing blocking * inter-process calls, etc. */ nsIPerformanceStats getProcessData(); }; [scriptable, builtinclass, uuid(0469e6af-95c3-4961-a385-4bc009128939)] interface nsIPerformanceStatsService : nsISupports { /** * `true` if we should monitor CPOW, `false` otherwise. */ [implicit_jscontext] attribute bool isMonitoringCPOW; /** * `true` if we should monitor jank, `false` otherwise. */ [implicit_jscontext] attribute bool isMonitoringJank; /** * Capture a snapshot of the performance data. */ [implicit_jscontext] nsIPerformanceSnapshot getSnapshot(); }; %{C++ #define NS_TOOLKIT_PERFORMANCESTATSSERVICE_CID {0xfd7435d4, 0x9ec4, 0x4699, \ {0xad, 0xd4, 0x1b, 0xe8, 0x3d, 0xd6, 0x8e, 0xf3} } #define NS_TOOLKIT_PERFORMANCESTATSSERVICE_CONTRACTID "@mozilla.org/toolkit/performance-stats-service;1" %}