Preparation for generic overview page & input-pipeline analyzer
PiperOrigin-RevId: 282648783
Change-Id: Ieec8d9200cd1ed15e0af8d9c5388589d76e8c820
diff --git a/tensorflow/core/profiler/protobuf/BUILD b/tensorflow/core/profiler/protobuf/BUILD
index 8bd4b29..9744303 100644
--- a/tensorflow/core/profiler/protobuf/BUILD
+++ b/tensorflow/core/profiler/protobuf/BUILD
@@ -50,3 +50,10 @@
cc_api_version = 2,
visibility = [":friends"],
)
+
+tf_proto_library(
+ name = "hardware_types_proto",
+ srcs = ["hardware_types.proto"],
+ cc_api_version = 2,
+ visibility = [":friends"],
+)
diff --git a/tensorflow/core/profiler/protobuf/hardware_types.proto b/tensorflow/core/profiler/protobuf/hardware_types.proto
new file mode 100644
index 0000000..fe04d58
--- /dev/null
+++ b/tensorflow/core/profiler/protobuf/hardware_types.proto
@@ -0,0 +1,17 @@
+// This proto describes the types of hardware profiled by the TensorFlow
+// profiler.
+syntax = "proto3";
+
+package tensorflow.profiler;
+
+// Types of hardware profiled.
+enum HardwareType {
+ // Unknown hardware.
+ UNKNOWN_HARDWARE = 0;
+ // CPU only without any hardware accelerator.
+ CPU_ONLY = 1;
+ // GPU.
+ GPU = 2;
+ // TPU.
+ TPU = 3;
+}
diff --git a/tensorflow/core/profiler/utils/event_span.cc b/tensorflow/core/profiler/utils/event_span.cc
index 92eed35..8c31c55 100644
--- a/tensorflow/core/profiler/utils/event_span.cc
+++ b/tensorflow/core/profiler/utils/event_span.cc
@@ -54,7 +54,7 @@
EventType AssignEventType(
const Timespan& timespan,
const std::vector<EventTypeSpan>& sorted_overlapped_events) {
- EventType event_type = BOTH_IDLE;
+ EventType event_type = UNKNOWN_TIME;
for (const auto& event : sorted_overlapped_events) {
if (timespan.end_ps() < event.span.begin_ps()) {
// Because sorted_overlapped_events is sorted in the event's begin time,
@@ -131,8 +131,8 @@
std::string PrintEventType(EventType event_type) {
switch (event_type) {
- case BOTH_IDLE:
- return "both_idle";
+ case UNKNOWN_TIME:
+ return "unknown_time";
case HOST_COMPUTE:
return "host_compute";
case HOST_COMPILE:
diff --git a/tensorflow/core/profiler/utils/event_span.h b/tensorflow/core/profiler/utils/event_span.h
index cb477c9..8a2e300 100644
--- a/tensorflow/core/profiler/utils/event_span.h
+++ b/tensorflow/core/profiler/utils/event_span.h
@@ -30,8 +30,9 @@
// has a higher priority than a smaller number when used in execution-time
// breakdown.
enum EventType {
- // Both host and device are idle.
- BOTH_IDLE = 0,
+ // No event associated with the time. It could be that the machine was idle or
+ // executing some events which were not traced.
+ UNKNOWN_TIME = 0,
// Host is computing.
HOST_COMPUTE = 1,
// Host is compiling.