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
add vm probing for x86_64
[lunaix-os.git]
/
lunaix-os
/
scripts
/
gdb
/
lunadbg
/
mem.py
diff --git
a/lunaix-os/scripts/gdb/lunadbg/mem.py
b/lunaix-os/scripts/gdb/lunadbg/mem.py
index 8829e1b0c35538760f834b551a56f7234ed443cf..a51560c1161252cd4efe410c40478e2ea3c228e8 100644
(file)
--- a/
lunaix-os/scripts/gdb/lunadbg/mem.py
+++ b/
lunaix-os/scripts/gdb/lunadbg/mem.py
@@
-1,7
+1,8
@@
from .commands import LunadbgCommand
from .pp import MyPrettyPrinter
from .profiling.pmstat import PhysicalMemProfile
from .commands import LunadbgCommand
from .pp import MyPrettyPrinter
from .profiling.pmstat import PhysicalMemProfile
-from .structs.pagetable import PageTable, PageTableEntry
+from .structs.pagetable import PageTable
+from .arch.x86 import PageTableHelper
class MMStats(LunadbgCommand):
def __init__(self) -> None:
class MMStats(LunadbgCommand):
def __init__(self) -> None:
@@
-27,16
+28,17
@@
class MMStats(LunadbgCommand):
pmem.rescan_pmem(optn.granule)
pp.printf("Total: %dKiB (%d@4K)",
pmem.rescan_pmem(optn.granule)
pp.printf("Total: %dKiB (%d@4K)",
- pmem.max_mem_sz, pmem.max_mem_pg)
+ pmem.max_mem_sz
/ 1024
, pmem.max_mem_pg)
pp.printf("Used: %dKiB (%d@4K) ~%.2f%%",
pp.printf("Used: %dKiB (%d@4K) ~%.2f%%",
- pmem.consumed_pg * 4096,
+ pmem.consumed_pg * 4096
/ 1024
,
pmem.consumed_pg, pmem.utilisation * 100)
pp.printf("Fragmentations: %d ~%.2f%%", pmem.discontig, pmem.fragmentation * 100)
pp.print()
pp.print("Distribution")
pmem.consumed_pg, pmem.utilisation * 100)
pp.printf("Fragmentations: %d ~%.2f%%", pmem.discontig, pmem.fragmentation * 100)
pp.print()
pp.print("Distribution")
+ pp.print("( . = empty, * = full, [0-9]0% full )")
pp2 = pp.next_level(2)
row = []
for i in range(0, len(pmem.mem_distr)):
pp2 = pp.next_level(2)
row = []
for i in range(0, len(pmem.mem_distr)):
@@
-45,7
+47,7
@@
class MMStats(LunadbgCommand):
if ratio == 0:
row.append('.')
elif ratio == 1:
if ratio == 0:
row.append('.')
elif ratio == 1:
- row.append('
F
')
+ row.append('
*
')
else:
row.append(str(cat))
else:
row.append(str(cat))
@@
-59,13
+61,15
@@
class MMStats(LunadbgCommand):
def vm_lookup(self, pp, va, optn):
to_addr = int(optn.to_addr, 0)
def vm_lookup(self, pp, va, optn):
to_addr = int(optn.to_addr, 0)
+ vmt = PageTableHelper.vm_mnt()
if not optn.n and not to_addr:
if not optn.n and not to_addr:
- pp.print(self.__ptw.get_pte(va, level=optn.level))
+ pp.print(self.__ptw.get_pte(va, level=optn.level, mnt=vmt))
+ return
+
+ if to_addr:
+ self.__ptw.print_ptes_between(pp, va, to_addr, optn.level, mnt=vmt)
else:
else:
- if to_addr:
- self.__ptw.print_ptes_between(pp, va, to_addr, optn.level)
- else:
- self.__ptw.print_ptes(pp, va, optn.n, optn.level)
+ self.__ptw.print_ptes(pp, va, optn.n, optn.level, mnt=vmt)
def __do_stats(self, pp, optn):
if optn.state_type == "pmem":
def __do_stats(self, pp, optn):
if optn.state_type == "pmem":
@@
-79,8
+83,7
@@
class MMStats(LunadbgCommand):
else:
print("unknow mem type:", optn.state_type)
else:
print("unknow mem type:", optn.state_type)
- def invoke(self, argument: str, from_tty: bool) -> None:
- optn = self._parse_args(argument)
+ def on_execute(self, optn, gdb_args, from_tty) -> None:
pp = MyPrettyPrinter()
if optn.cmd == 'stats':
pp = MyPrettyPrinter()
if optn.cmd == 'stats':