Skip to content

Commit

Permalink
move check one level up, do not execute vmp_read_vmaps (not needed an…
Browse files Browse the repository at this point in the history
…ymore)
  • Loading branch information
planrich committed Apr 25, 2017
1 parent 3e53f51 commit ca0c4e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/vmp_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,13 @@ int vmp_walk_and_record_stack(PY_STACK_FRAME_T *frame, void ** result,
// PyPy saves the information of an address in the same way as line information
// is saved in CPython. _write_python_stack_entry for details.
//
if (frame == NULL) {
return 0;
}
#ifdef VMP_SUPPORTS_NATIVE_PROFILING
void * func_addr;
unw_cursor_t cursor;
unw_context_t uc;
unw_proc_info_t pip;

if (!vmp_native_enabled()) {
if (vmp_native_enabled() == 0) {
return vmp_walk_and_record_python_stack_only(frame, result, max_depth, 0, pc);
}

Expand Down Expand Up @@ -546,15 +543,13 @@ int vmp_native_enable(void) {
vmp_native_traces_enabled = 1;

#ifdef VMPROF_LINUX
return vmp_read_vmaps("/proc/self/maps");
bail_out:
vmprof_error = dlerror();
fprintf(stderr, "could not load libunwind at runtime. error: %s\n", vmprof_error);
vmp_native_traces_enabled = 0;
return 0;
#else
return vmp_read_vmaps(NULL);
#endif
return 1;
}

void vmp_native_disable(void) {
Expand Down
3 changes: 3 additions & 0 deletions src/vmprof_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ int get_stack_trace(PY_THREAD_STATE_T * current, void** result, int max_depth, i
}
frame = current->frame;
#endif
if (frame == NULL) {
return 0;
}
return vmp_walk_and_record_stack(frame, result, max_depth, 1, pc);
}

Expand Down

0 comments on commit ca0c4e0

Please sign in to comment.