Skip to content

Commit

Permalink
profiler: Make gcc-clean
Browse files Browse the repository at this point in the history
  • Loading branch information
djwatson committed Oct 3, 2023
1 parent 66ec182 commit 95f53f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include <sys/mman.h> // for mmap, MAP_ANONYMOUS, MAP_P...
#include <time.h> // for timer_settime, timespec

#define auto __auto_type
#define nullptr NULL

static timer_t timerid;
static struct itimerspec its;
static long cnt = 0;
Expand Down Expand Up @@ -62,9 +59,9 @@ void profile_add_frame(void *ptr) {
} else {
profile_stack_max *= 2;
}
auto *n = (long *)malloc(sizeof(long) * profile_stack_max);
auto n = (long *)malloc(sizeof(long) * profile_stack_max);
memcpy(n, profile_stack, profile_stack_sz * sizeof(long));
auto *old = profile_stack;
auto old = profile_stack;
profile_stack = n; // release
free(old);
printf("Expanded profile stack to %li\n", profile_stack_max);
Expand All @@ -86,7 +83,7 @@ extern bool in_jit;
extern bool in_gc;
static void handler(int sig, siginfo_t *si, void *uc) {
cnt++;
auto *s = (sample *)signal_safe_malloc(sizeof(sample));
auto s = (sample *)signal_safe_malloc(sizeof(sample));
s->next = samples;
s->stack_sz = 9 < profile_stack_sz ? 9 : profile_stack_sz;
memcpy(&s->stack[0], &profile_stack[profile_stack_sz - s->stack_sz],
Expand Down Expand Up @@ -155,7 +152,7 @@ EXPORT void profiler_start() {
/* }; */
/* std::sort(nodes.begin(), nodes.end(), sorter); */
/* for (auto &item : nodes) { */
/* auto *func = find_func_for_frame((uint32_t *)item.first); */
/* auto func = find_func_for_frame((uint32_t *)item.first); */
/* if (func != nullptr) { */
/* printf("%*c %.2f%% %s %s %li\n", indent, ' ', */
/* (double)item.second->cnt / cnt * 100.0, func->name.c_str(), */
Expand All @@ -177,7 +174,7 @@ EXPORT void profiler_stop() {
uint64_t on_gc = 0;

printf("Timer called %li times\n", cnt);
auto *s = samples;
auto s = samples;
while (s != nullptr) {
/* tree *cur_tree = &tree_root; */
/* for (int i = s->stack_sz - 1; i >= 0; i--) { */
Expand Down
1 change: 0 additions & 1 deletion src/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ int record_instr(unsigned int *pc, long *frame, long argcnt) {
auto clo = (closure_s*)(frame[INS_A(i) + 1] - CLOSURE_TAG);
auto call_pc = &((bcfunc*)clo->v[0])->code[0];
auto v = hmget(tailcalled, call_pc);
printf("CALLT for %p now %i\n", call_pc, v + 1);
hmput(tailcalled, call_pc, v + 1);
}
// Check call type
Expand Down

0 comments on commit 95f53f0

Please sign in to comment.