2011-04-27 18:07:02 +00:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2011-04-27 18:07:02 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2011-12-09 20:15:53 +00:00
|
|
|
#include "nsIFile.idl"
|
|
|
|
|
2012-06-11 18:35:35 +00:00
|
|
|
[scriptable, uuid(de54f594-4c20-4968-a27a-83b38ff952b9)]
|
2011-04-27 18:07:02 +00:00
|
|
|
interface nsITelemetry : nsISupports
|
|
|
|
{
|
2011-05-20 02:33:05 +00:00
|
|
|
/**
|
|
|
|
* Histogram types:
|
|
|
|
* HISTOGRAM_EXPONENTIAL - buckets increase exponentially
|
|
|
|
* HISTOGRAM_LINEAR - buckets increase linearly
|
2011-06-20 21:47:58 +00:00
|
|
|
* HISTOGRAM_BOOLEAN - For storing 0/1 values
|
2012-03-02 14:59:38 +00:00
|
|
|
* HISTOGRAM_FLAG - For storing a single value; its count is always == 1.
|
2011-05-20 02:33:05 +00:00
|
|
|
*/
|
|
|
|
const unsigned long HISTOGRAM_EXPONENTIAL = 0;
|
|
|
|
const unsigned long HISTOGRAM_LINEAR = 1;
|
2011-06-20 21:47:58 +00:00
|
|
|
const unsigned long HISTOGRAM_BOOLEAN = 2;
|
2012-03-02 14:59:38 +00:00
|
|
|
const unsigned long HISTOGRAM_FLAG = 3;
|
2011-05-20 02:33:05 +00:00
|
|
|
|
2011-04-27 18:07:02 +00:00
|
|
|
/*
|
|
|
|
* An object containing a snapshot from all of the currently registered histograms.
|
|
|
|
* { name1: {data1}, name2:{data2}...}
|
|
|
|
* where data is consists of the following properties:
|
|
|
|
* min - Minimal bucket size
|
|
|
|
* max - Maximum bucket size
|
2012-01-20 21:56:48 +00:00
|
|
|
* histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, or HISTOGRAM_BOOLEAN
|
2011-04-27 18:07:02 +00:00
|
|
|
* counts - array representing contents of the buckets in the histogram
|
|
|
|
* ranges - an array with calculated bucket sizes
|
|
|
|
* sum - sum of the bucket contents
|
2011-06-30 21:58:00 +00:00
|
|
|
* static - true for histograms defined in TelemetryHistograms.h, false for ones defined with newHistogram
|
2011-04-27 18:07:02 +00:00
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval histogramSnapshots;
|
|
|
|
|
2011-12-14 20:04:25 +00:00
|
|
|
/*
|
2012-03-21 17:26:48 +00:00
|
|
|
* An object containing information about slow SQL statements.
|
2011-12-14 20:04:25 +00:00
|
|
|
*
|
|
|
|
* {
|
|
|
|
* mainThread: { "sqlString1": [<hit count>, <total time>], "sqlString2": [...], ... },
|
|
|
|
* otherThreads: { "sqlString3": [<hit count>, <total time>], "sqlString4": [...], ... }
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* where:
|
|
|
|
* mainThread: Slow statements that executed on the main thread
|
|
|
|
* otherThreads: Slow statements that executed on a non-main thread
|
2012-03-21 17:26:48 +00:00
|
|
|
* sqlString - String of the offending statement (see note)
|
2011-12-14 20:04:25 +00:00
|
|
|
* hit count - The number of times this statement required longer than the threshold time to execute
|
|
|
|
* total time - The sum of all execution times above the threshold time for this statement
|
2012-03-21 17:26:48 +00:00
|
|
|
*
|
|
|
|
* Note that dynamic SQL strings and SQL strings executed against addon DBs could contain private information.
|
|
|
|
* This property represents such SQL as aggregate database-level stats and the sqlString contains the database
|
|
|
|
* filename instead.
|
2011-12-14 20:04:25 +00:00
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval slowSQL;
|
|
|
|
|
2012-03-21 17:26:48 +00:00
|
|
|
/*
|
|
|
|
* See slowSQL above.
|
|
|
|
*
|
|
|
|
* An object containing full strings of every slow SQL statement if toolkit.telemetry.debugSlowSql = true
|
|
|
|
* The returned SQL strings may contain private information and should not be reported to Telemetry.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval debugSlowSQL;
|
|
|
|
|
2012-03-12 11:07:05 +00:00
|
|
|
/*
|
|
|
|
* An array of chrome hang reports. Each element is a hang report represented
|
|
|
|
* as an object containing the hang duration, call stack PCs and information
|
|
|
|
* about modules in memory.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval chromeHangs;
|
|
|
|
|
2012-01-06 19:40:45 +00:00
|
|
|
/**
|
|
|
|
* An object whose properties are the names of histograms defined in
|
|
|
|
* TelemetryHistograms.h and whose corresponding values are the textual
|
|
|
|
* comments associated with said histograms.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval registeredHistograms;
|
|
|
|
|
2011-04-27 18:07:02 +00:00
|
|
|
/**
|
2012-01-20 21:56:48 +00:00
|
|
|
* Create and return a histogram. Parameters:
|
2011-06-20 21:47:58 +00:00
|
|
|
*
|
2011-04-27 18:07:02 +00:00
|
|
|
* @param name Unique histogram name
|
|
|
|
* @param min - Minimal bucket size
|
|
|
|
* @param max - Maximum bucket size
|
|
|
|
* @param bucket_count - number of buckets in the histogram.
|
2012-01-20 21:56:48 +00:00
|
|
|
* @param type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR or HISTOGRAM_BOOLEAN
|
2011-04-27 18:07:02 +00:00
|
|
|
* The returned object has the following functions:
|
|
|
|
* add(int) - Adds an int value to the appropriate bucket
|
|
|
|
* snapshot() - Returns a snapshot of the histogram with the same data fields as in histogramSnapshots()
|
2012-05-08 19:39:24 +00:00
|
|
|
* clear() - Zeros out the histogram's buckets and sum
|
2011-04-27 18:07:02 +00:00
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
2012-08-22 15:56:38 +00:00
|
|
|
jsval newHistogram(in ACString name, in uint32_t min, in uint32_t max, in uint32_t bucket_count, in unsigned long histogram_type);
|
2011-06-20 21:47:58 +00:00
|
|
|
|
2012-01-06 19:40:04 +00:00
|
|
|
/**
|
|
|
|
* Create a histogram using the current state of an existing histogram. The
|
|
|
|
* existing histogram must be registered in TelemetryHistograms.h.
|
|
|
|
*
|
|
|
|
* @param name Unique histogram name
|
|
|
|
* @param existing_name Existing histogram name
|
|
|
|
* The returned object has the same functions as a histogram returned from newHistogram.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
jsval histogramFrom(in ACString name, in ACString existing_name);
|
|
|
|
|
2011-06-20 21:47:58 +00:00
|
|
|
/**
|
|
|
|
* Same as newHistogram above, but for histograms registered in TelemetryHistograms.h.
|
|
|
|
*
|
|
|
|
* @param id - unique identifier from TelemetryHistograms.h
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
jsval getHistogramById(in ACString id);
|
2011-06-28 23:57:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set this to false to disable gathering of telemetry statistics.
|
|
|
|
*/
|
|
|
|
attribute boolean canRecord;
|
2012-02-02 04:42:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A flag indicating whether Telemetry can submit official results.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean canSend;
|
2012-01-20 21:56:48 +00:00
|
|
|
|
|
|
|
/** Addon telemetry hooks */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a histogram for an addon. Throws an error if the
|
|
|
|
* histogram name has been registered previously.
|
|
|
|
*
|
|
|
|
* @param addon_id - Unique ID of the addon
|
|
|
|
* @param name - Unique histogram name
|
|
|
|
* @param min - Minimal bucket size
|
|
|
|
* @param max - Maximum bucket size
|
|
|
|
* @param bucket_count - number of buckets in the histogram
|
|
|
|
* @param histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, or
|
|
|
|
* HISTOGRAM_BOOLEAN
|
|
|
|
*/
|
|
|
|
void registerAddonHistogram(in ACString addon_id, in ACString name,
|
2012-08-22 15:56:38 +00:00
|
|
|
in uint32_t min, in uint32_t max,
|
|
|
|
in uint32_t bucket_count,
|
2012-01-20 21:56:48 +00:00
|
|
|
in unsigned long histogram_type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a histogram previously registered via
|
|
|
|
* registerAddonHistogram. Throws an error if the id/name combo has
|
|
|
|
* not been registered via registerAddonHistogram.
|
|
|
|
*
|
|
|
|
* @param addon_id - Unique ID of the addon
|
|
|
|
* @param name - Registered histogram name
|
|
|
|
*
|
|
|
|
* The returned object has the same functions as a histogram returned
|
|
|
|
* from newHistogram.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
jsval getAddonHistogram(in ACString addon_id, in ACString name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete all histograms associated with the given addon id.
|
|
|
|
*
|
|
|
|
* @param addon_id - Unique ID of the addon
|
|
|
|
*/
|
|
|
|
void unregisterAddonHistograms(in ACString addon_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An object containing a snapshot from all of the currently
|
|
|
|
* registered addon histograms.
|
|
|
|
* { addon-id1 : data1, ... }
|
|
|
|
*
|
|
|
|
* where data is an object whose properties are the names of the
|
|
|
|
* addon's histograms and whose corresponding values are as in
|
|
|
|
* histogramSnapshots.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval addonHistogramSnapshots;
|
2011-04-27 18:07:02 +00:00
|
|
|
};
|