mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
Show the amount of memory in GraphicsBitmaps in /bin/top.
This seems like an extremely relevant metric to track.
This commit is contained in:
parent
b1e054ffe8
commit
41567c5bb9
6 changed files with 37 additions and 13 deletions
|
@ -140,6 +140,9 @@ public:
|
|||
|
||||
void set_shared(bool shared) { m_shared = shared; }
|
||||
|
||||
bool is_bitmap() const { return m_is_bitmap; }
|
||||
void set_is_bitmap(bool b) { m_is_bitmap = b; }
|
||||
|
||||
RetainPtr<Region> clone();
|
||||
bool contains(LinearAddress laddr) const
|
||||
{
|
||||
|
@ -198,6 +201,7 @@ private:
|
|||
bool m_readable { true };
|
||||
bool m_writable { true };
|
||||
bool m_shared { false };
|
||||
bool m_is_bitmap { false };
|
||||
Bitmap m_cow_map;
|
||||
};
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ ByteBuffer procfs$all(InodeIdentifier)
|
|||
auto processes = Process::all_processes();
|
||||
StringBuilder builder;
|
||||
auto build_process_line = [&builder] (Process* process) {
|
||||
builder.appendf("%u,%u,%u,%u,%u,%u,%u,%s,%u,%u,%s,%s,%u,%u,%u\n",
|
||||
builder.appendf("%u,%u,%u,%u,%u,%u,%u,%s,%u,%u,%s,%s,%u,%u,%u,%u\n",
|
||||
process->pid(),
|
||||
process->times_scheduled(),
|
||||
process->tty() ? process->tty()->pgid() : 0,
|
||||
|
@ -503,7 +503,8 @@ ByteBuffer procfs$all(InodeIdentifier)
|
|||
process->name().characters(),
|
||||
process->amount_virtual(),
|
||||
process->amount_resident(),
|
||||
process->amount_shared()
|
||||
process->amount_shared(),
|
||||
process->amount_in_bitmaps()
|
||||
);
|
||||
};
|
||||
build_process_line(Scheduler::colonel());
|
||||
|
|
|
@ -2201,6 +2201,16 @@ size_t Process::amount_virtual() const
|
|||
return amount;
|
||||
}
|
||||
|
||||
size_t Process::amount_in_bitmaps() const
|
||||
{
|
||||
size_t amount = 0;
|
||||
for (auto& region : m_regions) {
|
||||
if (region->is_bitmap())
|
||||
amount += region->size();
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
size_t Process::amount_resident() const
|
||||
{
|
||||
// FIXME: This will double count if multiple regions use the same physical page.
|
||||
|
|
|
@ -273,6 +273,7 @@ public:
|
|||
size_t amount_virtual() const;
|
||||
size_t amount_resident() const;
|
||||
size_t amount_shared() const;
|
||||
size_t amount_in_bitmaps() const;
|
||||
|
||||
Process* fork(RegisterDump&);
|
||||
int exec(const String& path, Vector<String>&& arguments, Vector<String>&& environment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue