mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:37:46 +00:00
Kernel+ProcessManager: Show per-process syscall counts.
Added a simple syscall counter to the /proc/all contents. :^)
This commit is contained in:
parent
c59f8cd663
commit
c02c6fef28
6 changed files with 22 additions and 4 deletions
|
@ -579,7 +579,7 @@ ByteBuffer procfs$all(InodeIdentifier)
|
|||
auto processes = Process::all_processes();
|
||||
StringBuilder builder(processes.size() * 80);
|
||||
auto build_process_line = [&builder] (Process* process) {
|
||||
builder.appendf("%u,%u,%u,%u,%u,%u,%u,%s,%u,%u,%s,%s,%u,%u,%u,%u,%s\n",
|
||||
builder.appendf("%u,%u,%u,%u,%u,%u,%u,%s,%u,%u,%s,%s,%u,%u,%u,%u,%s,%u\n",
|
||||
process->pid(),
|
||||
process->main_thread().times_scheduled(), // FIXME(Thread): Bill all scheds to the process
|
||||
process->tty() ? process->tty()->pgid() : 0,
|
||||
|
@ -596,7 +596,8 @@ ByteBuffer procfs$all(InodeIdentifier)
|
|||
process->amount_resident(),
|
||||
process->amount_shared(),
|
||||
process->main_thread().ticks(), // FIXME(Thread): Bill all ticks to the process
|
||||
to_string(process->priority())
|
||||
to_string(process->priority()),
|
||||
process->syscall_count()
|
||||
);
|
||||
};
|
||||
build_process_line(Scheduler::colonel());
|
||||
|
|
|
@ -247,6 +247,9 @@ public:
|
|||
|
||||
Lock& big_lock() { return m_big_lock; }
|
||||
|
||||
unsigned syscall_count() const { return m_syscall_count; }
|
||||
void did_syscall() { ++m_syscall_count; }
|
||||
|
||||
private:
|
||||
friend class MemoryManager;
|
||||
friend class Scheduler;
|
||||
|
@ -322,6 +325,8 @@ private:
|
|||
|
||||
int m_next_tid { 0 };
|
||||
|
||||
unsigned m_syscall_count { 0 };
|
||||
|
||||
Lock m_big_lock;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ int sync()
|
|||
|
||||
static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2, dword arg3)
|
||||
{
|
||||
current->process().did_syscall();
|
||||
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
switch (function) {
|
||||
case Syscall::SC_yield:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue