[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: Add support for perf map creation
From: |
Andy Wingo |
Subject: |
[Guile-commits] branch master updated: Add support for perf map creation |
Date: |
Wed, 26 Feb 2020 16:10:40 -0500 |
This is an automated email from the git hooks/post-receive script.
wingo pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 5c95050 Add support for perf map creation
5c95050 is described below
commit 5c950503a64e9151566f4d98b4a75184cddb24b7
Author: Andy Wingo <address@hidden>
AuthorDate: Wed Feb 26 16:41:21 2020 +0100
Add support for perf map creation
* libguile/jit.c (create_perf_map_once, create_perf_map, perf_map): New
locals.
(compute_mcode): Add an entry to perf_map for emitted JIT code.
---
libguile/jit.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/libguile/jit.c b/libguile/jit.c
index 56bc30b..7e5852c 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -5623,6 +5623,21 @@ initialize_jit (void)
(scm_jit_return_to_interpreter_trampoline);
}
+static scm_i_pthread_once_t create_perf_map_once = SCM_I_PTHREAD_ONCE_INIT;
+static FILE *perf_map = NULL;
+static void
+create_perf_map (void)
+{
+ unsigned long pid = getpid ();
+ char *file_name;
+ if (asprintf (&file_name, "/tmp/perf-%lu.map", pid) < 0)
+ return;
+ perf_map = fopen (file_name, "w");
+ if (perf_map)
+ DEBUG ("created %s\n", file_name);
+ free (file_name);
+}
+
static uint8_t *
compute_mcode (scm_thread *thread, uint32_t *entry_ip,
struct scm_jit_function_data *data)
@@ -5673,6 +5688,16 @@ compute_mcode (scm_thread *thread, uint32_t *entry_ip,
{
entry_mcode = j->labels[inline_label_offset (j->entry - j->start)];
data->mcode = mcode;
+
+ if (jit_log_level >= LOG_LEVEL_INFO) {
+ scm_i_pthread_once (&create_perf_map_once, create_perf_map);
+ if (perf_map) {
+ uint8_t *end = j->code_arena->base + j->code_arena->used;
+ fprintf (perf_map, "%lx %zx %p,+%zu\n", (long)mcode, end - mcode,
+ j->start, j->end - j->start);
+ fflush (perf_map);
+ }
+ }
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch master updated: Add support for perf map creation,
Andy Wingo <=