git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Boot framework rework (#45)
[lunaix-os.git]
/
lunaix-os
/
scripts
/
gdb
/
lunadbg
/
profiling
/
pmstat.py
diff --git
a/lunaix-os/scripts/gdb/lunadbg/profiling/pmstat.py
b/lunaix-os/scripts/gdb/lunadbg/profiling/pmstat.py
index 1e84d873460a35969114ee88c8f7fccc6284d2fc..308a9808f8191925d21895b45cc85bfb661ac4eb 100644
(file)
--- a/
lunaix-os/scripts/gdb/lunadbg/profiling/pmstat.py
+++ b/
lunaix-os/scripts/gdb/lunadbg/profiling/pmstat.py
@@
-1,14
+1,15
@@
from ..symbols import LunaixSymbols
from ..structs.page import PageStruct
from ..symbols import LunaixSymbols
from ..structs.page import PageStruct
+from ..structs.pmem import PMem
from ..pp import MyPrettyPrinter
import math
class PhysicalMemProfile:
def __init__(self) -> None:
super().__init__()
from ..pp import MyPrettyPrinter
import math
class PhysicalMemProfile:
def __init__(self) -> None:
super().__init__()
- self._pm
_list = LunaixSymbols.debug_sym("pmm", "pm_table"
)
+ self._pm
em = PMem(LunaixSymbols.debug_sym("pmm", "memory").value().address
)
- self.max_mem_pg =
int(LunaixSymbols.debug_sym("pmm", "max_pg").value()
)
+ self.max_mem_pg =
self._pmem.list_len(
)
self.max_mem_sz = self.max_mem_pg * 4096
self.mem_distr = []
self.max_mem_sz = self.max_mem_pg * 4096
self.mem_distr = []
@@
-16,20
+17,21
@@
class PhysicalMemProfile:
self.__mem_distr_granule = distr_granule
self.mem_distr.clear()
self.__mem_distr_granule = distr_granule
self.mem_distr.clear()
- p
age_per_granule = self.max_mem_pg / self.__mem_distr_granule
- page_per_granule =
math.ceil(page_per_granule)
+ p
plist = self._pmem.pplist()
+ page_per_granule =
int(self.max_mem_pg) // self.__mem_distr_granule
remainder = self.max_mem_pg % self.__mem_distr_granule
bucket = 0
non_contig = 0
last_contig = False
remainder = self.max_mem_pg % self.__mem_distr_granule
bucket = 0
non_contig = 0
last_contig = False
+
for i in range(self.max_mem_pg):
for i in range(self.max_mem_pg):
- element = PageStruct(
self._pm_
list[i].address)
- bucket += int(element.
ref > 0
)
+ element = PageStruct(
pp
list[i].address)
+ bucket += int(element.
busy()
)
if last_contig:
if last_contig:
- last_contig = element.
ref > 0
+ last_contig = element.
busy()
non_contig += int(not last_contig)
else:
non_contig += int(not last_contig)
else:
- last_contig = element.
ref > 0
+ last_contig = element.
busy()
if (i + 1) % page_per_granule == 0:
self.mem_distr.append(bucket)
if (i + 1) % page_per_granule == 0:
self.mem_distr.append(bucket)