1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:57:45 +00:00

UserspaceEmulator: Move all the profiling details into the Emulator

Them being in the global namespace doesn't have a lot of fans, it seems.
This commit is contained in:
Ali Mohammad Pur 2021-08-08 15:28:07 +04:30 committed by Ali Mohammad Pur
parent 2128ae4ab0
commit 369e3da6a2
4 changed files with 55 additions and 42 deletions

View file

@ -12,6 +12,7 @@
#include "Report.h"
#include "SoftCPU.h"
#include "SoftMMU.h"
#include <AK/FileStream.h>
#include <AK/MappedFile.h>
#include <AK/Types.h>
#include <LibDebug/DebugInfo.h>
@ -32,6 +33,23 @@ public:
Emulator(String const& executable_path, Vector<String> const& arguments, Vector<String> const& environment);
void set_profiling_details(bool should_dump_profile, size_t instruction_interval, OutputFileStream* profile_stream)
{
m_is_profiling = should_dump_profile;
m_profile_instruction_interval = instruction_interval;
m_profile_stream = profile_stream;
}
void set_in_region_of_interest(bool value)
{
m_is_in_region_of_interest = value;
}
OutputFileStream& profile_stream() { return *m_profile_stream; }
bool is_profiling() const { return m_is_profiling; }
bool is_in_region_of_interest() const { return m_is_in_region_of_interest; }
size_t profile_instruction_interval() const { return m_profile_instruction_interval; }
bool load_elf();
void dump_backtrace();
void dump_backtrace(Vector<FlatPtr> const&);
@ -271,6 +289,11 @@ private:
HashMap<String, CachedELF> m_dynamic_library_cache;
RangeAllocator m_range_allocator;
OutputFileStream* m_profile_stream { nullptr };
bool m_is_profiling { false };
size_t m_profile_instruction_interval { 0 };
bool m_is_in_region_of_interest { false };
};
ALWAYS_INLINE bool Emulator::is_in_libc() const