1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/hr-time/#sec-performance
8 * https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface
9 * https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface
10 * https://w3c.github.io/resource-timing/#sec-extensions-performance-interface
11 * https://w3c.github.io/user-timing/#extensions-performance-interface
13 * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang).
14 * W3C liability, trademark and document use rules apply.
17 // DOMTimeStamp is deprecated, use EpochTimeStamp instead.
18 typedef unsigned long long DOMTimeStamp;
19 typedef unsigned long long EpochTimeStamp;
20 typedef double DOMHighResTimeStamp;
21 typedef sequence <PerformanceEntry> PerformanceEntryList;
23 // https://w3c.github.io/hr-time/#sec-performance
24 [Exposed=(Window,Worker)]
25 interface Performance : EventTarget {
26 [DependsOn=DeviceState, Affects=Nothing]
27 DOMHighResTimeStamp now();
30 readonly attribute DOMHighResTimeStamp timeOrigin;
32 [Default] object toJSON();
35 // https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface
37 partial interface Performance {
39 readonly attribute PerformanceTiming timing;
41 readonly attribute PerformanceNavigation navigation;
44 // https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface
45 [Exposed=(Window,Worker)]
46 partial interface Performance {
47 PerformanceEntryList getEntries();
48 PerformanceEntryList getEntriesByType(DOMString entryType);
49 PerformanceEntryList getEntriesByName(DOMString name, optional DOMString
53 // https://w3c.github.io/resource-timing/#sec-extensions-performance-interface
54 [Exposed=(Window,Worker)]
55 partial interface Performance {
56 undefined clearResourceTimings();
57 undefined setResourceTimingBufferSize(unsigned long maxSize);
58 attribute EventHandler onresourcetimingbufferfull;
61 // GC microbenchmarks, pref-guarded, not for general use (bug 1125412)
63 partial interface Performance {
64 [Pref="dom.enable_memory_stats"]
65 readonly attribute object mozMemory;
68 // https://w3c.github.io/user-timing/#extensions-performance-interface
69 dictionary PerformanceMarkOptions {
71 DOMHighResTimeStamp startTime;
74 // https://w3c.github.io/user-timing/#extensions-performance-interface
75 dictionary PerformanceMeasureOptions {
77 (DOMString or DOMHighResTimeStamp) start;
78 DOMHighResTimeStamp duration;
79 (DOMString or DOMHighResTimeStamp) end;
82 // https://w3c.github.io/user-timing/#extensions-performance-interface
83 [Exposed=(Window,Worker)]
84 partial interface Performance {
86 PerformanceMark mark(DOMString markName, optional PerformanceMarkOptions markOptions = {});
87 undefined clearMarks(optional DOMString markName);
89 PerformanceMeasure measure(DOMString measureName, optional (DOMString or PerformanceMeasureOptions) startOrMeasureOptions = {}, optional DOMString endMark);
90 undefined clearMeasures(optional DOMString measureName);
94 partial interface Performance {
95 [Pref="dom.enable_event_timing", SameObject]
96 readonly attribute EventCounts eventCounts;