summaryrefslogtreecommitdiff
path: root/Userland/DevTools/Profiler/DisassemblyModel.cpp
AgeCommit message (Collapse)Author
2023-02-02Profiler: Standardize percentage formattingJelle Raaijmakers
This implements the same percentage formatting for the disassembly and flamegraph views as we have for the profile model.
2023-01-27AK: Remove StringBuilder::build() in favor of to_deprecated_string()Linus Groh
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
2023-01-22LibDebug: Propagate errors throughout DWARF parsingTim Schumacher
Splitting this into a separate commit was an afterthought, so this does not yet feature any fallible operations.
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-26Profiler: Don't stop disassembly on invalid instructionsSimon Wanner
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-02-16DevTools: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2021-12-28Profiler: Extract percentage gradient calculation into its own fileStephan Unverwerth
2021-12-28Profiler: Make everything east-const :^)Stephan Unverwerth
2021-12-23Profiler: Add some implied auto qualifiersHendiadyoin1
2021-11-23LibCore+AK: Move MappedFile from AK to LibCoreAndreas Kling
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
2021-11-16Profiler: Stop disassembly on invalid instructionsHendiadyoin1
2021-11-16Profiler: Don't try to disassemble empty buffersHendiadyoin1
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-10-31Profiler: Cache parsed DWARF debug information in disassembly viewDaniel Bertalan
This changes browsing through disassembled functions in Profiler from a painfully sluggish experience into quite a swift one. It's especially true for profiling the kernel, as it has more than 10 megabytes of DWARF data to churn through.
2021-10-31Profiler: Load the actual kernel binary for disassemblyDaniel Bertalan
/boot/Kernel.debug only contains the symbol table and DWARF debug information, and has its `.text` and other PT_LOAD segments stripped out. When we try to parse its data as instructions, we get a crash from within LibX86. We now load the actual /boot/Kernel binary when we want to disassemble kernel functions.
2021-10-31Profiler: Share the mapped kernel between Profile and DisassemblyModelDaniel Bertalan
There is no point in keeping around a separate MappedFile object for /boot/Kernel.debug for each DisassemblyModel we create and re-parsing the kernel image multiple times. This will significantly speed up browsing through profile entries from the kernel in disassembly view.
2021-10-25LibX86: Take load base address into consideration during disassemblyDaniel Bertalan
Since our executables are position-independent, the address values extraced from processes don't correspond to their values within the ELF file. We have to offset the absolute addresses by the load base address to get the relative symbol that we need for disassembly.
2021-10-25Profiler: Subtract the kernel's base address when searching for symbolsDaniel Bertalan
Now that the kernel is compiled as a PIE, all addresses are relative to the loaded base address, so Symbolication::kernel_base has to be subtracted off from the absolute addresses if we want to symbolicate them.
2021-08-10Profiler: Disassemble the entire function if the symbol is a functionAli Mohammad Pur
Previously the view would've cut off at the last instruction that was hit in the profile, which is not the right behaviour for functions.
2021-08-10Profiler: Disassemble the containing function for non-function symbolsAli Mohammad Pur
This can happen if the symbol is part of a switch-case, and not a function, which would previously have made the disassembly view appear empty. Now we disassemble the containing function, starting at the given label and continuing up until the last captured instruction.
2021-08-06Everywhere: Replace Model::update() with Model::invalidate()sin-ack
Most of the models were just calling did_update anyway, which is pointless since it can be unified to the base Model class. Instead, code calling update() will now call invalidate(), which functions identically and is more obvious in what it does. Additionally, a default implementation is provided, which removes the need to add empty implementations of update() for each model subclass. Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-08-06Profiler: Display source location information in the disassembly viewAli Mohammad Pur
With this, we can now have some amount of source-level profiling information :^)
2021-08-01DevTools: Remove unused header includesBrian Gianforcaro
2021-07-22Userland: Use /proc/kernel_base to determine the kernel base addressGunnar Beutner
This removes all the hard-coded kernel base addresses from userspace tools. One downside for this is that e.g. Profiler no longer uses a different color for kernel symbols when run as a non-root user.
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-20Userland: Hardcode the x86_64 kernel base address for nowGunnar Beutner
2021-07-18Kernel: Split debug symbols into a separate fileGunnar Beutner
This speeds up the boot process considerably when specifying the kernel image via -initrd.
2021-06-24Profiler: Use u32 when constructing InstructionDataGunnar Beutner
When constructing values of the InstructionData type we assume that the event_count field is a size_t while it actually is a u32. On x86_64 this fails because those are different types.
2021-05-22Profiler: Split the call tree into one subtree per processAndreas Kling
This patch adds an additional level of hierarchy to the call tree: Every process gets its own top-level node. :^) Before this, selecting multiple processes would get quite confusing as all the call stacks from different processes were combined together into one big tree.
2021-05-04Profiler: Move everything into the "Profiler" namespaceAndreas Kling
2021-05-04Profiler: Print addresses in debug log in hex.Brian Gianforcaro
2021-04-26Kernel+Profiler: Improve profiling subsystemGunnar Beutner
This turns the perfcore format into more a log than it was before, which lets us properly log process, thread and region creation/destruction. This also makes it unnecessary to dump the process' regions every time it is scheduled like we did before. Incidentally this also fixes 'profile -c' because we previously ended up incorrectly dumping the parent's region map into the profile data. Log-based mmap support enables profiling shared libraries which are loaded at runtime, e.g. via dlopen(). This enables profiling both the parent and child process for programs which use execve(). Previously we'd discard the profiling data for the old process. The Profiler tool has been updated to not treat thread IDs as process IDs anymore. This enables support for processes with more than one thread. Also, there's a new widget to filter which process should be displayed.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-16LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888xAndreas Kling
The previous names (RGBA32 and RGB32) were misleading since that's not the actual byte order in memory. The new names reflect exactly how the color values get laid out in bitmap data.
2021-03-03Profiler: Cache and reuse mapped ELF objectsAndreas Kling
In multi-process profiles, the same ELF objects tend to occur many times (everyone has libc.so for example) so we will quickly run out of VM if we map each object once per process that uses it. Fix this by adding a "mapped object cache" that maps the path of an ELF object to a cached memory mapping and wrapping ELF::Image.
2021-03-02Kernel+Profiler: Capture metadata about all profiled processesAndreas Kling
The perfcore file format was previously limited to a single process since the pid/executable/regions data was top-level in the JSON. This patch moves the process-specific data into a top-level array named "processes" and we now add entries for each process that has been sampled during the profile run. This makes it possible to see samples from multiple threads when viewing a perfcore file with Profiler. This is extremely cool! :^)
2021-02-27Profiler: Unbreak DisassemblyModel after shared library introductionAndreas Kling
This was failing to take the library base address into account when tallying up the samples at each instruction.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-12DevTools: Move to Userland/DevTools/Andreas Kling