Files
palemoon27/dom/base/usecounters.py
T
roytam1 9d8e58858d import changes from `dev' branch of rmottola/Arctic-Fox:
- missing crashreporter section (4831c9622)
- Bug 866681, part 1 - Track if any slice of CC was manually triggered. r=smaug (358239be3)
- Bug 866681, part 2 - Make ContentUnbinder use DeferredFinalize. r=smaug (3155b68fa)
- Bug 1177627 - Back out most of 7fcf6bf43eda for causing Gaia unit test crashes. r=smaug (6ddb7866c)
-  Bug 1158257 - Gecko should always provide SpiderMonkey with a debuggerMallocSizeOf; r=mccr8 (f18a9c4ec)
- add (unused) crashreporter (9f35b04ee)
- Bug 1175513 - Make some private nsXPCWrappedJSClass const or static; r=bholley (39e560872)
- Bug 1175513 - Factor out nsXPCWrappedJSClass::CleanupOutparams; r=bholley (93f602ab6)
- Bug 1175513 - Improve code style in nsXPCWrappedJSClass::CleanupOutparams; r=bholley (cd874ea37)
- Bug 1178969 - nsXPConnect doesn't need to implement nsSupportsWeakReference. r=bholley (e76ebddc9)
- Bug 1182409 - Add 'allowWaivers' sandbox option. r=gabor (71befc1c9)
- Bug 1184400, part 1 - Make XPCJSRuntime::SuspectWrappedNative into a method on XPCWrappedNative. r=bholley (4d102ee6a)
- Bug 1184400, part 2 - XPCWrappedNative::Suspect() should suspect the JS reflector object even if it doesn't own it. r=bholley (c8339179c)
- Bug 1184400, part 3 - Use HasExternalReference in XPCWrappedNative::Traverse. r=bholley (3020bd602)
- Bug 1186213 - Add an API to deep-freeze the result of Cu.cloneInto. r=gkrizsanits (3b1b03b07)
- Bug 1185144 - nsConsoleService::LogMessageWithMode() should release the retired message on the main thread. r=froydnj (e615f5eb2)
- Bug 1171716 - Part 1: Add NS_ReleaseOnMainThread. r=froydnj (dd13528db)
- Bug 1171716 - Part 3: Use NS_ReleaseOnMainThread in WebSocketChannel dtor. r=froydnj (0818574a6)
- Bug 1171716 - Part 4: Use NS_ReleaseOnMainThread in JarChannel dtor. r=froydnj (06c85f670)
- Bug 1171716 - Part 5: Use NS_ReleaseOnMainThread in HttpBaseChannel dtor. r=froydnj (e599c1b8e)
- Bug 1185527 - Split out a refcountless base class for nsScriptError. r=gabor (325087790)
- Bug 1157908 - Give Gecko thread Looper low priority; r=snorp (713dd5bb1)
- Bug 968923 - part 5a - add use counters for SVGSVGElement and CSS properties for testing purposes; r=bz (9ed578c11)
- Bug 968923 - part 3d - record use counter information from the CSS parser; r=dbaron (ea188ea15)
- Bug 968923 - fix bogus assert in nsSVGElement.cpp; r=heycam (moz hg rev a0744d2060df)
2021-07-18 22:25:24 +08:00

81 lines
3.3 KiB
Python

# 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/.
import buildconfig
import collections
import re
import StringIO
import sys
from mozbuild.preprocessor import preprocess
def read_conf(conf_filename):
# Invoking the preprocessor ourselves is easier than writing build rules
# to do it for us.
processed = StringIO.StringIO()
preprocess(includes=[conf_filename],
defines=buildconfig.defines,
output=processed)
# Can't read/write from a single StringIO, so make a new one for reading.
stream = StringIO.StringIO(processed.getvalue())
def parse_counters(stream):
for line_num, line in enumerate(stream):
line = line.rstrip('\n')
if not line or line.startswith('//'):
# empty line or comment
continue
m = re.match(r'method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
if m:
interface_name, method_name = m.groups()
yield { 'type': 'method',
'interface_name': interface_name,
'method_name': method_name }
continue
m = re.match(r'attribute ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$', line)
if m:
interface_name, attribute_name = m.groups()
yield { 'type': 'attribute',
'interface_name': interface_name,
'attribute_name': attribute_name }
continue
m = re.match(r'property ([A-Za-z0-9]+)$', line)
if m:
property_name = m.group(1)
yield { 'type': 'property',
'property_name': property_name }
continue
raise ValueError('error parsing %s at line %d' % (conf_filename, line_num))
return parse_counters(stream)
def generate_histograms(filename):
# The mapping for use counters to telemetry histograms depends on the
# ordering of items in the dictionary.
items = collections.OrderedDict()
for counter in read_conf(filename):
def append_counter(name, desc):
items[name] = { 'expires_in_version': 'never',
'kind' : 'boolean',
'description': desc }
def append_counters(name, desc):
append_counter('USE_COUNTER_%s_DOCUMENT' % name, 'Whether a document %s' % desc)
append_counter('USE_COUNTER_%s_PAGE' % name, 'Whether a page %s' % desc)
if counter['type'] == 'method':
method = '%s.%s' % (counter['interface_name'], counter['method_name'])
append_counters(method.replace('.', '_').upper(), 'called %s' % method)
elif counter['type'] == 'attribute':
attr = '%s.%s' % (counter['interface_name'], counter['attribute_name'])
counter_name = attr.replace('.', '_').upper()
append_counters('%s_getter' % counter_name, 'got %s' % attr)
append_counters('%s_setter' % counter_name, 'set %s' % attr)
elif counter['type'] == 'property':
prop = counter['property_name']
append_counters('PROPERTY_%s' % prop.replace('-', '_').upper(), "used the '%s' property" % prop)
return items