1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:17:44 +00:00

Kernel: Make sys$perf_register_string() generate the string ID's

Making userspace provide a global string ID was silly, and made the API
extremely difficult to use correctly in a global profiling context.

Instead, simply make the kernel do the string ID allocation for us.
This also allows us to convert the string storage to a Vector in the
kernel (and an array in the JSON profile data.)
This commit is contained in:
Andreas Kling 2021-08-11 20:41:29 +02:00
parent 56e84a63ca
commit 1e90a3a542
8 changed files with 24 additions and 24 deletions

View file

@ -95,9 +95,9 @@ int perf_event(int type, uintptr_t arg1, FlatPtr arg2)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int perf_register_string(uintptr_t string_id, char const* string, size_t string_length)
int perf_register_string(char const* string, size_t string_length)
{
int rc = syscall(SC_perf_register_string, string_id, string, string_length);
int rc = syscall(SC_perf_register_string, string, string_length);
__RETURN_WITH_ERRNO(rc, rc, -1);
}

View file

@ -119,7 +119,7 @@ enum {
#define PERF_EVENT_MASK_ALL (~0ull)
int perf_event(int type, uintptr_t arg1, uintptr_t arg2);
int perf_register_string(uintptr_t string_id, char const* string, size_t string_length);
int perf_register_string(char const* string, size_t string_length);
int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size);

View file

@ -26,7 +26,7 @@
namespace JS {
#ifdef __serenity__
static constexpr FlatPtr gc_perf_string_id = 0x13378086;
static int gc_perf_string_id;
#endif
Heap::Heap(VM& vm)
@ -34,7 +34,7 @@ Heap::Heap(VM& vm)
{
#ifdef __serenity__
auto gc_signpost_string = "Garbage collection"sv;
perf_register_string(gc_perf_string_id, gc_signpost_string.characters_without_null_termination(), gc_signpost_string.length());
gc_perf_string_id = perf_register_string(gc_signpost_string.characters_without_null_termination(), gc_signpost_string.length());
#endif
if constexpr (HeapBlock::min_possible_cell_size <= 16) {