Fix memory calculation in summary section
This commit is contained in:
parent
99d9f23d30
commit
dcd8055258
@ -934,6 +934,7 @@ window.onerror = function (msg, url, lineNo, columnNo, errorObj) {
|
|||||||
|
|
||||||
<h4>General</h4>
|
<h4>General</h4>
|
||||||
<ol>
|
<ol>
|
||||||
|
<li>Fix memory calculation in summary section</li>
|
||||||
<li>...</li>
|
<li>...</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
@ -1196,22 +1196,23 @@ class OOMAnalyser:
|
|||||||
self.oom_result.details['swap_used_kb'] = self.oom_result.details['swap_total_kb'] - self.oom_result.details['swap_free_kb'] - \
|
self.oom_result.details['swap_used_kb'] = self.oom_result.details['swap_total_kb'] - self.oom_result.details['swap_free_kb'] - \
|
||||||
self.oom_result.details['swap_cache_kb']
|
self.oom_result.details['swap_cache_kb']
|
||||||
self.oom_result.details['system_swap_used_percent'] = int(100 *
|
self.oom_result.details['system_swap_used_percent'] = int(100 *
|
||||||
self.oom_result.details['swap_total_kb'] /
|
self.oom_result.details['swap_used_kb'] /
|
||||||
self.oom_result.details['swap_used_kb'])
|
self.oom_result.details['swap_total_kb'])
|
||||||
|
|
||||||
def _calc_system_values(self):
|
def _calc_system_values(self):
|
||||||
"""Calculate system memory"""
|
"""Calculate system memory"""
|
||||||
|
|
||||||
# educated guess
|
|
||||||
self.oom_result.details['page_size_kb'] = 4
|
|
||||||
|
|
||||||
# calculate remaining explanation values
|
# calculate remaining explanation values
|
||||||
self.oom_result.details['system_total_ram_kb'] = self.oom_result.details['ram_pages'] * self.oom_result.details['page_size_kb']
|
self.oom_result.details['system_total_ram_kb'] = self.oom_result.details['ram_pages'] * \
|
||||||
|
self.oom_result.details['page_size_kb']
|
||||||
if self.oom_result.swap_active:
|
if self.oom_result.swap_active:
|
||||||
self.oom_result.details['system_total_ramswap_kb'] = self.oom_result.details['system_total_ram_kb'] + \
|
self.oom_result.details['system_total_ramswap_kb'] = self.oom_result.details['system_total_ram_kb'] + \
|
||||||
self.oom_result.details['swap_total_kb']
|
self.oom_result.details['swap_total_kb']
|
||||||
else:
|
else:
|
||||||
self.oom_result.details['system_total_ramswap_kb'] = self.oom_result.details['system_total_ram_kb']
|
self.oom_result.details['system_total_ramswap_kb'] = self.oom_result.details['system_total_ram_kb']
|
||||||
|
|
||||||
|
# TODO: Used RSS calculation based on process table is probably incorrect, because it don't differentiates
|
||||||
|
# between processes and threads
|
||||||
total_rss_pages = 0
|
total_rss_pages = 0
|
||||||
for pid in self.oom_result.details['_pstable'].keys():
|
for pid in self.oom_result.details['_pstable'].keys():
|
||||||
total_rss_pages += self.oom_result.details['_pstable'][pid]['rss_pages']
|
total_rss_pages += self.oom_result.details['_pstable'][pid]['rss_pages']
|
||||||
@ -1244,6 +1245,9 @@ class OOMAnalyser:
|
|||||||
dist = 'Ubuntu'
|
dist = 'Ubuntu'
|
||||||
self.oom_result.details['dist'] = dist
|
self.oom_result.details['dist'] = dist
|
||||||
|
|
||||||
|
# educated guess
|
||||||
|
self.oom_result.details['page_size_kb'] = 4
|
||||||
|
|
||||||
def _calc_from_oom_details(self):
|
def _calc_from_oom_details(self):
|
||||||
"""
|
"""
|
||||||
Calculate values from already extracted details
|
Calculate values from already extracted details
|
||||||
@ -1255,10 +1259,10 @@ class OOMAnalyser:
|
|||||||
self._calc_pstable_values()
|
self._calc_pstable_values()
|
||||||
|
|
||||||
self._determinate_platform_and_distribution()
|
self._determinate_platform_and_distribution()
|
||||||
|
self._calc_swap_values()
|
||||||
self._calc_system_values()
|
self._calc_system_values()
|
||||||
self._calc_trigger_process_values()
|
self._calc_trigger_process_values()
|
||||||
self._calc_killed_process_values()
|
self._calc_killed_process_values()
|
||||||
self._calc_swap_values()
|
|
||||||
|
|
||||||
def analyse(self):
|
def analyse(self):
|
||||||
"""
|
"""
|
||||||
|
16
test.py
16
test.py
@ -189,6 +189,16 @@ class TestInBrowser(TestBase):
|
|||||||
self.assertTrue('OOM killer was automatically triggered' in explanation.text,
|
self.assertTrue('OOM killer was automatically triggered' in explanation.text,
|
||||||
'Missing text "OOM killer was automatically triggered"')
|
'Missing text "OOM killer was automatically triggered"')
|
||||||
|
|
||||||
|
explanation = self.driver.find_element(By.ID, 'explanation')
|
||||||
|
self.assertTrue("system has 33519336 kBytes physical memory and 8388604 kBytes swap space." in explanation.text,
|
||||||
|
"Physical and swap memory in summary not found")
|
||||||
|
self.assertTrue("That's 41907940 kBytes total." in explanation.text,
|
||||||
|
"Total memory in summary not found")
|
||||||
|
self.assertTrue("94% (31705788 kBytes out of 33519336 kBytes) physical memory" in explanation.text,
|
||||||
|
"Used physical memory in summary not found")
|
||||||
|
self.assertTrue("99% (8343236 kBytes out of 8388604 kBytes) swap space" in explanation.text,
|
||||||
|
"Used swap space in summary not found")
|
||||||
|
|
||||||
head = self.driver.find_element(By.ID, 'pstable_header')
|
head = self.driver.find_element(By.ID, 'pstable_header')
|
||||||
self.assertTrue('Page Table Entries' in head.text, 'Missing column head line "Page Table Entries"')
|
self.assertTrue('Page Table Entries' in head.text, 'Missing column head line "Page Table Entries"')
|
||||||
|
|
||||||
@ -209,6 +219,12 @@ class TestInBrowser(TestBase):
|
|||||||
self.assertFalse('with an OOM score of' in explanation.text,
|
self.assertFalse('with an OOM score of' in explanation.text,
|
||||||
'No OOM score but text "with an OOM score of"')
|
'No OOM score but text "with an OOM score of"')
|
||||||
|
|
||||||
|
explanation = self.driver.find_element(By.ID, 'explanation')
|
||||||
|
self.assertTrue("system has 2096632 kBytes physical memory and no swap space" in explanation.text,
|
||||||
|
"Physical and swap memory in summary not found")
|
||||||
|
self.assertTrue("9% (209520 kBytes out of 2096632 kBytes) physical memory" in explanation.text,
|
||||||
|
"Used physical memory in summary not found")
|
||||||
|
|
||||||
head = self.driver.find_element(By.ID, 'pstable_header')
|
head = self.driver.find_element(By.ID, 'pstable_header')
|
||||||
self.assertTrue('Page Table Bytes' in head.text, 'Missing column head line "Page Table Bytes"')
|
self.assertTrue('Page Table Bytes' in head.text, 'Missing column head line "Page Table Bytes"')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user