Created
September 17, 2015 16:28
-
-
Save adngdb/687c1645e886d116a561 to your computer and use it in GitHub Desktop.
Signatures with less than 300M of available memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def main(): | |
url = 'https://crash-stats.mozilla.com/api/SuperSearch/' | |
params = { | |
'product': 'Firefox', | |
'_aggs.signature': [ | |
'_histogram.available_physical_memory', | |
'_histogram.available_virtual_memory', | |
'_histogram.available_page_file', | |
], | |
'_histogram_interval.available_physical_memory': 300000000, | |
'_histogram_interval.available_virtual_memory': 300000000, | |
'_histogram_interval.available_page_file': 300000000, | |
} | |
r = requests.get(url, params=params) | |
data = r.json() | |
signatures = data['facets']['signature'] | |
memory_fields = ( | |
'available_physical_memory', | |
'available_virtual_memory', | |
'available_page_file', | |
) | |
for sig in signatures: | |
half_total = sig['count'] / 2 | |
for field in memory_fields: | |
facet_name = 'histogram_' + field | |
facet_data = sig['facets'][facet_name] | |
for mem in facet_data: | |
if mem['term'] == 0 and mem['count'] > half_total: | |
print sig['term'] | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results I'm getting running this script: