<commit_before>#!/usr/bin/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/.

# This prints out the tests that open the most windows.

import sys
import re

winPatt = re.compile('\d\d:\d\d:\d\d\W+INFO -  (..)DOMWINDOW == (\d+).*\[pid = (\d+)\] \[serial = (\d+)\]')

# XXX count the number of live windows at once. just do it manually.

test = None
numLive = 0

count = 0
peakNumLive = 0

counts = {}
peaks = {}

for l in sys.stdin:
    if l.find("TEST-START") > -1:
        if test:
            counts.setdefault(count, []).append(test)
            peaks.setdefault(peakNumLive, []).append(test)
        count = 0
        peakNumLive = numLive
        test = l.split('|')[1].strip()
    m = winPatt.match(l)
    if not m:
        continue
    if m.group(1) == '++':
        count += 1
        numLive += 1
        if numLive > peakNumLive:
            peakNumLive = numLive
    else:
        assert m.group(1) == '--'
        assert numLive > 0
        numLive -= 1




keys = sorted(counts.keys())
keys.reverse()

for k in keys[:10]:
    print k, ', '.join(counts[k])

print

keys = sorted(peaks.keys())
keys.reverse()

for k in keys[:10]:
    print k, ', '.join(peaks[k])
<commit_msg>add more info about window output<commit_after>#!/usr/bin/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/.

# This prints out the tests that open the most windows.

import sys
import re

winPatt = re.compile('\d\d:\d\d:\d\d\W+INFO -  (..)DOMWINDOW == (\d+).*\[pid = (\d+)\] \[serial = (\d+)\]')

# XXX count the number of live windows at once. just do it manually.

test = None
numLive = 0

count = 0
peakNumLive = 0

counts = {}
peaks = {}

for l in sys.stdin:
    if l.find("TEST-START") > -1:
        if test:
            counts.setdefault(count, []).append(test)
            peaks.setdefault(peakNumLive, []).append(test)
        count = 0
        peakNumLive = numLive
        test = l.split('|')[1].strip()
    m = winPatt.match(l)
    if not m:
        continue
    if m.group(1) == '++':
        count += 1
        numLive += 1
        if numLive > peakNumLive:
            peakNumLive = numLive
    else:
        assert m.group(1) == '--'
        assert numLive > 0
        numLive -= 1



keys = sorted(counts.keys())
keys.reverse()

print 'Number of windows opened in each test.'
for k in keys[:10]:
    print k, ', '.join(counts[k])
print


keys = sorted(peaks.keys())
keys.reverse()

print 'Peak number of live windows in each test.'
for k in keys[:10]:
    print k, ', '.join(peaks[k])

{'fraction_non_alphanumeric': 0.15214285714285714, 'fraction_numerical': 0.014285714285714285, 'mean_word_length': 2.326603325415677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2794542', 'n_tokens_mistral': 1001, 'n_tokens_neox': 962, 'n_words': 310}