diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-20 02:00:41 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-21 14:43:56 +0100 |
commit | 9d7606b8de8aa31d40a5c725242c62bbf60e54f1 (patch) | |
tree | 10dd280cf504bb71524c0a2b7c44918e2b7aac14 /Userland/DevTools/UserspaceEmulator/Emulator.cpp | |
parent | 173cc5e6e0db0a2d9065deb938222afc862489ad (diff) | |
download | serenity-9d7606b8de8aa31d40a5c725242c62bbf60e54f1.zip |
UserspaceEmulator: Use `Core::Stream` for writing profiling data
This looks like it should compile, but UserspaceEmulator is currently
broken on any non-i686 platform anyways, so I can't test that.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator/Emulator.cpp')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 7c0cb551bb..a094621550 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -9,7 +9,6 @@ #include "MmapRegion.h" #include "SimpleRegion.h" #include "SoftCPU.h" -#include <AK/FileStream.h> #include <AK/Format.h> #include <AK/LexicalPath.h> #include <AK/StringUtils.h> @@ -501,7 +500,7 @@ void Emulator::dump_backtrace() dump_backtrace(raw_backtrace()); } -void Emulator::emit_profile_sample(AK::OutputStream& output) +void Emulator::emit_profile_sample(Core::Stream::Stream& output) { if (!is_in_region_of_interest()) return; @@ -511,17 +510,17 @@ void Emulator::emit_profile_sample(AK::OutputStream& output) builder.appendff(R"~(, {{"type": "sample", "pid": {}, "tid": {}, "timestamp": {}, "lost_samples": 0, "stack": [)~", getpid(), gettid(), tv.tv_sec * 1000 + tv.tv_usec / 1000); builder.join(',', raw_backtrace()); builder.append("]}\n"sv); - output.write_or_error(builder.string_view().bytes()); + output.write_entire_buffer(builder.string_view().bytes()).release_value_but_fixme_should_propagate_errors(); } -void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, DeprecatedString const& contents) +void Emulator::emit_profile_event(Core::Stream::Stream& output, StringView event_name, DeprecatedString const& contents) { StringBuilder builder; timeval tv {}; gettimeofday(&tv, nullptr); builder.appendff(R"~(, {{"type": "{}", "pid": {}, "tid": {}, "timestamp": {}, "lost_samples": 0, "stack": [], {}}})~", event_name, getpid(), gettid(), tv.tv_sec * 1000 + tv.tv_usec / 1000, contents); builder.append('\n'); - output.write_or_error(builder.string_view().bytes()); + output.write_entire_buffer(builder.string_view().bytes()).release_value_but_fixme_should_propagate_errors(); } DeprecatedString Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn) |