aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/profiler
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-01-30 10:05:04 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-30 12:27:47 -0800
commit7149a2e2e2f549035f23e21224ee41afe8df3876 (patch)
tree4fab32a87362e9708d07f388154a10ccb0c7800b /tensorflow/core/profiler
parent88eb6c61ef7659c2b5bb1ec6586c7d3cca5e4e9c (diff)
Cleanup: Ran clang-format on files in tensorflow/core/.../*.{cc,h}.
PiperOrigin-RevId: 183848459
Diffstat (limited to 'tensorflow/core/profiler')
-rw-r--r--tensorflow/core/profiler/internal/advisor/tfprof_advisor_test.cc9
-rw-r--r--tensorflow/core/profiler/internal/tfprof_op.cc16
-rw-r--r--tensorflow/core/profiler/internal/tfprof_op.h5
-rw-r--r--tensorflow/core/profiler/internal/tfprof_show.h71
-rw-r--r--tensorflow/core/profiler/internal/tfprof_show_multi.h2
-rw-r--r--tensorflow/core/profiler/internal/tfprof_timeline.h2
6 files changed, 55 insertions, 50 deletions
diff --git a/tensorflow/core/profiler/internal/advisor/tfprof_advisor_test.cc b/tensorflow/core/profiler/internal/advisor/tfprof_advisor_test.cc
index d05143aff9..e968b9c97e 100644
--- a/tensorflow/core/profiler/internal/advisor/tfprof_advisor_test.cc
+++ b/tensorflow/core/profiler/internal/advisor/tfprof_advisor_test.cc
@@ -53,10 +53,13 @@ class TFProfAdvisorTest : public ::testing::Test {
NodeExecStats node_stat;
node_stat.set_all_start_micros(start_miros);
node_stat.set_op_end_rel_micros(end_rel_micros);
- node->AddStepStat(step, "/job:localhost/replica:0/task:0/device:GPU:0", node_stat);
- node->AddStepStat(step, "/job:localhost/replica:0/task:0/device:GPU:0:stream:all",
+ node->AddStepStat(step, "/job:localhost/replica:0/task:0/device:GPU:0",
node_stat);
- node->AddStepStat(step, "/job:localhost/replica:0/task:0/device:GPU:0:stream:0",
+ node->AddStepStat(step,
+ "/job:localhost/replica:0/task:0/device:GPU:0:stream:all",
+ node_stat);
+ node->AddStepStat(step,
+ "/job:localhost/replica:0/task:0/device:GPU:0:stream:0",
node_stat);
return node;
}
diff --git a/tensorflow/core/profiler/internal/tfprof_op.cc b/tensorflow/core/profiler/internal/tfprof_op.cc
index 5a8429d489..3dce1d85db 100644
--- a/tensorflow/core/profiler/internal/tfprof_op.cc
+++ b/tensorflow/core/profiler/internal/tfprof_op.cc
@@ -113,8 +113,9 @@ const ShowMultiNode* TFOp::ShowInternal(const Options& opts,
root_->formatted_str = FormatNode(root_.get(), root_.get(), opts);
}
if (timeline) {
- fprintf(stderr, "op view doesn't support timeline yet. "
- "Consider graph/scope/code view.\n");
+ fprintf(stderr,
+ "op view doesn't support timeline yet. "
+ "Consider graph/scope/code view.\n");
return root_.get();
}
if (cnodes_map_.empty()) {
@@ -265,9 +266,9 @@ string TFOp::FormatNode(OpNode* node, OpNode* root, const Options& opts) const {
double pct = 0.0;
if (node->proto().total_parameters() > 0) {
accu_pct = 100.0 * node->proto().total_parameters() /
- root->proto().total_parameters();
- pct = 100.0 * node->proto().parameters() /
- root->proto().total_parameters();
+ root->proto().total_parameters();
+ pct =
+ 100.0 * node->proto().parameters() / root->proto().total_parameters();
}
attrs.push_back(strings::Printf(
"%30s",
@@ -282,9 +283,8 @@ string TFOp::FormatNode(OpNode* node, OpNode* root, const Options& opts) const {
double pct = 0.0;
if (node->proto().total_float_ops() > 0) {
accu_pct = 100.0 * node->proto().total_float_ops() /
- root->proto().total_float_ops();
- pct = 100.0 * node->proto().float_ops() /
- root->proto().total_float_ops();
+ root->proto().total_float_ops();
+ pct = 100.0 * node->proto().float_ops() / root->proto().total_float_ops();
}
attrs.push_back(strings::Printf(
diff --git a/tensorflow/core/profiler/internal/tfprof_op.h b/tensorflow/core/profiler/internal/tfprof_op.h
index fe1c3b2ae8..aa22182d36 100644
--- a/tensorflow/core/profiler/internal/tfprof_op.h
+++ b/tensorflow/core/profiler/internal/tfprof_op.h
@@ -41,8 +41,7 @@ namespace tfprof {
// to input ops.
class TFOp : public TFMultiShow {
public:
- explicit TFOp()
- : TFMultiShow() {}
+ explicit TFOp() : TFMultiShow() {}
~TFOp() override {}
void AddNode(TFGraphNode* node) override;
@@ -51,7 +50,7 @@ class TFOp : public TFMultiShow {
private:
const ShowMultiNode* ShowInternal(const Options& opts,
- Timeline* timeline) override;
+ Timeline* timeline) override;
int64 SearchRoot(const std::vector<OpNode*> nodes,
const std::vector<string>& regexes);
diff --git a/tensorflow/core/profiler/internal/tfprof_show.h b/tensorflow/core/profiler/internal/tfprof_show.h
index 4d6de06070..81b021549a 100644
--- a/tensorflow/core/profiler/internal/tfprof_show.h
+++ b/tensorflow/core/profiler/internal/tfprof_show.h
@@ -78,40 +78,43 @@ class TFShow {
return nodes;
}
std::vector<T*> sorted_nodes = nodes;
- std::sort(sorted_nodes.begin(), sorted_nodes.end(), [&opts](const T* n1,
- const T* n2) {
- if (n1->name() == kTFProfRoot) return true;
- if (n2->name() == kTFProfRoot) return false;
- bool name_cmp = n1->name() < n2->name();
- if (opts.order_by == kOrderBy[0]) {
- return name_cmp;
- } else if (opts.order_by == kOrderBy[1]) {
- return n1->proto().total_requested_bytes() >
- n2->proto().total_requested_bytes();
- } else if (opts.order_by == kOrderBy[2]) {
- return n1->proto().total_peak_bytes() > n2->proto().total_peak_bytes();
- } else if (opts.order_by == kOrderBy[3]) {
- return n1->proto().total_residual_bytes() >
- n2->proto().total_residual_bytes();
- } else if (opts.order_by == kOrderBy[4]) {
- return n1->proto().total_output_bytes() >
- n2->proto().total_output_bytes();
- } else if (opts.order_by == kOrderBy[5]) {
- return n1->proto().total_exec_micros() >
- n2->proto().total_exec_micros();
- } else if (opts.order_by == kOrderBy[6]) {
- return n1->proto().total_accelerator_exec_micros() >
- n2->proto().total_accelerator_exec_micros();
- } else if (opts.order_by == kOrderBy[7]) {
- return n1->proto().total_cpu_exec_micros() >
- n2->proto().total_cpu_exec_micros();
- } else if (opts.order_by == kOrderBy[8]) {
- return n1->proto().total_parameters() > n2->proto().total_parameters();
- } else if (opts.order_by == kOrderBy[9]) {
- return n1->proto().total_float_ops() > n2->proto().total_float_ops();
- }
- return name_cmp;
- });
+ std::sort(sorted_nodes.begin(), sorted_nodes.end(),
+ [&opts](const T* n1, const T* n2) {
+ if (n1->name() == kTFProfRoot) return true;
+ if (n2->name() == kTFProfRoot) return false;
+ bool name_cmp = n1->name() < n2->name();
+ if (opts.order_by == kOrderBy[0]) {
+ return name_cmp;
+ } else if (opts.order_by == kOrderBy[1]) {
+ return n1->proto().total_requested_bytes() >
+ n2->proto().total_requested_bytes();
+ } else if (opts.order_by == kOrderBy[2]) {
+ return n1->proto().total_peak_bytes() >
+ n2->proto().total_peak_bytes();
+ } else if (opts.order_by == kOrderBy[3]) {
+ return n1->proto().total_residual_bytes() >
+ n2->proto().total_residual_bytes();
+ } else if (opts.order_by == kOrderBy[4]) {
+ return n1->proto().total_output_bytes() >
+ n2->proto().total_output_bytes();
+ } else if (opts.order_by == kOrderBy[5]) {
+ return n1->proto().total_exec_micros() >
+ n2->proto().total_exec_micros();
+ } else if (opts.order_by == kOrderBy[6]) {
+ return n1->proto().total_accelerator_exec_micros() >
+ n2->proto().total_accelerator_exec_micros();
+ } else if (opts.order_by == kOrderBy[7]) {
+ return n1->proto().total_cpu_exec_micros() >
+ n2->proto().total_cpu_exec_micros();
+ } else if (opts.order_by == kOrderBy[8]) {
+ return n1->proto().total_parameters() >
+ n2->proto().total_parameters();
+ } else if (opts.order_by == kOrderBy[9]) {
+ return n1->proto().total_float_ops() >
+ n2->proto().total_float_ops();
+ }
+ return name_cmp;
+ });
return sorted_nodes;
}
diff --git a/tensorflow/core/profiler/internal/tfprof_show_multi.h b/tensorflow/core/profiler/internal/tfprof_show_multi.h
index 2a2208d8e7..711d35f975 100644
--- a/tensorflow/core/profiler/internal/tfprof_show_multi.h
+++ b/tensorflow/core/profiler/internal/tfprof_show_multi.h
@@ -50,7 +50,7 @@ class TFMultiShow {
protected:
virtual const ShowMultiNode* ShowInternal(const Options& opts,
- Timeline* timeline) = 0;
+ Timeline* timeline) = 0;
bool LookUpCheckPoint(const string& name,
std::unique_ptr<TFProfTensor>* tensor);
diff --git a/tensorflow/core/profiler/internal/tfprof_timeline.h b/tensorflow/core/profiler/internal/tfprof_timeline.h
index 651ad3f0c1..baf3fb2bed 100644
--- a/tensorflow/core/profiler/internal/tfprof_timeline.h
+++ b/tensorflow/core/profiler/internal/tfprof_timeline.h
@@ -20,8 +20,8 @@ limitations under the License.
#include "tensorflow/core/framework/graph.pb.h"
#include "tensorflow/core/framework/step_stats.pb.h"
#include "tensorflow/core/lib/strings/strcat.h"
-#include "tensorflow/core/protobuf/config.pb.h"
#include "tensorflow/core/profiler/internal/tfprof_node_show.h"
+#include "tensorflow/core/protobuf/config.pb.h"
namespace tensorflow {
namespace tfprof {