aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/reporter.h
diff options
context:
space:
mode:
authorGravatar Vijay Vasudevan <vrv@google.com>2016-02-25 09:57:34 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-02-25 11:15:20 -0800
commit5c9f4f8973d0958d13e30be574f9403df43b87d7 (patch)
treec0bb9c3a317bad01079e332f5ccf5e075d3b52d4 /tensorflow/core/util/reporter.h
parent82ecfff7daf984191cb7ee6818314c82caa5e6aa (diff)
TensorFlow: fix bug in StringPiece::contains which made it always
return true. Add a unittest to catch this type of regression in the future. Change: 115573280
Diffstat (limited to 'tensorflow/core/util/reporter.h')
-rw-r--r--tensorflow/core/util/reporter.h94
1 files changed, 0 insertions, 94 deletions
diff --git a/tensorflow/core/util/reporter.h b/tensorflow/core/util/reporter.h
deleted file mode 100644
index 91b24c3bd8..0000000000
--- a/tensorflow/core/util/reporter.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright 2016 Google Inc. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-==============================================================================*/
-
-#ifndef TENSORFLOW_CORE_UTIL_REPORTER_H_
-#define TENSORFLOW_CORE_UTIL_REPORTER_H_
-
-#include <memory>
-#include <string>
-#include <unordered_set>
-
-#include "tensorflow/core/platform/env.h"
-#include "tensorflow/core/platform/macros.h"
-#include "tensorflow/core/platform/mutex.h"
-#include "tensorflow/core/platform/types.h"
-#include "tensorflow/core/util/test_log.pb.h"
-
-namespace tensorflow {
-
-// The TestReporter writes test / benchmark output to text Protobuf files
-// when the environment variable "TEST_REPORT_FILE_PREFIX" is defined.
-//
-// If this environment variable is not defined, no logging is performed.
-//
-// The intended use is via the following 4 lines:
-//
-// TestReporter reporter(test_name);
-// TF_CHECK_OK(reporter.Initialize()));
-// TF_CHECK_OK(reporter.Benchmark(iters, cpu_time, wall_time, throughput));
-// TF_CHECK_OK(reporter.Close());
-//
-// For example, if the environment variable
-// TEST_REPORT_FILE_PREFIX="/tmp/run_"
-// is set, and test_name is "BM_Foo/1/2", then a BenchmarkEntry pbtxt
-// is written to file:
-// /tmp/run_BM_Foo__1__2
-//
-class TestReporter {
- public:
- static constexpr const char* kTestReporterEnv = "TEST_REPORT_FILE_PREFIX";
-
- // Create a TestReporter with the test name 'test_name'.
- explicit TestReporter(const string& test_name)
- : TestReporter(GetLogEnv(), test_name) {}
-
- // Provide a prefix filename, mostly used for testing this class.
- TestReporter(const string& fname, const string& test_name);
-
- // Initialize the TestReporter. If the reporting env flag is set,
- // try to create the reporting file. Fails if the file already exists.
- Status Initialize();
-
- // Finalize the report. If the reporting env flag is set,
- // flush the reporting file and close it.
- // Once Close is called, no other methods should be called other
- // than Close and the destructor.
- Status Close();
-
- // Set the report to be a Benchmark and log the given parameters.
- // Only does something if the reporting env flag is set.
- // Does not guarantee the report is written. Use Close() to
- // enforce I/O operations.
- Status Benchmark(int64 iters, double cpu_time, double wall_time,
- double throughput);
-
- ~TestReporter() { Close(); } // Autoclose in destructor.
-
- private:
- static string GetLogEnv() {
- const char* fname_ptr = std::getenv(kTestReporterEnv);
- return (fname_ptr != nullptr) ? fname_ptr : "";
- }
- bool closed_;
- string fname_;
- string test_name_;
- std::unique_ptr<WritableFile> log_file_;
- BenchmarkEntry benchmark_entry_;
- TF_DISALLOW_COPY_AND_ASSIGN(TestReporter);
-};
-
-} // namespace tensorflow
-
-#endif // TENSORFLOW_CORE_UTIL_REPORTER_H_