Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix profiling json format and enhance perf view #11046

Merged
merged 2 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions onnxruntime/core/framework/sequential_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static void CalculateTotalOutputSizes(OpKernelContextInternal* op_kernel_context
size_t& total_output_sizes, const std::string& node_name, std::string& output_type_shape) {
// Calculate total output sizes for this operation.
std::stringstream ss;
int added_type_shapes = 0;
ss << "[";
total_output_sizes = 0;
ORT_UNUSED_PARAMETER(node_name);
Expand All @@ -78,8 +79,9 @@ static void CalculateTotalOutputSizes(OpKernelContextInternal* op_kernel_context
#endif
total_output_sizes += tensor_size;
auto shape_str = tensor.Shape().ToString();
ss << "{\"" << DataTypeImpl::ToString(tensor.DataType()) << "\":["
<< shape_str.substr(1, shape_str.size() - 2) << "]" << (i == output_count - 1 ? "}" : "},");
ss << (added_type_shapes++ > 0 ? "," : "")
<< "{\"" << DataTypeImpl::ToString(tensor.DataType()) << "\":["
<< shape_str.substr(1, shape_str.size() - 2) << "]}";
}
}
ss << "]";
Expand All @@ -93,6 +95,7 @@ static void CalculateTotalInputSizes(const OpKernelContextInternal* op_kernel_co
// Calculate total input sizes for this operation.
std::stringstream ss;
ss << "[";
int added_type_shapes = 0;
input_activation_sizes = 0;
input_parameter_sizes = 0;
ORT_UNUSED_PARAMETER(node_name);
Expand Down Expand Up @@ -124,8 +127,9 @@ static void CalculateTotalInputSizes(const OpKernelContextInternal* op_kernel_co
input_activation_sizes += tensor_size;
}
auto shape_str = p_tensor->Shape().ToString();
ss << "{\"" << DataTypeImpl::ToString(p_tensor->DataType()) << "\":["
<< shape_str.substr(1, shape_str.size() - 2) << "]" << (i == input_count - 1 ? "}" : "},");
ss << (added_type_shapes++ > 0 ? "," : "")
<< "{\"" << DataTypeImpl::ToString(p_tensor->DataType()) << "\":["
<< shape_str.substr(1, shape_str.size() - 2) << "]}";
}
}
ss << "]";
Expand Down
3 changes: 2 additions & 1 deletion tools/perf_view/ort_perf_view.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>My First JavaScript Treemap Chart</title>
<title id="filename">Onnxruntime Perf View</title>
<script type="text/javascript" src="https://cdn.anychart.com/releases/v8/js/anychart-core.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.11.0/js/anychart-ui.min.js"></script>
<script type="text/javascript" src="https://cdn.anychart.com/releases/v8/js/anychart-treemap.min.js"></script>
Expand Down Expand Up @@ -60,6 +60,7 @@
preloader.visible(true);

const fileList = event.target.files;
document.getElementById('filename').text = fileList[0].name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use spaces instead of tabs.

console.log(fileList);
const reader = new FileReader();
reader.addEventListener('load', (event) => {
Expand Down