Skip to content

Commit

Permalink
Disabling working JSON tree output, not sure it's worth it
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Mar 23, 2022
1 parent 82d45fa commit eb18416
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/apex/dependency_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ double Node::writeNodeASCII(std::ofstream& outfile, double total, size_t indent)

double Node::writeNodeJSON(std::ofstream& outfile, double total, size_t indent) {
APEX_ASSERT(total > 0.0);
// indent as necessary
for (size_t i = 0 ; i < indent ; i++) { outfile << " "; }
indent++;
// write out the opening brace
Expand All @@ -163,6 +164,8 @@ double Node::writeNodeJSON(std::ofstream& outfile, double total, size_t indent)
// write out the inclusive
double acc = (data == task_identifier::get_main_task_id() || accumulated == 0.0) ?
total : std::min(total, accumulated);
// Don't write out synchronization events! They confuse the graph.
if (data->get_tree_name().find("Synchronize") != std::string::npos) acc = 0.0;
outfile << "\"size\": " << acc;

// if no children, we are done
Expand All @@ -182,27 +185,31 @@ double Node::writeNodeJSON(std::ofstream& outfile, double total, size_t indent)
sort(sorted.begin(), sorted.end(), cmp);

// do all the children
double remainder = acc;
double children_total;
bool first = true;
for (auto c : sorted) {
if (!first) { outfile << ",\n"; }
first = false;
double tmp = c.second->writeNodeJSON(outfile, total, indent);
remainder = remainder - tmp;
// if we didn't write the child, don't write a comma.
children_total = children_total + tmp;
}
double remainder = acc - children_total;
/*
if (remainder > 0.0) {
outfile << ",\n";
if (!first) { outfile << ",\n"; }
for (size_t i = 0 ; i < indent ; i++) { outfile << " "; }
outfile << "{ \"name\": \"" << data->get_tree_name() << "\", \"size\": " << remainder << " }";
}
*/
// close the list
outfile << "\n";
for (size_t i = 0 ; i < indent-1 ; i++) { outfile << " "; }
outfile << "]\n";
// end the object
for (size_t i = 0 ; i < indent-1 ; i++) { outfile << " "; }
outfile << "}";
return acc;
return std::max(acc, children_total);
}

void Node::writeTAUCallpath(std::ofstream& outfile, std::string prefix) {
Expand Down
2 changes: 2 additions & 0 deletions src/apex/profiler_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,12 +1103,14 @@ std::unordered_set<profile*> free_profiles;
root->tree_node->writeNodeASCII(myfile, wall_clock_main, 0);
myfile.close();
// dump the tree to an icicle/sunburst file
/*
stringstream txtname2;
txtname2 << apex_options::output_file_path();
txtname2 << filesystem_separator() << "tasktree." << node_id << ".json";
myfile.open(txtname2.str().c_str());
root->tree_node->writeNodeJSON(myfile, wall_clock_main, 0);
myfile.close();
*/
}

/* Write TAU profiles from the collected data. */
Expand Down

0 comments on commit eb18416

Please sign in to comment.