mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
feat: profile PRoot costs and test fast-path libraries without an APK rebuild (#1528)
This commit is contained in:
1 parent
aca4b5dd3e
commit
815b93db5f
17 files changed
+578
-10
No files matched your search
@@ -0,0 +1,38 @@
|
||||
--- a/src/syscall/syscall.c
|
||||
+++ b/src/syscall/syscall.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "tracee/reg.h"
|
||||
#include "tracee/mem.h"
|
||||
#include "cli/note.h"
|
||||
+#include "syscall/profile.h"
|
||||
|
||||
/**
|
||||
* Copy in @path a C string (PATH_MAX bytes max.) from the @tracee's
|
||||
@@ -100,7 +101,7 @@
|
||||
return set_sysarg_data(tracee, path, strlen(path) + 1, reg);
|
||||
}
|
||||
|
||||
-void translate_syscall(Tracee *tracee)
|
||||
+static void translate_syscall_impl(Tracee *tracee)
|
||||
{
|
||||
const bool is_enter_stage = IS_IN_SYSENTER(tracee);
|
||||
int status;
|
||||
@@ -283,3 +284,18 @@
|
||||
else
|
||||
print_current_regs(tracee, 4, "sysexit end");
|
||||
}
|
||||
+
|
||||
+void translate_syscall(Tracee *tracee)
|
||||
+{
|
||||
+ if (!dd_profile_enabled()) {
|
||||
+ translate_syscall_impl(tracee);
|
||||
+ return;
|
||||
+ }
|
||||
+ int saved = errno;
|
||||
+ const bool entering = IS_IN_SYSENTER(tracee);
|
||||
+ uint64_t wall = dd_profile_clock(CLOCK_MONOTONIC);
|
||||
+ uint64_t cpu = dd_profile_clock(CLOCK_THREAD_CPUTIME_ID);
|
||||
+ errno = saved;
|
||||
+ translate_syscall_impl(tracee);
|
||||
+ dd_profile_record(get_sysnum(tracee, ORIGINAL), entering, tracee->pid, wall, cpu);
|
||||
+}
|
||||
Reference in new issue
Block a user