Skip to content

Commit

Permalink
debugging multiple parents support
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Aug 21, 2024
1 parent 0ba98a8 commit 7e5218f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,10 @@ void start(std::shared_ptr<task_wrapper> tt_ptr) {
return;
}
// get the thread id that is running this task
if (tt_ptr->thread_id != thread_instance::instance().get_id()) {
printf("Task %s created by %lu started by %lu\n", tt_ptr->task_id->get_name().c_str(),
tt_ptr->thread_id, thread_instance::instance().get_id());
}
tt_ptr->thread_id = thread_instance::instance().get_id();
if (_notify_listeners) {
bool success = true;
Expand Down Expand Up @@ -1216,6 +1220,12 @@ void stop(std::shared_ptr<task_wrapper> tt_ptr) {
APEX_UTIL_REF_COUNT_DOUBLE_STOP
return;
}
// get the thread id that is running this task
if (tt_ptr->prof->thread_id != thread_instance::instance().get_id()) {
printf("Task %s started by %lu stopped by %lu\n", tt_ptr->task_id->get_name().c_str(),
tt_ptr->prof->thread_id, thread_instance::instance().get_id());
APEX_ASSERT(tt_ptr->prof->thread_id == thread_instance::instance().get_id());
}
thread_instance::instance().clear_current_profiler(tt_ptr->prof, false,
null_task_wrapper);
// protect against calls after finalization
Expand Down
14 changes: 8 additions & 6 deletions src/apex/profiler_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ std::unordered_set<profile*> free_profiles;
#endif
// wait for profiles to update
std::this_thread::sleep_for(std::chrono::microseconds(100));
total_time = get_profile(main_id);
total_time = get_profile(*main_id);
}
#endif // APEX_SYNCHRONOUS_PROCESSING
double wall_clock_main = (total_time != nullptr) ? total_time->get_accumulated_seconds() : 0.0;
Expand Down Expand Up @@ -1239,6 +1239,7 @@ std::unordered_set<profile*> free_profiles;
// Determine number of counter events, as these need to be
// excluded from the number of normal timers
unordered_map<task_identifier, profile*>::const_iterator it2;
size_t function_count = 0;
{
std::unique_lock<std::mutex> task_map_lock(_task_map_mutex);
for(it2 = task_map.begin(); it2 != task_map.end(); it2++) {
Expand All @@ -1247,11 +1248,11 @@ std::unordered_set<profile*> free_profiles;
counter_events++;
}
}
}
size_t function_count = task_map.size() - counter_events;
if (apex_options::use_tasktree_output() || apex_options::use_hatchet_output()) {
auto root = task_wrapper::get_apex_main_wrapper();
function_count += (root->tree_node->getNodeCount() - 1);
function_count = task_map.size() - counter_events;
if (apex_options::use_tasktree_output() || apex_options::use_hatchet_output()) {
auto root = task_wrapper::get_apex_main_wrapper();
function_count += (root->tree_node->getNodeCount() - 1);
}
}

// Print the normal timers to the profile file
Expand Down Expand Up @@ -1301,6 +1302,7 @@ std::unordered_set<profile*> free_profiles;
if(counter_events > 0) {
myfile << counter_events << " userevents" << endl;
myfile << "# eventname numevents max min mean sumsqr" << endl;
std::unique_lock<std::mutex> task_map_lock(_task_map_mutex);
for(it2 = task_map.begin(); it2 != task_map.end(); it2++) {
profile * p = it2->second;
if(p->get_type() == APEX_COUNTER) {
Expand Down

0 comments on commit 7e5218f

Please sign in to comment.