Skip to content

Commit

Permalink
add checks for callgraph level; only track function calls on_profilin…
Browse files Browse the repository at this point in the history
…g to support this
  • Loading branch information
yebinchon committed Apr 9, 2024
1 parent cfff641 commit d94f6c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/runtime/ProfilingModules/DependenceWithContextModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ void DependenceWithContextModule::loop_exit() __attribute__((always_inline)) {
}

void DependenceWithContextModule::func_entry(uint32_t instr) {
if (nested_level == 1) {
if(callgraph_level == 0) {
context = instr;
}
callgraph_level++;
}

void DependenceWithContextModule::func_exit(uint32_t instr) {
if (nested_level == 1) {
callgraph_level--;
if(callgraph_level == 0) {
context = 0;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/runtime/ProfilingModules/DependenceWithContextModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DependenceWithContextModule : public LocalWriteModule {

unsigned int context = 0;
int nested_level = 0;
int callgraph_level = 0;

#ifdef COLLECT_TRACE
// Collect trace
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/frontend/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ void memalign_callback(void *ptr, size_t alignment, size_t size) {

// FIXME: a bunch of unused functions
void SLAMP_main_entry(uint32_t argc, char **argv, char **env) {}
void SLAMP_push(const uint32_t instr) { PRODUCE_FUNC_CALL_PUSH(instr); }
void SLAMP_pop() { PRODUCE_FUNC_CALL_POP(); }
void SLAMP_push(const uint32_t instr) { if(on_profiling) PRODUCE_FUNC_CALL_PUSH(instr); }
void SLAMP_pop() { if(on_profiling) PRODUCE_FUNC_CALL_POP(); }

void SLAMP_allocated(uint64_t addr) {}

Expand Down

0 comments on commit d94f6c1

Please sign in to comment.