This commit is contained in:
Carsten Grohmann 2017-12-13 07:31:39 +01:00
parent 91b32d63d7
commit 82249e7440

View File

@ -7,12 +7,13 @@
import re
DEBUG=False
DEBUG = False
"""Show additional information during the development cycle"""
VERSION="0.1.0"
VERSION = "0.1.0"
"""Version number"""
def hide_element(element_id):
"""Hide the given HTML element"""
document.getElementById(element_id).style.display = 'none'
@ -341,22 +342,14 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
REC_MEMINFO_2 = re.compile(
r'^ slab_reclaimable:(?P<slab_reclaimable_pages>\d+) slab_unreclaimable:(?P<slab_unreclaimable_pages>\d+)'
# next line break
r'(?:\n)'
r'^ mapped:(?P<mapped_pages>\d+) shmem:(?P<shmem_pages>\d+) pagetables:(?P<pagetables_pages>\d+) '
r'bounce:(?P<bounce_pages>\d+)'
# next line break
r'(?:\n)'
r'^ free:(?P<free_pages>\d+) free_pcp:(?P<free_pcp_pages>\d+) free_cma:(?P<free_cma_pages>\d+)'
, re.MULTILINE
r'^ free:(?P<free_pages>\d+) free_pcp:(?P<free_pcp_pages>\d+) free_cma:(?P<free_cma_pages>\d+)',
re.MULTILINE
)
REC_MEM_NODEINFO = re.compile(r'(^Node \d+ (DMA|Normal|hugepages).*(:?\n))+', re.MULTILINE)
mem_modinfo_entries = ("active_anon_pages", "inactive_anon_pages", "isolated_anon_pages",
@ -397,8 +390,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
r'score (?P<killed_proc_score>\d+) or sacrifice child'
r'(?:\n)'
r'Killed process \d+ \(.*\) total-vm:(?P<killed_proc_vm_kb>\d+)kB, anon-rss:(?P<killed_proc_anon_rss_kb>\d+)kB, '
r'file-rss:(?P<killed_proc_file_rss_kb>\d+)kB, shmem-rss:(?P<killed_proc_shmem_rss_kb>\d+)kB'
,
r'file-rss:(?P<killed_proc_file_rss_kb>\d+)kB, shmem-rss:(?P<killed_proc_shmem_rss_kb>\d+)kB',
re.MULTILINE)
lines = []
@ -436,7 +428,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
print("ERROR: HTML element not found: ", item)
return
content = self.details.get(item, '')
if type(content) is str:
if isinstance(content, str):
content = content.strip()
element.textContent = content
if DEBUG:
@ -610,7 +602,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
# TODO Add to HTML
#match = self.REC_PAGEINFO.search(self.oom.text)
#if match:
# if match:
# self.details.update(match.groupdict())
match = self.REC_PROCESSES.search(self.oom.text)
@ -635,7 +627,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
if item.endswith('_kb') or item.endswith('_pages'):
try:
self.details[item] = int(self.details[item])
except:
except BaseException:
error('Converting item {}: {} to integer failed'. format(item, self.details[item]))
kernel_version = self.details.get('kernel_version', '')