aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/default/tracing.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/platform/default/tracing.cc')
-rw-r--r--tensorflow/core/platform/default/tracing.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/tensorflow/core/platform/default/tracing.cc b/tensorflow/core/platform/default/tracing.cc
new file mode 100644
index 0000000000..a4ddfad928
--- /dev/null
+++ b/tensorflow/core/platform/default/tracing.cc
@@ -0,0 +1,37 @@
+#include "tensorflow/core/platform/tracing.h"
+
+#include <unistd.h>
+
+namespace tensorflow {
+namespace port {
+
+void Tracing::RegisterEvent(EventCategory id, const char* name) {
+ // TODO(opensource): implement
+}
+
+void Tracing::Initialize() {}
+
+static bool TryGetEnv(const char* name, const char** value) {
+ *value = getenv(name);
+ return *value != nullptr && (*value)[0] != '\0';
+}
+
+const char* Tracing::LogDir() {
+ const char* dir;
+ if (TryGetEnv("TEST_TMPDIR", &dir)) return dir;
+ if (TryGetEnv("TMP", &dir)) return dir;
+ if (TryGetEnv("TMPDIR", &dir)) return dir;
+ dir = "/tmp";
+ if (access(dir, R_OK | W_OK | X_OK) == 0) return dir;
+ return "."; // Default to current directory.
+}
+
+static bool DoInit() {
+ Tracing::Initialize();
+ return true;
+}
+
+static const bool dummy = DoInit();
+
+} // namespace port
+} // namespace tensorflow