mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:27:35 +00:00
Make loading /bin/bash ~250x faster.
The ELF loader was doing huge amounts of unnecessary work. Got rid of the "export symbols" and relocation passes since we don't need them. They were useful things when bringing up the ELF loading code. Also added a simple TSC-based Stopwatch RAII thingy to help debug performance issues.
This commit is contained in:
parent
1cf20a2fe2
commit
dea474dfd5
5 changed files with 81 additions and 40 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_MASK 0xfffff000
|
||||
|
@ -218,3 +219,35 @@ private:
|
|||
dword m_ecx { 0xffffffff };
|
||||
dword m_edx { 0xffffffff };
|
||||
};
|
||||
|
||||
inline void read_tsc(dword& lsw, dword& msw)
|
||||
{
|
||||
asm volatile("rdtsc":"=d"(msw),"=a"(lsw));
|
||||
}
|
||||
|
||||
struct Stopwatch {
|
||||
public:
|
||||
Stopwatch(const char* name)
|
||||
: m_name(name)
|
||||
{
|
||||
read_tsc(m_start_lsw, m_start_msw);
|
||||
}
|
||||
|
||||
~Stopwatch()
|
||||
{
|
||||
dword end_lsw;
|
||||
dword end_msw;
|
||||
read_tsc(end_lsw, end_msw);
|
||||
if (m_start_msw != end_msw) {
|
||||
dbgprintf("differing msw's\n");
|
||||
asm volatile("cli;hlt");
|
||||
}
|
||||
dword diff = end_lsw - m_start_lsw;
|
||||
dbgprintf("Stopwatch(%s): %u ticks\n", m_name, diff);
|
||||
}
|
||||
|
||||
private:
|
||||
const char* m_name { nullptr };
|
||||
dword m_start_lsw { 0 };
|
||||
dword m_start_msw { 0 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue