tracing_impl.h revision f41959ccb2d9d4c722fe8fc3351401d53bcf4900
1#ifndef TENSORFLOW_PLATFORM_DEFAULT_TRACING_IMPL_H_
2#define TENSORFLOW_PLATFORM_DEFAULT_TRACING_IMPL_H_
3
4// Stub implementations of tracing functionality.
5
6#include "tensorflow/core/public/status.h"
7#include "tensorflow/core/lib/core/threadpool.h"
8#include "tensorflow/core/lib/random/random.h"
9#include "tensorflow/core/platform/tracing.h"
10
11namespace tensorflow {
12namespace port {
13
14// Definitions that do nothing for platforms that don't have underlying thread
15// tracing support.
16#define TRACELITERAL(a) \
17  do {                  \
18  } while (0)
19#define TRACESTRING(s) \
20  do {                 \
21  } while (0)
22#define TRACEPRINTF(format, ...) \
23  do {                           \
24  } while (0)
25
26inline uint64 Tracing::UniqueId() { return random::New64(); }
27inline bool Tracing::IsActive() { return false; }
28inline void Tracing::RegisterCurrentThread(const char* name) {}
29
30// Posts an atomic threadscape event with the supplied category and arg.
31inline void Tracing::RecordEvent(EventCategory category, uint64 arg) {
32  // TODO(opensource): Implement
33}
34
35inline Tracing::ScopedActivity::ScopedActivity(EventCategory category,
36                                               uint64 arg)
37    : enabled_(false), region_id_(category_id_[category]) {}
38
39inline Tracing::ScopedActivity::~ScopedActivity() {}
40
41}  // namespace port
42}  // namespace tensorflow
43
44#endif  // TENSORFLOW_PLATFORM_DEFAULT_TRACING_IMPL_H_
45