aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/default/test_benchmark.cc
diff options
context:
space:
mode:
authorGravatar Eugene Brevdo <ebrevdo@gmail.com>2016-02-26 09:06:15 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-02-26 13:22:28 -0800
commitfdfbd3af7a25410a999cbd6a0733e36ddd1ddb14 (patch)
tree770c2c86af2b424a6c653e7cf4ec55b6205defc1 /tensorflow/core/platform/default/test_benchmark.cc
parentdff7bb7c736787b05d5cd24aaf64cb787a68ca53 (diff)
Final fix to TestReporter (hopefully).
Change: 115675044
Diffstat (limited to 'tensorflow/core/platform/default/test_benchmark.cc')
-rw-r--r--tensorflow/core/platform/default/test_benchmark.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/core/platform/default/test_benchmark.cc b/tensorflow/core/platform/default/test_benchmark.cc
index 0b2287bec3..15c01b5233 100644
--- a/tensorflow/core/platform/default/test_benchmark.cc
+++ b/tensorflow/core/platform/default/test_benchmark.cc
@@ -15,11 +15,15 @@ limitations under the License.
#include "tensorflow/core/platform/test_benchmark.h"
+#include <cstdio>
+#include <cstdlib>
+
#include <vector>
#include "tensorflow/core/lib/strings/str_util.h"
#include "tensorflow/core/platform/env.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/regexp.h"
+#include "tensorflow/core/util/reporter.h"
namespace tensorflow {
namespace testing {
@@ -112,6 +116,24 @@ void Benchmark::Run(const char* pattern) {
}
printf("%-*s %10.0f %10d\t%s\n", width, name.c_str(),
seconds * 1e9 / iters, iters, full_label.c_str());
+
+ TestReporter reporter(name);
+ Status s = reporter.Initialize();
+ if (!s.ok()) {
+ LOG(ERROR) << s.ToString();
+ exit(EXIT_FAILURE);
+ }
+ s = reporter.Benchmark(iters, 0.0, seconds,
+ items_processed * 1e-6 / seconds);
+ if (!s.ok()) {
+ LOG(ERROR) << s.ToString();
+ exit(EXIT_FAILURE);
+ }
+ s = reporter.Close();
+ if (!s.ok()) {
+ LOG(ERROR) << s.ToString();
+ exit(EXIT_FAILURE);
+ }
}
}
}