toolkit/components/telemetry/nsITelemetry.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7 #include "nsIFile.idl"
michael@0 8
michael@0 9 [scriptable,function, uuid(3d3b9075-5549-4244-9c08-b64fefa1dd60)]
michael@0 10 interface nsIFetchTelemetryDataCallback : nsISupports
michael@0 11 {
michael@0 12 void complete();
michael@0 13 };
michael@0 14
michael@0 15 [scriptable, uuid(4e4bfc35-dac6-4b28-ade4-7e45760051d5)]
michael@0 16 interface nsITelemetry : nsISupports
michael@0 17 {
michael@0 18 /**
michael@0 19 * Histogram types:
michael@0 20 * HISTOGRAM_EXPONENTIAL - buckets increase exponentially
michael@0 21 * HISTOGRAM_LINEAR - buckets increase linearly
michael@0 22 * HISTOGRAM_BOOLEAN - For storing 0/1 values
michael@0 23 * HISTOGRAM_FLAG - For storing a single value; its count is always == 1.
michael@0 24 */
michael@0 25 const unsigned long HISTOGRAM_EXPONENTIAL = 0;
michael@0 26 const unsigned long HISTOGRAM_LINEAR = 1;
michael@0 27 const unsigned long HISTOGRAM_BOOLEAN = 2;
michael@0 28 const unsigned long HISTOGRAM_FLAG = 3;
michael@0 29
michael@0 30 /*
michael@0 31 * An object containing a snapshot from all of the currently registered histograms.
michael@0 32 * { name1: {data1}, name2:{data2}...}
michael@0 33 * where data is consists of the following properties:
michael@0 34 * min - Minimal bucket size
michael@0 35 * max - Maximum bucket size
michael@0 36 * histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, or HISTOGRAM_BOOLEAN
michael@0 37 * counts - array representing contents of the buckets in the histogram
michael@0 38 * ranges - an array with calculated bucket sizes
michael@0 39 * sum - sum of the bucket contents
michael@0 40 * static - true for histograms defined in TelemetryHistograms.h, false for ones defined with newHistogram
michael@0 41 */
michael@0 42 [implicit_jscontext]
michael@0 43 readonly attribute jsval histogramSnapshots;
michael@0 44
michael@0 45 /**
michael@0 46 * The amount of time, in milliseconds, that the last session took
michael@0 47 * to shutdown. Reads as 0 to indicate failure.
michael@0 48 */
michael@0 49 readonly attribute uint32_t lastShutdownDuration;
michael@0 50
michael@0 51 /**
michael@0 52 * The number of failed profile lock attempts that have occurred prior to
michael@0 53 * successfully locking the profile
michael@0 54 */
michael@0 55 readonly attribute uint32_t failedProfileLockCount;
michael@0 56
michael@0 57 /*
michael@0 58 * An object containing information about slow SQL statements.
michael@0 59 *
michael@0 60 * {
michael@0 61 * mainThread: { "sqlString1": [<hit count>, <total time>], "sqlString2": [...], ... },
michael@0 62 * otherThreads: { "sqlString3": [<hit count>, <total time>], "sqlString4": [...], ... }
michael@0 63 * }
michael@0 64 *
michael@0 65 * where:
michael@0 66 * mainThread: Slow statements that executed on the main thread
michael@0 67 * otherThreads: Slow statements that executed on a non-main thread
michael@0 68 * sqlString - String of the offending statement (see note)
michael@0 69 * hit count - The number of times this statement required longer than the threshold time to execute
michael@0 70 * total time - The sum of all execution times above the threshold time for this statement
michael@0 71 *
michael@0 72 * Note that dynamic SQL strings and SQL strings executed against addon DBs could contain private information.
michael@0 73 * This property represents such SQL as aggregate database-level stats and the sqlString contains the database
michael@0 74 * filename instead.
michael@0 75 */
michael@0 76 [implicit_jscontext]
michael@0 77 readonly attribute jsval slowSQL;
michael@0 78
michael@0 79 /*
michael@0 80 * See slowSQL above.
michael@0 81 *
michael@0 82 * An object containing full strings of every slow SQL statement if toolkit.telemetry.debugSlowSql = true
michael@0 83 * The returned SQL strings may contain private information and should not be reported to Telemetry.
michael@0 84 */
michael@0 85 [implicit_jscontext]
michael@0 86 readonly attribute jsval debugSlowSQL;
michael@0 87
michael@0 88 /**
michael@0 89 * A number representing the highest number of concurrent threads
michael@0 90 * reached during this session.
michael@0 91 */
michael@0 92 readonly attribute uint32_t maximalNumberOfConcurrentThreads;
michael@0 93
michael@0 94 /*
michael@0 95 * An array of chrome hang reports. Each element is a hang report represented
michael@0 96 * as an object containing the hang duration, call stack PCs and information
michael@0 97 * about modules in memory.
michael@0 98 */
michael@0 99 [implicit_jscontext]
michael@0 100 readonly attribute jsval chromeHangs;
michael@0 101
michael@0 102 /*
michael@0 103 * An array of thread hang stats,
michael@0 104 * [<thread>, <thread>, ...]
michael@0 105 * <thread> represents a single thread,
michael@0 106 * {"name": "<name>",
michael@0 107 * "activity": <time>,
michael@0 108 * "hangs": [<hang>, <hang>, ...]}
michael@0 109 * <time> represents a histogram of time intervals in milliseconds,
michael@0 110 * with the same format as histogramSnapshots
michael@0 111 * <hang> represents a particular hang,
michael@0 112 * {"stack": <stack>, "histogram": <time>}
michael@0 113 * <stack> represents the hang's stack,
michael@0 114 * ["<frame_0>", "<frame_1>", ...]
michael@0 115 */
michael@0 116 [implicit_jscontext]
michael@0 117 readonly attribute jsval threadHangStats;
michael@0 118
michael@0 119 /*
michael@0 120 * An object with two fields: memoryMap and stacks.
michael@0 121 * * memoryMap is a list of loaded libraries.
michael@0 122 * * stacks is a list of stacks. Each stack is a list of pairs of the form
michael@0 123 * [moduleIndex, offset]. The moduleIndex is an index into the memoryMap and
michael@0 124 * offset is an offset in the library at memoryMap[moduleIndex].
michael@0 125 * This format is used to make it easier to send the stacks to the
michael@0 126 * symbolication server.
michael@0 127 */
michael@0 128 [implicit_jscontext]
michael@0 129 readonly attribute jsval lateWrites;
michael@0 130
michael@0 131 /**
michael@0 132 * Returns an array whose values are the names of histograms defined
michael@0 133 * in Histograms.json.
michael@0 134 */
michael@0 135 void registeredHistograms(out uint32_t count,
michael@0 136 [retval, array, size_is(count)] out string histograms);
michael@0 137
michael@0 138 /**
michael@0 139 * Create and return a histogram. Parameters:
michael@0 140 *
michael@0 141 * @param name Unique histogram name
michael@0 142 * @param expiration Expiration version
michael@0 143 * @param min - Minimal bucket size
michael@0 144 * @param max - Maximum bucket size
michael@0 145 * @param bucket_count - number of buckets in the histogram.
michael@0 146 * @param type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR or HISTOGRAM_BOOLEAN
michael@0 147 * The returned object has the following functions:
michael@0 148 * add(int) - Adds an int value to the appropriate bucket
michael@0 149 * snapshot() - Returns a snapshot of the histogram with the same data fields as in histogramSnapshots()
michael@0 150 * clear() - Zeros out the histogram's buckets and sum
michael@0 151 */
michael@0 152 [implicit_jscontext]
michael@0 153 jsval newHistogram(in ACString name, in ACString expiration, in uint32_t min, in uint32_t max, in uint32_t bucket_count, in unsigned long histogram_type);
michael@0 154
michael@0 155 /**
michael@0 156 * Create a histogram using the current state of an existing histogram. The
michael@0 157 * existing histogram must be registered in TelemetryHistograms.h.
michael@0 158 *
michael@0 159 * @param name Unique histogram name
michael@0 160 * @param existing_name Existing histogram name
michael@0 161 * The returned object has the same functions as a histogram returned from newHistogram.
michael@0 162 */
michael@0 163 [implicit_jscontext]
michael@0 164 jsval histogramFrom(in ACString name, in ACString existing_name);
michael@0 165
michael@0 166 /**
michael@0 167 * Same as newHistogram above, but for histograms registered in TelemetryHistograms.h.
michael@0 168 *
michael@0 169 * @param id - unique identifier from TelemetryHistograms.h
michael@0 170 */
michael@0 171 [implicit_jscontext]
michael@0 172 jsval getHistogramById(in ACString id);
michael@0 173
michael@0 174 /**
michael@0 175 * Set this to false to disable gathering of telemetry statistics.
michael@0 176 */
michael@0 177 attribute boolean canRecord;
michael@0 178
michael@0 179 /**
michael@0 180 * A flag indicating whether Telemetry can submit official results.
michael@0 181 */
michael@0 182 readonly attribute boolean canSend;
michael@0 183
michael@0 184 /** Addon telemetry hooks */
michael@0 185
michael@0 186 /**
michael@0 187 * Register a histogram for an addon. Throws an error if the
michael@0 188 * histogram name has been registered previously.
michael@0 189 *
michael@0 190 * @param addon_id - Unique ID of the addon
michael@0 191 * @param name - Unique histogram name
michael@0 192 * @param min - Minimal bucket size
michael@0 193 * @param max - Maximum bucket size
michael@0 194 * @param bucket_count - number of buckets in the histogram
michael@0 195 * @param histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, or
michael@0 196 * HISTOGRAM_BOOLEAN
michael@0 197 */
michael@0 198 void registerAddonHistogram(in ACString addon_id, in ACString name,
michael@0 199 in uint32_t min, in uint32_t max,
michael@0 200 in uint32_t bucket_count,
michael@0 201 in unsigned long histogram_type);
michael@0 202
michael@0 203 /**
michael@0 204 * Return a histogram previously registered via
michael@0 205 * registerAddonHistogram. Throws an error if the id/name combo has
michael@0 206 * not been registered via registerAddonHistogram.
michael@0 207 *
michael@0 208 * @param addon_id - Unique ID of the addon
michael@0 209 * @param name - Registered histogram name
michael@0 210 *
michael@0 211 * The returned object has the same functions as a histogram returned
michael@0 212 * from newHistogram.
michael@0 213 */
michael@0 214 [implicit_jscontext]
michael@0 215 jsval getAddonHistogram(in ACString addon_id, in ACString name);
michael@0 216
michael@0 217 /**
michael@0 218 * Delete all histograms associated with the given addon id.
michael@0 219 *
michael@0 220 * @param addon_id - Unique ID of the addon
michael@0 221 */
michael@0 222 void unregisterAddonHistograms(in ACString addon_id);
michael@0 223
michael@0 224 /**
michael@0 225 * An object containing a snapshot from all of the currently
michael@0 226 * registered addon histograms.
michael@0 227 * { addon-id1 : data1, ... }
michael@0 228 *
michael@0 229 * where data is an object whose properties are the names of the
michael@0 230 * addon's histograms and whose corresponding values are as in
michael@0 231 * histogramSnapshots.
michael@0 232 */
michael@0 233 [implicit_jscontext]
michael@0 234 readonly attribute jsval addonHistogramSnapshots;
michael@0 235
michael@0 236 /**
michael@0 237 * Read data from the previous run. After the callback is called, the last
michael@0 238 * shutdown time is available in lastShutdownDuration and any late
michael@0 239 * writes in lateWrites.
michael@0 240 */
michael@0 241 void asyncFetchTelemetryData(in nsIFetchTelemetryDataCallback aCallback);
michael@0 242
michael@0 243 /**
michael@0 244 * Get statistics of file IO reports, null, if not recorded.
michael@0 245 *
michael@0 246 * The statistics are returned as an object whose propoerties are the names
michael@0 247 * of the files that have been accessed and whose corresponding values are
michael@0 248 * arrays of size three, representing startup, normal, and shutdown stages.
michael@0 249 * Each stage's entry is either null or an array with the layout
michael@0 250 * [total_time, #creates, #reads, #writes, #fsyncs, #stats]
michael@0 251 */
michael@0 252 [implicit_jscontext]
michael@0 253 readonly attribute jsval fileIOReports;
michael@0 254
michael@0 255 /**
michael@0 256 * Return the number of seconds since process start using monotonic
michael@0 257 * timestamps (unaffected by system clock changes).
michael@0 258 * @throws NS_ERROR_NOT_AVAILABLE if TimeStamp doesn't have the data.
michael@0 259 */
michael@0 260 double msSinceProcessStart();
michael@0 261 };

mercurial