Source code

Revision control

Other Tools

1
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
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
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "nsISupports.idl"
7
#include "nsIFile.idl"
8
9
[scriptable,function, uuid(3d3b9075-5549-4244-9c08-b64fefa1dd60)]
10
interface nsIFetchTelemetryDataCallback : nsISupports
11
{
12
void complete();
13
};
14
15
[scriptable, uuid(273d2dd0-6c63-475a-b864-cb65160a1909)]
16
interface nsITelemetry : nsISupports
17
{
18
/**
19
* Histogram types:
20
* HISTOGRAM_EXPONENTIAL - buckets increase exponentially
21
* HISTOGRAM_LINEAR - buckets increase linearly
22
* HISTOGRAM_BOOLEAN - For storing 0/1 values
23
* HISTOGRAM_FLAG - For storing a single value; its count is always == 1.
24
* HISTOGRAM_COUNT - For storing counter values without bucketing.
25
* HISTOGRAM_CATEGORICAL - For storing enumerated values by label.
26
*/
27
const unsigned long HISTOGRAM_EXPONENTIAL = 0;
28
const unsigned long HISTOGRAM_LINEAR = 1;
29
const unsigned long HISTOGRAM_BOOLEAN = 2;
30
const unsigned long HISTOGRAM_FLAG = 3;
31
const unsigned long HISTOGRAM_COUNT = 4;
32
const unsigned long HISTOGRAM_CATEGORICAL = 5;
33
34
/**
35
* Scalar types:
36
* SCALAR_TYPE_COUNT - for storing a numeric value
37
* SCALAR_TYPE_STRING - for storing a string value
38
* SCALAR_TYPE_BOOLEAN - for storing a boolean value
39
*/
40
const unsigned long SCALAR_TYPE_COUNT = 0;
41
const unsigned long SCALAR_TYPE_STRING = 1;
42
const unsigned long SCALAR_TYPE_BOOLEAN = 2;
43
44
/**
45
* Dataset types:
46
* DATASET_ALL_CHANNELS - the basic dataset that is on-by-default on all channels
47
* DATASET_PRERELEASE_CHANNELS - the extended dataset that is opt-in on release,
48
* opt-out on pre-release channels.
49
*/
50
const unsigned long DATASET_ALL_CHANNELS = 0;
51
const unsigned long DATASET_PRERELEASE_CHANNELS = 1;
52
53
54
/**
55
* Serializes the histograms from the given store to a JSON-style object.
56
* The returned structure looks like:
57
* { "process": { "name1": histogramData1, "name2": histogramData2 }, ... }
58
*
59
* Each histogram is represented in a packed format and has the following properties:
60
* bucket_count - Number of buckets of this histogram
61
* histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, HISTOGRAM_BOOLEAN,
62
* HISTOGRAM_FLAG, HISTOGRAM_COUNT, or HISTOGRAM_CATEGORICAL
63
* sum - sum of the bucket contents
64
* range - A 2-item array of minimum and maximum bucket size
65
* values - Map from bucket to the bucket's count
66
*
67
* @param aStoreName The name of the store to snapshot.
68
* Defaults to "main".
69
* Custom stores are available when probes have them defined.
70
* See the `record_into_store` attribute on histograms.
72
* @param aClearStore Whether to clear out the histograms in the named store after snapshotting.
73
* Defaults to false.
74
* @param aFilterTest If true, `TELEMETRY_TEST_` histograms will be filtered out.
75
Filtered histograms are still cleared if `aClearStore` is true.
76
* Defaults to false.
77
*/
78
[implicit_jscontext]
79
jsval getSnapshotForHistograms([optional] in ACString aStoreName, [optional] in boolean aClearStore, [optional] in boolean aFilterTest);
80
81
/**
82
* Serializes the keyed histograms from the given store to a JSON-style object.
83
* The returned structure looks like:
84
* { "process": { "name1": { "key_1": histogramData1, "key_2": histogramData2 }, ...}, ... }
85
*
86
* @param aStoreName The name of the store to snapshot.
87
* Defaults to "main".
88
* Custom stores are available when probes have them defined.
89
* See the `record_into_store` attribute on histograms.
91
* @param aClearStore Whether to clear out the keyed histograms in the named store after snapshotting.
92
* Defaults to false.
93
* @param aFilterTest If true, `TELEMETRY_TEST_` histograms will be filtered out.
94
Filtered histograms are still cleared if `aClearStore` is true.
95
* Defaults to false.
96
*/
97
[implicit_jscontext]
98
jsval getSnapshotForKeyedHistograms([optional] in ACString aStoreName, [optional] in boolean aClearStore, [optional] in boolean aFilterTest);
99
100
/**
101
* Serializes the scalars from the given store to a JSON-style object.
102
* The returned structure looks like:
103
* { "process": { "category1.probe": 1,"category1.other_probe": false, ... }, ... }.
104
*
105
* @param aStoreName The name of the store to snapshot.
106
* Defaults to "main".
107
* Custom stores are available when probes have them defined.
108
* See the `record_into_store` attribute on scalars.
110
* @param aClearStore Whether to clear out the scalars in the named store after snapshotting.
111
* Defaults to false.
112
* @param aFilterTest If true, `telemetry.test` scalars will be filtered out.
113
Filtered scalars are still cleared if `aClearStore` is true.
114
* Defaults to false.
115
*/
116
[implicit_jscontext]
117
jsval getSnapshotForScalars([optional] in ACString aStoreName, [optional] in boolean aClearStore, [optional] in boolean aFilterTest);
118
119
/**
120
* Serializes the keyed scalars from the given store to a JSON-style object.
121
* The returned structure looks like:
122
* { "process": { "category1.probe": { "key_1": 2, "key_2": 1, ... }, ... }, ... }
123
*
124
* @param aStoreName The name of the store to snapshot.
125
* Defaults to "main".
126
* Custom stores are available when probes have them defined.
127
* See the `record_into_store` attribute on scalars.
129
* @param aClearStore Whether to clear out the keyed scalars in the named store after snapshotting.
130
* Defaults to false.
131
* @param aFilterTest If true, `telemetry.test` scalars will be filtered out.
132
Filtered scalars are still cleared if `aClearStore` is true.
133
* Defaults to false.
134
*/
135
[implicit_jscontext]
136
jsval getSnapshotForKeyedScalars([optional] in ACString aStoreName, [optional] in boolean aClearStore, [optional] in boolean aFilterTest);
137
138
/**
139
* The amount of time, in milliseconds, that the last session took
140
* to shutdown. Reads as 0 to indicate failure.
141
*/
142
readonly attribute uint32_t lastShutdownDuration;
143
144
/**
145
* The number of failed profile lock attempts that have occurred prior to
146
* successfully locking the profile
147
*/
148
readonly attribute uint32_t failedProfileLockCount;
149
150
/*
151
* An object containing information about slow SQL statements.
152
*
153
* {
154
* mainThread: { "sqlString1": [<hit count>, <total time>], "sqlString2": [...], ... },
155
* otherThreads: { "sqlString3": [<hit count>, <total time>], "sqlString4": [...], ... }
156
* }
157
*
158
* where:
159
* mainThread: Slow statements that executed on the main thread
160
* otherThreads: Slow statements that executed on a non-main thread
161
* sqlString - String of the offending statement (see note)
162
* hit count - The number of times this statement required longer than the threshold time to execute
163
* total time - The sum of all execution times above the threshold time for this statement
164
*
165
* Note that dynamic SQL strings and SQL strings executed against addon DBs could contain private information.
166
* This property represents such SQL as aggregate database-level stats and the sqlString contains the database
167
* filename instead.
168
*/
169
[implicit_jscontext]
170
readonly attribute jsval slowSQL;
171
172
/*
173
* See slowSQL above.
174
*
175
* An object containing full strings of every slow SQL statement if toolkit.telemetry.debugSlowSql = true
176
* The returned SQL strings may contain private information and should not be reported to Telemetry.
177
*/
178
[implicit_jscontext]
179
readonly attribute jsval debugSlowSQL;
180
181
/*
182
* An object containing information about Webrtc related stats. For now it
183
* only contains local and remote ICE candidates avaiable when a Webrtc
184
* PeerConnection gets terminated.
185
*/
186
[implicit_jscontext]
187
readonly attribute jsval webrtcStats;
188
189
/**
190
* A number representing the highest number of concurrent threads
191
* reached during this session.
192
*/
193
readonly attribute uint32_t maximalNumberOfConcurrentThreads;
194
195
/*
196
* An array of untrusted module load events. Each element describes one or
197
* more modules that were loaded, contextual information at the time of the
198
* event (including stack trace), and flags describing the module's
199
* trustworthiness.
200
*/
201
[implicit_jscontext]
202
Promise getUntrustedModuleLoadEvents();
203
204
/*
205
* Record the current thread's call stack on demand. Note that, the stack is
206
* only captured at the first call. All subsequent calls result in incrementing
207
* the capture counter without doing actual stack unwinding.
208
*
209
* @param aKey - A user defined key associated with the captured stack.
210
*
211
* NOTE: Unwinding call stacks is an expensive operation performance-wise.
212
*/
213
void captureStack(in ACString name);
214
215
/*
216
* Returns a snapshot of captured stacks. The data has the following structure:
217
*
218
* {
219
* "memoryMap": [
220
* ["wgdi32.pdb", "08A541B5942242BDB4AEABD8C87E4CFF2"],
221
* ["igd10iumd32.pdb", "D36DEBF2E78149B5BE1856B772F1C3991"],
222
* ... other entries in the format ["module name", "breakpad identifier"] ...
223
* ],
224
* "stacks": [
225
* [
226
* [
227
* 0, // the module index or -1 for invalid module indices
228
* 190649 // the offset of this program counter in its module or an absolute pc
229
* ],
230
* [1, 2540075],
231
* ... other frames ...
232
* ],
233
* ... other stacks ...
234
* ],
235
* "captures": [["string-key", stack-index, count], ... ]
236
* }
237
*
238
* @param clear Whether to clear out the subsession histograms after taking a snapshot.
239
*
240
* @return A snapshot of captured stacks.
241
*/
242
[implicit_jscontext]
243
jsval snapshotCapturedStacks([optional] in boolean clear);
244
245
/*
246
* Asynchronously get an array of the modules loaded in the process.
247
*
248
* The data has the following structure:
249
*
250
* [
251
* {
252
* "name": <string>, // Name of the module file (e.g. xul.dll)
253
* "version": <string>, // Version of the module
254
* "debugName": <string>, // ID of the debug information file
255
* "debugID": <string>, // Name of the debug information file
256
* "certSubject": <string>, // Name of the organization that signed the binary (Optional, only defined when present)
257
* },
258
* ...
259
* ]
260
*
261
* @return A promise that resolves to an array of modules or rejects with
262
NS_ERROR_FAILURE on failure.
263
* @throws NS_ERROR_NOT_IMPLEMENTED if the Gecko profiler is not enabled.
264
*/
265
[implicit_jscontext]
266
Promise getLoadedModules();
267
268
/*
269
* An object with two fields: memoryMap and stacks.
270
* * memoryMap is a list of loaded libraries.
271
* * stacks is a list of stacks. Each stack is a list of pairs of the form
272
* [moduleIndex, offset]. The moduleIndex is an index into the memoryMap and
273
* offset is an offset in the library at memoryMap[moduleIndex].
274
* This format is used to make it easier to send the stacks to the
275
* symbolication server.
276
*/
277
[implicit_jscontext]
278
readonly attribute jsval lateWrites;
279
280
/**
281
* Create and return a histogram registered in TelemetryHistograms.h.
282
*
283
* @param id - unique identifier from TelemetryHistograms.h
284
* The returned object has the following functions:
285
* add(int) - Adds an int value to the appropriate bucket.
286
* snapshot([optional] {store}) - Returns a snapshot of the histogram with the same data fields
287
as in getSnapshotForHistograms().
288
Defaults to the "main" store.
289
* clear([optional] {store}) - Zeros out the histogram's buckets and sum.
290
Defaults to the "main" store.
291
Note: This is intended to be only used in tests.
292
*/
293
[implicit_jscontext]
294
jsval getHistogramById(in ACString id);
295
296
/**
297
* Create and return a histogram registered in TelemetryHistograms.h.
298
*
299
* @param id - unique identifier from TelemetryHistograms.h
300
* The returned object has the following functions:
301
* add(string key, [optional] int) - Add an int value to the histogram for that key.
302
If no histogram for that key exists yet, it is created.
303
* snapshot([optional] {store}) - Returns the snapshots of all the registered keys in the form
304
{key1: snapshot1, key2: snapshot2, ...} in the specified store.
305
* Defaults to the "main" store.
306
* keys([optional] {store}) - Returns an array with the string keys of the currently registered
307
histograms in the given store.
308
Defaults to "main".
309
* clear([optional] {store}) - Clears the registered histograms from this.
310
* Defaults to the "main" store.
311
* Note: This is intended to be only used in tests.
312
*/
313
[implicit_jscontext]
314
jsval getKeyedHistogramById(in ACString id);
315
316
/**
317
* A flag indicating if Telemetry can record base data (FHR data). This is true if the
318
* FHR data reporting service or self-support are enabled.
319
*
320
* In the unlikely event that adding a new base probe is needed, please check the data
321
* collection wiki at https://wiki.mozilla.org/Firefox/Data_Collection and talk to the
322
* Telemetry team.
323
*/
324
attribute boolean canRecordBase;
325
326
/**
327
* A flag indicating if Telemetry is allowed to record extended data. Returns false if
328
* the user hasn't opted into "extended Telemetry" on the Release channel, when the
329
* user has explicitly opted out of Telemetry on Nightly/Aurora/Beta or if manually
330
* set to false during tests.
331
*
332
* Set this to false in tests to disable gathering of extended telemetry statistics.
333
*/
334
attribute boolean canRecordExtended;
335
336
/**
337
* A flag indicating whether Telemetry is recording release data, which is a
338
* smallish subset of our usage data that we're prepared to handle from our
339
* largish release population.
340
*
341
* This is true most of the time.
342
*
343
* This does not indicate whether Telemetry will send any data. That is
344
* governed by user preference and other mechanisms.
345
*
346
* You may use this to determine if it's okay to record your data.
347
*/
348
readonly attribute boolean canRecordReleaseData;
349
350
/**
351
* A flag indicating whether Telemetry is recording prerelease data, which is
352
* a largish amount of usage data that we're prepared to handle from our
353
* smallish pre-release population.
354
*
355
* This is true on pre-release branches of Firefox.
356
*
357
* This does not indicate whether Telemetry will send any data. That is
358
* governed by user preference and other mechanisms.
359
*
360
* You may use this to determine if it's okay to record your data.
361
*/
362
readonly attribute boolean canRecordPrereleaseData;
363
364
/**
365
* A flag indicating whether Telemetry can submit official results (for base or extended
366
* data). This is true on official, non-debug builds with built in support for Mozilla
367
* Telemetry reporting.
368
*/
369
readonly attribute boolean isOfficialTelemetry;
370
371
/**
372
* Enable/disable recording for this histogram at runtime.
373
* Recording is enabled by default, unless listed at kRecordingInitiallyDisabledIDs[].
374
* Name must be a valid Histogram identifier, otherwise an assertion will be triggered.
375
*
376
* @param id - unique identifier from histograms.json
377
* @param enabled - whether or not to enable recording from now on.
378
*/
379
void setHistogramRecordingEnabled(in ACString id, in boolean enabled);
380
381
/**
382
* Read data from the previous run. After the callback is called, the last
383
* shutdown time is available in lastShutdownDuration and any late
384
* writes in lateWrites.
385
*/
386
void asyncFetchTelemetryData(in nsIFetchTelemetryDataCallback aCallback);
387
388
/**
389
* Get statistics of file IO reports, null, if not recorded.
390
*
391
* The statistics are returned as an object whose propoerties are the names
392
* of the files that have been accessed and whose corresponding values are
393
* arrays of size three, representing startup, normal, and shutdown stages.
394
* Each stage's entry is either null or an array with the layout
395
* [total_time, #creates, #reads, #writes, #fsyncs, #stats]
396
*/
397
[implicit_jscontext]
398
readonly attribute jsval fileIOReports;
399
400
/**
401
* Return the number of milliseconds since process start using monotonic
402
* timestamps (unaffected by system clock changes).
403
* @throws NS_ERROR_NOT_AVAILABLE if TimeStamp doesn't have the data.
404
*/
405
double msSinceProcessStart();
406
407
/**
408
* Time since the system wide epoch. This is not a monotonic timer but
409
* can be used across process boundaries.
410
*/
411
double msSystemNow();
412
413
/**
414
* Adds the value to the given scalar.
415
*
416
* @param aName The scalar name.
417
* @param aValue The numeric value to add to the scalar. Only unsigned integers supported.
418
*/
419
[implicit_jscontext]
420
void scalarAdd(in ACString aName, in jsval aValue);
421
422
/**
423
* Sets the scalar to the given value.
424
*
425
* @param aName The scalar name.
426
* @param aValue The value to set the scalar to. If the type of aValue doesn't match the
427
* type of the scalar, the function will fail. For scalar string types, the this
428
* is truncated to 50 characters.
429
*/
430
[implicit_jscontext]
431
void scalarSet(in ACString aName, in jsval aValue);
432
433
/**
434
* Sets the scalar to the maximum of the current and the passed value.
435
*
436
* @param aName The scalar name.
437
* @param aValue The numeric value to set the scalar to. Only unsigned integers supported.
438
*/
439
[implicit_jscontext]
440
void scalarSetMaximum(in ACString aName, in jsval aValue);
441
442
/**
443
* Adds the value to the given keyed scalar.
444
*
445
* @param aName The scalar name.
446
* @param aKey The key name.
447
* @param aValue The numeric value to add to the scalar. Only unsigned integers supported.
448
*/
449
[implicit_jscontext]
450
void keyedScalarAdd(in ACString aName, in AString aKey, in jsval aValue);
451
452
/**
453
* Sets the keyed scalar to the given value.
454
*
455
* @param aName The scalar name.
456
* @param aKey The key name.
457
* @param aValue The value to set the scalar to. If the type of aValue doesn't match the
458
* type of the scalar, the function will fail.
459
*/
460
[implicit_jscontext]
461
void keyedScalarSet(in ACString aName, in AString aKey, in jsval aValue);
462
463
/**
464
* Sets the keyed scalar to the maximum of the current and the passed value.
465
*
466
* @param aName The scalar name.
467
* @param aKey The key name.
468
* @param aValue The numeric value to set the scalar to. Only unsigned integers supported.
469
*/
470
[implicit_jscontext]
471
void keyedScalarSetMaximum(in ACString aName, in AString aKey, in jsval aValue);
472
473
/**
474
* Resets all the stored scalars. This is intended to be only used in tests.
475
*/
476
void clearScalars();
477
478
/**
479
* Immediately sends any Telemetry batched on this process to the parent
480
* process. This is intended only to be used on process shutdown.
481
*/
482
void flushBatchedChildTelemetry();
483
484
/**
485
* Record an event in Telemetry.
486
*
487
* @param aCategory The category name.
488
* @param aMethod The method name.
489
* @param aObject The object name.
490
* @param aValue An optional string value to record.
491
* @param aExtra An optional object of the form (string -> string).
492
* It should only contain registered extra keys.
493
*
494
* @throws NS_ERROR_INVALID_ARG When trying to record an unknown event.
495
*/
496
[implicit_jscontext, optional_argc]
497
void recordEvent(in ACString aCategory, in ACString aMethod, in ACString aObject, [optional] in jsval aValue, [optional] in jsval extra);
498
499
/**
500
* Enable recording of events in a category.
501
* Events default to recording disabled. This allows to toggle recording for all events
502
* in the specified category.
503
*
504
* @param aCategory The category name.
505
* @param aEnabled Whether recording is enabled for events in that category.
506
*/
507
void setEventRecordingEnabled(in ACString aCategory, in boolean aEnabled);
508
509
/**
510
* Serializes the recorded events to a JSON-appropriate array and optionally resets them.
511
* The returned structure looks like this:
512
* [
513
* // [timestamp, category, method, object, stringValue, extraValues]
514
* [43245, "category1", "method1", "object1", "string value", null],
515
* [43258, "category1", "method2", "object1", null, {"key1": "string value"}],
516
* ...
517
* ]
518
*
519
* @param aDataset DATASET_ALL_CHANNELS or DATASET_PRERELEASE_CHANNELS.
520
* @param [aClear=false] Whether to clear out the events after snapshotting.
521
* @param aEventLimit How many events per process to limit the snapshot to contain, all if unspecified.
522
* Even if aClear, the leftover event records are not cleared.
523
*/
524
[implicit_jscontext, optional_argc]
525
jsval snapshotEvents(in uint32_t aDataset, [optional] in boolean aClear, [optional] in uint32_t aEventLimit);
526
527
/**
528
* Register new events to record them from addons. This allows registering multiple
529
* events for a category. They will be valid only for the current Firefox session.
530
* Note that events shipping in Firefox should be registered in Events.yaml.
531
*
532
* @param aCategory The unique category the events are registered in.
533
* @param aEventData An object that contains registration data for 1-N events of the form:
534
* {
535
* "categoryName": {
536
* "methods": ["test1"],
537
* "objects": ["object1"],
538
* "record_on_release": false,
539
* "extra_keys": ["key1", "key2"], // optional
540
* "expired": false // optional, defaults to false.
541
* },
542
* ...
543
* }
544
* @param aEventData.<name>.methods List of methods for this event entry.
545
* @param aEventData.<name>.objects List of objects for this event entry.
546
* @param aEventData.<name>.extra_keys Optional, list of allowed extra keys for this event entry.
547
* @param aEventData.<name>.record_on_release Optional, whether to record this data on release.
548
* Defaults to false.
549
* @param aEventData.<name>.expired Optional, whether this event entry is expired. This allows
550
* recording it without error, but it will be discarded. Defaults to false.
551
*/
552
[implicit_jscontext]
553
void registerEvents(in ACString aCategory, in jsval aEventData);
554
555
/**
556
* Parent process only. Register dynamic builtin events. The parameters
557
* have the same meaning as the usual |registerEvents| function.
558
*
559
* This function is only meant to be used to support the "artifact build"/
560
* "build faster" developers by allowing to add new events without rebuilding
561
* the C++ components including the headers files.
562
*/
563
[implicit_jscontext]
564
void registerBuiltinEvents(in ACString aCategory, in jsval aEventData);
565
566
/**
567
* Parent process only. Register new scalars to record them from addons. This
568
* allows registering multiple scalars for a category. They will be valid only for
569
* the current Firefox session.
570
* Note that scalars shipping in Firefox should be registered in Scalars.yaml.
571
*
572
* @param aCategoryName The unique category the scalars are registered in.
573
* @param aScalarData An object that contains registration data for multiple scalars in the form:
574
* {
575
* "sample_scalar": {
576
* "kind": Ci.nsITelemetry.SCALAR_TYPE_COUNT,
577
* "keyed": true, //optional, defaults to false
578
* "record_on_release: true, // optional, defaults to false
579
* "expired": false // optional, defaults to false.
580
* },
581
* ...
582
* }
583
* @param aScalarData.<name>.kind One of the scalar types defined in this file (SCALAR_TYPE_*)
584
* @param aScalarData.<name>.keyed Optional, whether this is a keyed scalar or not. Defaults to false.
585
* @param aScalarData.<name>.record_on_release Optional, whether to record this data on release.
586
* Defaults to false.
587
* @param aScalarData.<name>.expired Optional, whether this scalar entry is expired. This allows
588
* recording it without error, but it will be discarded. Defaults to false.
589
*/
590
[implicit_jscontext]
591
void registerScalars(in ACString aCategoryName, in jsval aScalarData);
592
593
/**
594
* Parent process only. Register dynamic builtin scalars. The parameters
595
* have the same meaning as the usual |registerScalars| function.
596
*
597
* This function is only meant to be used to support the "artifact build"/
598
* "build faster" developers by allowing to add new scalars without rebuilding
599
* the C++ components including the headers files.
600
*/
601
[implicit_jscontext]
602
void registerBuiltinScalars(in ACString aCategoryName, in jsval aScalarData);
603
604
/**
605
* Resets all the stored events. This is intended to be only used in tests.
606
*/
607
void clearEvents();
608
609
/**
610
* Reset the current product. This is intended to be only used in Android tests.
611
* It will fail on Desktop.
612
*/
613
void resetCurrentProduct();
614
615
/**
616
* Get a list of all registered stores.
617
*
618
* The list is deduplicated, but unordered.
619
*/
620
[implicit_jscontext]
621
jsval getAllStores();
622
623
/**
624
* Reset the storage for all the collection primitives so that GeckoView
625
* can issue a single Clear signal for histograms, scalars, events, ...
626
*
627
* This is needed for supporting the current implementation of GeckoView
628
* measurement persistence: all the measurements are stored in a single file and
629
* they can't be cleared independently.
630
*
631
* Please note that this is only intended to be used by GeckoViewTelemetryController.
632
*/
633
void clearProbes();
634
635
/**
636
* Does early, cheap initialization for native telemetry data providers.
637
* Currently, this includes only MemoryTelemetry.
638
*/
639
void earlyInit();
640
641
/**
642
* Does late, expensive initialization for native telemetry data providers.
643
* Currently, this includes only MemoryTelemetry.
644
*
645
* This should only be called after startup has completed and the event loop
646
* is idle.
647
*/
648
void delayedInit();
649
650
/**
651
* Shuts down native telemetry providers. Currently, this includes only
652
* MemoryTelemetry.
653
*/
654
void shutdown();
655
656
/**
657
* Gathers telemetry data for memory usage and records it to the data store.
658
* Returns a promise which resolves when asynchronous data collection has
659
* completed and all data has been recorded.
660
*/
661
[implicit_jscontext]
662
Promise gatherMemory();
663
664
/**
665
* Serializes the per-origin data in plain text, optionally clearing
666
* the storage. Only to be used by about:telemetry.
667
*
668
* The returned structure looks like:
669
* { metric: {origin1: count1, origin2: count2, ...}, ...}
670
*
671
* @param aClear Whether to clear the storage. Default false.
672
* @return a snapshot of the per-origin data.
673
*/
674
[implicit_jscontext]
675
jsval getOriginSnapshot([optional] in boolean aClear);
676
677
/**
678
* Encodes the per-origin information then serializes it.
679
* Returns a Promise.
680
*
681
* @param aClear Whether to clear the storage. Default false.
682
* @return Promise that resolves to the serialized encoded data.
683
*/
684
[implicit_jscontext]
685
Promise getEncodedOriginSnapshot([optional] in boolean aClear);
686
687
/**
688
* Clears Firefox Origin Telemetry. Only to be used in tests.
689
*/
690
void clearOrigins();
691
};