mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-02 16:25:34 +03:00
Kernel+SystemMonitor: Expose the number of set CoW bits in each Region
This number tells us how many more pages in a given region will trigger a CoW fault if written to.
This commit is contained in:
parent
9ad151c665
commit
3fbc50a350
Notes:
sideshowbarker
2024-07-19 10:51:17 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3fbc50a3507
@ -37,6 +37,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GWidget* parent)
|
||||
return "Volatile";
|
||||
return "Non-volatile";
|
||||
});
|
||||
pid_vm_fields.empend("cow_pages", "# CoW", TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("name", "Name", TextAlignment::CenterLeft);
|
||||
m_json_model = GJsonArrayModel::create({}, move(pid_vm_fields));
|
||||
m_table_view->set_model(GSortingProxyModel::create(*m_json_model));
|
||||
|
@ -273,6 +273,7 @@ Optional<KBuffer> procfs$pid_vm(InodeIdentifier identifier)
|
||||
region_object.add("address", region.vaddr().get());
|
||||
region_object.add("size", (u32)region.size());
|
||||
region_object.add("amount_resident", (u32)region.amount_resident());
|
||||
region_object.add("cow_pages", region.cow_pages());
|
||||
region_object.add("name", region.name());
|
||||
}
|
||||
array.finish();
|
||||
|
@ -113,6 +113,16 @@ int Region::commit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 Region::cow_pages() const
|
||||
{
|
||||
if (!m_cow_map)
|
||||
return 0;
|
||||
u32 count = 0;
|
||||
for (int i = 0; i < m_cow_map->size(); ++i)
|
||||
count += m_cow_map->get(i);
|
||||
return count;
|
||||
}
|
||||
|
||||
size_t Region::amount_resident() const
|
||||
{
|
||||
size_t bytes = 0;
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
bool should_cow(size_t page_index) const;
|
||||
void set_should_cow(size_t page_index, bool);
|
||||
|
||||
u32 cow_pages() const;
|
||||
|
||||
void set_writable(bool b)
|
||||
{
|
||||
if (b)
|
||||
|
Loading…
Reference in New Issue
Block a user