aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/profiler
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-08-28 18:49:58 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-28 18:53:45 -0700
commit1acf8958429ed9a360dc07d2d63661a4c606c3ba (patch)
tree52c8f410c1524a232c892dc2b32a9bcca15908c9 /tensorflow/core/profiler
parent5a1d6d9dac79b46f055462ee52125753524d9f6e (diff)
Tweak profiler for the UI
1. Support parsing text format graph from python 2. Remove line-snippet for code view (too verbose) PiperOrigin-RevId: 166790284
Diffstat (limited to 'tensorflow/core/profiler')
-rw-r--r--tensorflow/core/profiler/internal/print_model_analysis.cc6
-rw-r--r--tensorflow/core/profiler/internal/tfprof_code.cc5
-rw-r--r--tensorflow/core/profiler/internal/tfprof_stats.cc2
3 files changed, 6 insertions, 7 deletions
diff --git a/tensorflow/core/profiler/internal/print_model_analysis.cc b/tensorflow/core/profiler/internal/print_model_analysis.cc
index 65b54f01aa..fd46b957e8 100644
--- a/tensorflow/core/profiler/internal/print_model_analysis.cc
+++ b/tensorflow/core/profiler/internal/print_model_analysis.cc
@@ -87,7 +87,11 @@ bool NewProfiler(const string* graph, const string* op_log) {
CHECK(!tf_stat) << "Currently only 1 living tfprof profiler is allowed";
CHECK(graph) << "graph mustn't be null";
std::unique_ptr<GraphDef> graph_ptr(new GraphDef());
- graph_ptr->ParseFromString(*graph);
+ if (!graph_ptr->ParseFromString(*graph)) {
+ if (!protobuf::TextFormat::ParseFromString(*graph, graph_ptr.get())) {
+ fprintf(stderr, "Failed to parse graph\n");
+ }
+ }
std::unique_ptr<OpLogProto> op_log_ptr;
if (op_log && !op_log->empty()) {
diff --git a/tensorflow/core/profiler/internal/tfprof_code.cc b/tensorflow/core/profiler/internal/tfprof_code.cc
index 7f4d682cda..c9c0baa908 100644
--- a/tensorflow/core/profiler/internal/tfprof_code.cc
+++ b/tensorflow/core/profiler/internal/tfprof_code.cc
@@ -44,11 +44,6 @@ string GetTraceString(const CodeDef::Trace& trace) {
} else {
ntrace += ":" + trace.function().substr(0, 17) + "...";
}
- if (trace.line().length() < 20) {
- ntrace += ":" + trace.line();
- } else {
- ntrace += ":" + trace.line().substr(0, 17) + "...";
- }
return ntrace;
}
diff --git a/tensorflow/core/profiler/internal/tfprof_stats.cc b/tensorflow/core/profiler/internal/tfprof_stats.cc
index 012c49525a..81db766796 100644
--- a/tensorflow/core/profiler/internal/tfprof_stats.cc
+++ b/tensorflow/core/profiler/internal/tfprof_stats.cc
@@ -125,7 +125,7 @@ const MultiGraphNodeProto& TFStats::ShowMultiGraphNode(
if (!Validate(opts)) {
return empty_multi_graph_node_;
}
- if (cmd == kCmds[2]) {
+ if (cmd == kCmds[2] && has_code_traces()) {
return code_view_->Show(opts);
} else if (cmd == kCmds[3]) {
return op_view_->Show(opts);