Use classes selectors to simplify handling

This commit is contained in:
Carsten Grohmann 2020-02-03 06:18:40 +01:00
parent be2fc6954e
commit 527eaa4cf6
2 changed files with 36 additions and 46 deletions

View File

@ -411,7 +411,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>HighMem/MovableOnly</td> <td>HighMem/MovableOnly</td>
<td id="highmem_pages"></td> <td class="highmem_pages"></td>
<td>Number of pages in the High Memory Area or marked movable for Contiguous Memory Allocator (CMA). <td>Number of pages in the High Memory Area or marked movable for Contiguous Memory Allocator (CMA).
<br> <br>
HighMem pages are also counted in the total page number. HighMem pages are also counted in the total page number.
@ -419,22 +419,22 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Reserved pages</td> <td>Reserved pages</td>
<td id="reserved_pages"></td> <td class="reserved_pages"></td>
<td>Number of reserved pages</td> <td>Number of reserved pages</td>
</tr> </tr>
<tr> <tr>
<td>CMA reserved pages</td> <td>CMA reserved pages</td>
<td id="cma_pages">0</td> <td class="cma_pages">0</td>
<td>Pages reserved for Contiguous Memory Allocator (CMA)</td> <td>Pages reserved for Contiguous Memory Allocator (CMA)</td>
</tr> </tr>
<tr> <tr>
<td>Pagetable Cache</td> <td>Pagetable Cache</td>
<td id="pagetablecache_pages">0</td> <td class="pagetablecache_pages">0</td>
<td>Number of pages in pagetable cache</td> <td>Number of pages in pagetable cache</td>
</tr> </tr>
<tr> <tr>
<td>Number of pages with hardware errors</td> <td>Number of pages with hardware errors</td>
<td id="hwpoisoned_pages">0</td> <td class="hwpoisoned_pages">0</td>
<td>Pages with uncorrectable memory errors</td> <td>Pages with uncorrectable memory errors</td>
</tr> </tr>
@ -445,41 +445,41 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Active anonymous memory <br> (active_anon)</td> <td>Active anonymous memory <br> (active_anon)</td>
<td id="active_anon_pages"></td> <td class="active_anon_pages"></td>
<td>Recently used anonymous memory.<br> <td>Recently used anonymous memory.<br>
These memory pages will usually not swapped out. These memory pages will usually not swapped out.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Inactive anonymous memory <br> (inactive_anon)</td> <td>Inactive anonymous memory <br> (inactive_anon)</td>
<td id="inactive_anon_pages"></td> <td class="inactive_anon_pages"></td>
<td>Least recently used anonymous memory.<br> <td>Least recently used anonymous memory.<br>
These memory pages can be swapped out. These memory pages can be swapped out.
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Isolated anonymous memory <br> (isolated_anon)</td> <td>Isolated anonymous memory <br> (isolated_anon)</td>
<td id="isolated_anon_pages"></td> <td class="isolated_anon_pages"></td>
<td>Memory isolation is used to separate memory between different virtual machines.</td> <td>Memory isolation is used to separate memory between different virtual machines.</td>
</tr> </tr>
<tr> <tr>
<td>Active Pagecache <br> (active_file)</td> <td>Active Pagecache <br> (active_file)</td>
<td id="active_file_pages"></td> <td class="active_file_pages"></td>
<td>Pagecache that has been used more recently and usually not reclaimed unless absolutely necessary.</td> <td>Pagecache that has been used more recently and usually not reclaimed unless absolutely necessary.</td>
</tr> </tr>
<tr> <tr>
<td>Inactive Pagecache <br> (inactive_file)</td> <td>Inactive Pagecache <br> (inactive_file)</td>
<td id="inactive_file_pages"></td> <td class="inactive_file_pages"></td>
<td>Pagecache which has been less recently used. It can be reclaimed without huge performance impact.</td> <td>Pagecache which has been less recently used. It can be reclaimed without huge performance impact.</td>
</tr> </tr>
<tr> <tr>
<td>Isolated Pagecache <br> (isolated_file)</td> <td>Isolated Pagecache <br> (isolated_file)</td>
<td id="isolated_file_pages"></td> <td class="isolated_file_pages"></td>
<td>Memory isolation is used to separate memory between different virtual machines.</td> <td>Memory isolation is used to separate memory between different virtual machines.</td>
</tr> </tr>
<tr> <tr>
<td>Unevictable Pages <br> (unevictable)</td> <td>Unevictable Pages <br> (unevictable)</td>
<td id="unevictable_pages"></td> <td class="unevictable_pages"></td>
<td>Unevictable memory. It can't be swapped out because the pages are owned by ramfs or protected by <td>Unevictable memory. It can't be swapped out because the pages are owned by ramfs or protected by
<a href="http://man7.org/linux/man-pages/man3/mlock.5.html" target="_blank">mlock(3)</a> / <a href="http://man7.org/linux/man-pages/man3/mlock.5.html" target="_blank">mlock(3)</a> /
<a href="http://man7.org/linux/man-pages/man2/shmctl.2.html" target="_blank">shmctl(SHM_LOCK)</a>. <a href="http://man7.org/linux/man-pages/man2/shmctl.2.html" target="_blank">shmctl(SHM_LOCK)</a>.
@ -488,14 +488,14 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Dirty Pages <br> (dirty)</td> <td>Dirty Pages <br> (dirty)</td>
<td id="dirty_pages"></td> <td class="dirty_pages"></td>
<td>Memory which is waiting to get written back to the disk. <td>Memory which is waiting to get written back to the disk.
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Writeback <br> (writeback)</td> <td>Writeback <br> (writeback)</td>
<td id="writeback_pages"></td> <td class="writeback_pages"></td>
<td> <td>
Memory which is actively being written back to the disk. Memory which is actively being written back to the disk.
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
@ -503,12 +503,12 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Unstable <br> (unstable)</td> <td>Unstable <br> (unstable)</td>
<td id="unstable_pages"></td> <td class="unstable_pages"></td>
<td>Not yet committed to stable storage.</td> <td>Not yet committed to stable storage.</td>
</tr> </tr>
<tr> <tr>
<td>Slab Reclaimable <br> (slab_reclaimable)</td> <td>Slab Reclaimable <br> (slab_reclaimable)</td>
<td id="slab_reclaimable_pages"></td> <td class="slab_reclaimable_pages"></td>
<td> <td>
Slab is a in-kernel data structures cache. Part of Slab, that might be reclaimed, such as caches. Slab is a in-kernel data structures cache. Part of Slab, that might be reclaimed, such as caches.
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
@ -519,7 +519,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Slab Unreclaimable <br> (slab_unreclaimable)</td> <td>Slab Unreclaimable <br> (slab_unreclaimable)</td>
<td id="slab_unreclaimable_pages"></td> <td class="slab_unreclaimable_pages"></td>
<td> <td>
Part of Slab, that cannot be reclaimed on memory pressure. Part of Slab, that cannot be reclaimed on memory pressure.
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
@ -527,7 +527,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Mapped <br> (mapped)</td> <td>Mapped <br> (mapped)</td>
<td id="mapped_pages"></td> <td class="mapped_pages"></td>
<td> <td>
Files which have been mapped into memory (with Files which have been mapped into memory (with
<a href="http://man7.org/linux/man-pages/man2/mmap.2.html">mmap(2)</a>), such as libraries. <a href="http://man7.org/linux/man-pages/man2/mmap.2.html">mmap(2)</a>), such as libraries.
@ -536,7 +536,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Shared Memory <br> (shmem)</td> <td>Shared Memory <br> (shmem)</td>
<td id="shmem_pages"></td> <td class="shmem_pages"></td>
<td> <td>
Amount of memory consumed in Amount of memory consumed in
<a href="http://man7.org/linux/man-pages/man5/tmpfs.5.html">tmpfs(5)</a> <a href="http://man7.org/linux/man-pages/man5/tmpfs.5.html">tmpfs(5)</a>
@ -546,7 +546,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Pagetables <br> (pagetables)</td> <td>Pagetables <br> (pagetables)</td>
<td id="pagetables_pages"></td> <td class="pagetables_pages"></td>
<td> <td>
Amount of memory dedicated to the lowest level of pagetables. Amount of memory dedicated to the lowest level of pagetables.
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
@ -554,7 +554,7 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Bounce <br> (bounce)</td> <td>Bounce <br> (bounce)</td>
<td id="bounce_pages"></td> <td class="bounce_pages"></td>
<td> <td>
Memory used for block device "bounce buffers". Memory used for block device "bounce buffers".
<a class="a__footnote" href="#footnote-proc5">[1]</a> <a class="a__footnote" href="#footnote-proc5">[1]</a>
@ -562,22 +562,22 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>free <br> (free)</td> <td>free <br> (free)</td>
<td id="free_pages"></td> <td class="free_pages"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>free_pcp <br> (free_pcp)</td> <td>free_pcp <br> (free_pcp)</td>
<td id="free_pcp_pages"></td> <td class="free_pcp_pages"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>free_cma <br> (free_cma)</td> <td>free_cma <br> (free_cma)</td>
<td id="free_cma_pages"></td> <td class="free_cma_pages"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Total Pagecache</td> <td>Total Pagecache</td>
<td id="pagecache_total_pages"></td> <td class="pagecache_total_pages"></td>
<td></td> <td></td>
</tr> </tr>
@ -588,17 +588,17 @@ function goBack() {
</tr> </tr>
<tr> <tr>
<td>Kernel</td> <td>Kernel</td>
<td id="kernel_version" class="text--align-right"></td> <td class="kernel_version" class="text--align-right"></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Distribution</td> <td>Distribution</td>
<td id="dist" class="text--align-right"></td> <td class="dist" class="text--align-right"></td>
<td>Guessed from the kernel version</td> <td>Guessed from the kernel version</td>
</tr> </tr>
<tr> <tr>
<td>Platform</td> <td>Platform</td>
<td id="platform" class="text--align-right"></td> <td class="platform" class="text--align-right"></td>
<td>Guessed from the kernel version</td> <td>Guessed from the kernel version</td>
</tr> </tr>
<tr> <tr>
@ -616,7 +616,7 @@ function goBack() {
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="terminal"> <td colspan="2" class="terminal">
<pre id="mem_node_info"></pre> <pre class="mem_node_info"></pre>
</td> </td>
</tr> </tr>
@ -626,7 +626,7 @@ function goBack() {
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="terminal"> <td colspan="2" class="terminal">
<pre id="process_table"></pre> <pre class="process_table"></pre>
</td> </td>
</tr> </tr>
@ -638,7 +638,7 @@ function goBack() {
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="terminal"> <td colspan="2" class="terminal">
<pre id="hardware_info"></pre> <pre class="hardware_info"></pre>
</td> </td>
</tr> </tr>
@ -650,7 +650,7 @@ function goBack() {
<tr> <tr>
<td></td> <td></td>
<td colspan="2" class="terminal"> <td colspan="2" class="terminal">
<pre id="call_trace"></pre> <pre class="call_trace"></pre>
</td> </td>
</tr> </tr>

View File

@ -913,18 +913,7 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
The content won't be formatted. Only suffixes for pages and kbytes are added in the singular or plural. The content won't be formatted. Only suffixes for pages and kbytes are added in the singular or plural.
""" """
element_by_id = document.getElementById(item) elements = document.getElementsByClassName(item)
if element_by_id:
elements = [element_by_id]
else:
elements = document.getElementsByClassName(item)
# __pragma__ ('tconv')
if not elements:
print("ERROR: No HTML element found to set item {}".format(item))
return
# __pragma__ ('notconv')
for element in elements: for element in elements:
content = self.oom_details.get(item, '') content = self.oom_details.get(item, '')
if isinstance(content, str): if isinstance(content, str):
@ -992,8 +981,9 @@ Killed process 6576 (java) total-vm:33914892kB, anon-rss:20629004kB, file-rss:0k
element.classList.remove('js-text--display-none') element.classList.remove('js-text--display-none')
for item in self.mem_modinfo_entries: for item in self.mem_modinfo_entries:
element = document.getElementById(item) elements = document.getElementsByClassName(item)
element.textContent = "" for element in elements:
element.textContent = ""
# clear notification box # clear notification box
element = document.getElementById('notify_box') element = document.getElementById('notify_box')