Skip to content

Commit

Permalink
Fixing boneheaded implementation of aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Dec 3, 2019
1 parent 0de68bd commit 6f71d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ std::shared_ptr<task_wrapper> update_task(
APEX_ASSERT(wrapper != nullptr);
task_identifier * id = task_identifier::get_task_id(timer_name);
if (id != wrapper->get_task_id()) {
wrapper->aliases.insert(id);
wrapper->alias = id;
/* printf("New alias: %s to %s\n",
wrapper->task_id->get_name().c_str(), timer_name.c_str()); */
}
Expand Down
18 changes: 6 additions & 12 deletions src/apex/task_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ struct task_wrapper {
*/
std::vector<profiler*> data_ptr;
/**
\brief An unordered set of other names for this task. If the task changes names
\brief If the task changes names
after creation (due to the application of an annotation) then the alias
becomes the new task_identifier for the task.
*/
std::unordered_set<task_identifier*> aliases;
task_identifier* alias;
/**
\brief Constructor.
*/
Expand All @@ -69,22 +69,16 @@ struct task_wrapper {
prof(nullptr),
guid(0ull),
parent_guid(0ull),
parent(nullptr)
parent(nullptr),
alias(nullptr)
{ }
/**
\brief Get the task_identifier for this task_wrapper.
\returns A pointer to the task_identifier
*/
inline task_identifier * get_task_id(void) {
if (!aliases.empty()) {
task_identifier * id = nullptr;
// find the first alias that isn't the same as the original name
for (auto tmp : aliases) {
if (tmp != id) {
id = tmp;
return id;
}
}
if (alias != nullptr) {
return alias;
}
return task_id;
}
Expand Down

0 comments on commit 6f71d5a

Please sign in to comment.