From b661070db9d29a2679310fe063b21582eeed9769 Mon Sep 17 00:00:00 2001 From: Jose Baiocchi <jbaiocchi@google.com> Date: Tue, 12 May 2020 10:11:10 -0700 Subject: [PATCH] IWYU in profiler/internal PiperOrigin-RevId: 311149561 Change-Id: I71100194af937fc66d44c32265b8fe8febf070df --- tensorflow/core/profiler/internal/BUILD | 16 ++++++---------- .../core/profiler/internal/annotation_stack.cc | 4 ++++ .../core/profiler/internal/annotation_stack.h | 1 + tensorflow/core/profiler/internal/cpu/BUILD | 16 ++++++++++------ .../core/profiler/internal/cpu/host_tracer.cc | 9 +++++++-- .../profiler/internal/cpu/host_tracer_test.cc | 18 ++++++++++++------ .../profiler/internal/cpu/host_tracer_utils.cc | 3 +++ .../internal/cpu/metadata_collector.cc | 6 ++++++ .../profiler/internal/cpu/python_tracer.cc | 9 ++++----- .../core/profiler/internal/parse_annotation.cc | 3 +++ .../core/profiler/internal/parse_annotation.h | 1 - .../profiler/internal/parse_annotation_test.cc | 3 +++ .../core/profiler/internal/profiler_factory.cc | 6 ++++++ .../core/profiler/internal/profiler_factory.h | 1 + .../profiler/internal/profiler_interface.h | 1 - .../internal/scoped_annotation_test.cc | 13 ++++++++----- .../core/profiler/internal/traceme_recorder.cc | 10 ++++++++++ .../core/profiler/internal/traceme_recorder.h | 2 -- .../profiler/internal/traceme_recorder_test.cc | 15 ++++++++++++--- 19 files changed, 96 insertions(+), 41 deletions(-) diff --git a/tensorflow/core/profiler/internal/BUILD b/tensorflow/core/profiler/internal/BUILD index 9fab42cd54a..85fa4e7fc44 100644 --- a/tensorflow/core/profiler/internal/BUILD +++ b/tensorflow/core/profiler/internal/BUILD @@ -423,8 +423,10 @@ tf_cc_test( deps = [ ":traceme_recorder", "//tensorflow/core:lib", + "//tensorflow/core:test", + "//tensorflow/core:test_main", "@com_google_absl//absl/strings", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -434,7 +436,6 @@ cc_library( deps = [ "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", - "//tensorflow/core/profiler:profiler_options_proto_cc", "//tensorflow/core/profiler/protobuf:xplane_proto_cc", ], ) @@ -444,6 +445,7 @@ cc_library( hdrs = ["profiler_factory.h"], deps = [ ":profiler_interface", + "//tensorflow/core/profiler:profiler_options_proto_cc", ] + if_static([ ":profiler_factory_impl", ]), @@ -461,8 +463,7 @@ cc_library( deps = [ ":profiler_interface", "//tensorflow/core:lib", - "//tensorflow/core:protos_all_cc", - "//tensorflow/core/profiler/protobuf:xplane_proto_cc", + "//tensorflow/core/profiler:profiler_options_proto_cc", ], alwayslink = True, ) @@ -513,15 +514,10 @@ tf_cc_test( srcs = ["scoped_annotation_test.cc"], deps = [ ":annotation_stack", - "//tensorflow/core:core_cpu", "//tensorflow/core:core_cpu_internal", - "//tensorflow/core:framework", - "//tensorflow/core:lib", "//tensorflow/core:lib_internal", - "//tensorflow/core:protos_all_cc", "//tensorflow/core:test", "//tensorflow/core:test_main", - "//tensorflow/core:testlib", "//tensorflow/core/profiler/lib:scoped_annotation", "@com_google_absl//absl/strings", ], @@ -544,6 +540,6 @@ tf_cc_test( ":parse_annotation", "//tensorflow/core:test", "//tensorflow/core:test_main", - "//tensorflow/core:testlib", + "@com_google_absl//absl/strings", ], ) diff --git a/tensorflow/core/profiler/internal/annotation_stack.cc b/tensorflow/core/profiler/internal/annotation_stack.cc index 4cfd1027a68..4c15ca47c3d 100644 --- a/tensorflow/core/profiler/internal/annotation_stack.cc +++ b/tensorflow/core/profiler/internal/annotation_stack.cc @@ -15,6 +15,10 @@ limitations under the License. #include "tensorflow/core/profiler/internal/annotation_stack.h" +#include <atomic> + +#include "tensorflow/core/platform/types.h" + namespace tensorflow { namespace profiler { namespace internal { diff --git a/tensorflow/core/profiler/internal/annotation_stack.h b/tensorflow/core/profiler/internal/annotation_stack.h index 38cd962cb32..e626c4c73cc 100644 --- a/tensorflow/core/profiler/internal/annotation_stack.h +++ b/tensorflow/core/profiler/internal/annotation_stack.h @@ -18,6 +18,7 @@ limitations under the License. #include <stddef.h> #include <atomic> +#include <utility> #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" diff --git a/tensorflow/core/profiler/internal/cpu/BUILD b/tensorflow/core/profiler/internal/cpu/BUILD index e156667c5a7..c24c8c7d456 100644 --- a/tensorflow/core/profiler/internal/cpu/BUILD +++ b/tensorflow/core/profiler/internal/cpu/BUILD @@ -18,6 +18,7 @@ cc_library( "//tensorflow/core/profiler/utils:tf_op_utils", "//tensorflow/core/profiler/utils:xplane_builder", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", ], ) @@ -26,10 +27,10 @@ cc_library( srcs = ["host_tracer.cc"], deps = [ ":host_tracer_utils", - "//tensorflow/core:core_cpu_lib", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", "//tensorflow/core:protos_all_cc", + "//tensorflow/core/profiler:profiler_options_proto_cc", "//tensorflow/core/profiler/internal:profiler_factory", "//tensorflow/core/profiler/internal:profiler_interface", "//tensorflow/core/profiler/internal:traceme_recorder", @@ -50,14 +51,17 @@ tf_cc_test( "//tensorflow/core:lib", "//tensorflow/core:protos_all_cc", "//tensorflow/core:test", + "//tensorflow/core:test_main", + "//tensorflow/core/profiler:profiler_options_proto_cc", "//tensorflow/core/profiler/internal:profiler_interface", "//tensorflow/core/profiler/lib:profiler_session", "//tensorflow/core/profiler/lib:traceme", "//tensorflow/core/profiler/protobuf:xplane_proto_cc", "//tensorflow/core/profiler/utils:xplane_schema", "//tensorflow/core/profiler/utils:xplane_visitor", + "@com_google_absl//absl/strings", "@com_google_absl//absl/types:optional", - "@com_google_googletest//:gtest_main", + "@com_google_googletest//:gtest", ], ) @@ -67,17 +71,14 @@ cc_library( copts = ["-fexceptions"], features = ["-use_header_modules"], deps = [ - "//tensorflow/core:core_cpu_lib", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", "//tensorflow/core:protos_all_cc", + "//tensorflow/core/profiler:profiler_options_proto_cc", "//tensorflow/core/profiler/internal:profiler_factory", "//tensorflow/core/profiler/internal:profiler_interface", "//tensorflow/core/profiler/protobuf:xplane_proto_cc", - "//tensorflow/core/profiler/utils:xplane_schema", - "//tensorflow/core/profiler/utils:xplane_utils", "//tensorflow/python/profiler/internal:python_hooks", - "@com_google_absl//absl/strings", ], alwayslink = True, ) @@ -86,9 +87,12 @@ cc_library( name = "metadata_collector", srcs = ["metadata_collector.cc"], deps = [ + "//tensorflow/compiler/xla/service:hlo_proto_cc", "//tensorflow/compiler/xla/service/gpu:gpu_debug_info_manager", "//tensorflow/core:lib", "//tensorflow/core:lib_internal", + "//tensorflow/core:protos_all_cc", + "//tensorflow/core/profiler:profiler_options_proto_cc", "//tensorflow/core/profiler/internal:profiler_factory", "//tensorflow/core/profiler/internal:profiler_interface", "//tensorflow/core/profiler/protobuf:xplane_proto_cc", diff --git a/tensorflow/core/profiler/internal/cpu/host_tracer.cc b/tensorflow/core/profiler/internal/cpu/host_tracer.cc index 30b87c84fa2..be1a7a2777b 100644 --- a/tensorflow/core/profiler/internal/cpu/host_tracer.cc +++ b/tensorflow/core/profiler/internal/cpu/host_tracer.cc @@ -12,18 +12,23 @@ 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. ==============================================================================*/ +#include <memory> +#include <string> #include <utility> #include <vector> #include "absl/strings/str_split.h" +#include "absl/strings/string_view.h" #include "tensorflow/core/framework/step_stats.pb.h" #include "tensorflow/core/platform/env_time.h" #include "tensorflow/core/platform/errors.h" #include "tensorflow/core/platform/status.h" +#include "tensorflow/core/platform/types.h" #include "tensorflow/core/profiler/internal/cpu/host_tracer_utils.h" #include "tensorflow/core/profiler/internal/profiler_factory.h" #include "tensorflow/core/profiler/internal/profiler_interface.h" #include "tensorflow/core/profiler/internal/traceme_recorder.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" #include "tensorflow/core/profiler/utils/xplane_schema.h" #include "tensorflow/core/profiler/utils/xplane_utils.h" @@ -119,8 +124,8 @@ Status HostTracer::CollectData(RunMetadata* run_metadata) { std::vector<absl::string_view> parts = absl::StrSplit(event.name, kUserMetadataMarker); if (parts.size() >= 2) { - ns->set_node_name(string(parts[0])); - ns->set_timeline_label(string(parts[1])); + ns->set_node_name(std::string(parts[0])); + ns->set_timeline_label(std::string(parts[1])); } else { ns->set_node_name(std::move(event.name)); } diff --git a/tensorflow/core/profiler/internal/cpu/host_tracer_test.cc b/tensorflow/core/profiler/internal/cpu/host_tracer_test.cc index e32ba92de66..499b7b6b564 100644 --- a/tensorflow/core/profiler/internal/cpu/host_tracer_test.cc +++ b/tensorflow/core/profiler/internal/cpu/host_tracer_test.cc @@ -12,17 +12,23 @@ 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. ==============================================================================*/ +#include <memory> +#include <ostream> #include <string> #include <gmock/gmock.h> -#include <gtest/gtest.h> +#include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "tensorflow/core/framework/step_stats.pb.h" #include "tensorflow/core/lib/core/status_test_util.h" #include "tensorflow/core/platform/env.h" +#include "tensorflow/core/platform/status.h" +#include "tensorflow/core/platform/test.h" +#include "tensorflow/core/platform/types.h" #include "tensorflow/core/profiler/internal/profiler_interface.h" #include "tensorflow/core/profiler/lib/profiler_session.h" #include "tensorflow/core/profiler/lib/traceme.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" #include "tensorflow/core/profiler/utils/xplane_schema.h" #include "tensorflow/core/profiler/utils/xplane_visitor.h" @@ -38,13 +44,13 @@ namespace { using ::testing::UnorderedElementsAre; -NodeExecStats MakeNodeStats(const string& name, uint32 thread_id, - const string& label = "") { +NodeExecStats MakeNodeStats(absl::string_view name, uint32 thread_id, + absl::string_view label = "") { NodeExecStats ns; - ns.set_node_name(name); + ns.set_node_name(std::string(name)); ns.set_thread_id(thread_id); if (!label.empty()) { - ns.set_timeline_label(label); + ns.set_timeline_label(std::string(label)); } return ns; } @@ -109,7 +115,7 @@ TEST(HostTracerTest, CollectsTraceMeEventsAsRunMetadata) { TEST(HostTracerTest, CollectsTraceMeEventsAsXSpace) { uint32 thread_id; - string thread_name = "MyThreadName"; + std::string thread_name = "MyThreadName"; XSpace space; // We start a thread with a known and controled name. As of the time of diff --git a/tensorflow/core/profiler/internal/cpu/host_tracer_utils.cc b/tensorflow/core/profiler/internal/cpu/host_tracer_utils.cc index a4709ae2113..2e5d8ac1770 100644 --- a/tensorflow/core/profiler/internal/cpu/host_tracer_utils.cc +++ b/tensorflow/core/profiler/internal/cpu/host_tracer_utils.cc @@ -14,10 +14,13 @@ limitations under the License. ==============================================================================*/ #include "tensorflow/core/profiler/internal/cpu/host_tracer_utils.h" +#include <string> #include <utility> #include <vector> #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "tensorflow/core/platform/types.h" #include "tensorflow/core/profiler/internal/parse_annotation.h" #include "tensorflow/core/profiler/internal/traceme_recorder.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" diff --git a/tensorflow/core/profiler/internal/cpu/metadata_collector.cc b/tensorflow/core/profiler/internal/cpu/metadata_collector.cc index c6aa7840920..58da20ae3c5 100644 --- a/tensorflow/core/profiler/internal/cpu/metadata_collector.cc +++ b/tensorflow/core/profiler/internal/cpu/metadata_collector.cc @@ -13,17 +13,23 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ +#include <memory> +#include <string> #include <utility> #include <vector> #include "tensorflow/compiler/xla/service/gpu/gpu_debug_info_manager.h" +#include "tensorflow/compiler/xla/service/hlo.pb.h" #include "tensorflow/core/platform/macros.h" +#include "tensorflow/core/platform/status.h" #include "tensorflow/core/profiler/internal/profiler_factory.h" #include "tensorflow/core/profiler/internal/profiler_interface.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" #include "tensorflow/core/profiler/utils/xplane_builder.h" #include "tensorflow/core/profiler/utils/xplane_schema.h" #include "tensorflow/core/profiler/utils/xplane_utils.h" +#include "tensorflow/core/protobuf/config.pb.h" namespace tensorflow { namespace profiler { diff --git a/tensorflow/core/profiler/internal/cpu/python_tracer.cc b/tensorflow/core/profiler/internal/cpu/python_tracer.cc index 103db6e0c71..d684cb8f768 100644 --- a/tensorflow/core/profiler/internal/cpu/python_tracer.cc +++ b/tensorflow/core/profiler/internal/cpu/python_tracer.cc @@ -12,18 +12,17 @@ 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. ==============================================================================*/ -#include <utility> -#include <vector> +#include <memory> -#include "absl/strings/str_split.h" -#include "tensorflow/core/framework/step_stats.pb.h" -#include "tensorflow/core/platform/env_time.h" #include "tensorflow/core/platform/errors.h" +#include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/macros.h" #include "tensorflow/core/platform/status.h" #include "tensorflow/core/profiler/internal/profiler_factory.h" #include "tensorflow/core/profiler/internal/profiler_interface.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" +#include "tensorflow/core/protobuf/config.pb.h" #include "tensorflow/core/util/env_var.h" #include "tensorflow/python/profiler/internal/python_hooks.h" diff --git a/tensorflow/core/profiler/internal/parse_annotation.cc b/tensorflow/core/profiler/internal/parse_annotation.cc index 2a3fa3f8454..32c26befa3d 100644 --- a/tensorflow/core/profiler/internal/parse_annotation.cc +++ b/tensorflow/core/profiler/internal/parse_annotation.cc @@ -15,6 +15,9 @@ limitations under the License. #include "tensorflow/core/profiler/internal/parse_annotation.h" #include <stack> +#include <string> +#include <utility> +#include <vector> #include "absl/strings/ascii.h" #include "absl/strings/str_split.h" diff --git a/tensorflow/core/profiler/internal/parse_annotation.h b/tensorflow/core/profiler/internal/parse_annotation.h index 6c2e536962b..bb0f12217d3 100644 --- a/tensorflow/core/profiler/internal/parse_annotation.h +++ b/tensorflow/core/profiler/internal/parse_annotation.h @@ -16,7 +16,6 @@ limitations under the License. #ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_PARSE_ANNOTATION_H_ #define TENSORFLOW_CORE_PROFILER_INTERNAL_PARSE_ANNOTATION_H_ -#include <utility> #include <vector> #include "absl/strings/string_view.h" diff --git a/tensorflow/core/profiler/internal/parse_annotation_test.cc b/tensorflow/core/profiler/internal/parse_annotation_test.cc index 4d4a2d5ea95..e5d876ac5af 100644 --- a/tensorflow/core/profiler/internal/parse_annotation_test.cc +++ b/tensorflow/core/profiler/internal/parse_annotation_test.cc @@ -14,6 +14,9 @@ limitations under the License. ==============================================================================*/ #include "tensorflow/core/profiler/internal/parse_annotation.h" +#include <vector> + +#include "absl/strings/string_view.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { diff --git a/tensorflow/core/profiler/internal/profiler_factory.cc b/tensorflow/core/profiler/internal/profiler_factory.cc index e2bae59b892..5152e79bdc8 100644 --- a/tensorflow/core/profiler/internal/profiler_factory.cc +++ b/tensorflow/core/profiler/internal/profiler_factory.cc @@ -14,8 +14,14 @@ limitations under the License. ==============================================================================*/ #include "tensorflow/core/profiler/internal/profiler_factory.h" +#include <memory> +#include <utility> +#include <vector> + #include "tensorflow/core/platform/mutex.h" #include "tensorflow/core/platform/thread_annotations.h" +#include "tensorflow/core/profiler/internal/profiler_interface.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" namespace tensorflow { namespace profiler { diff --git a/tensorflow/core/profiler/internal/profiler_factory.h b/tensorflow/core/profiler/internal/profiler_factory.h index 6bcdcf28c3c..c223d7275d9 100644 --- a/tensorflow/core/profiler/internal/profiler_factory.h +++ b/tensorflow/core/profiler/internal/profiler_factory.h @@ -19,6 +19,7 @@ limitations under the License. #include <vector> #include "tensorflow/core/profiler/internal/profiler_interface.h" +#include "tensorflow/core/profiler/profiler_options.pb.h" namespace tensorflow { namespace profiler { diff --git a/tensorflow/core/profiler/internal/profiler_interface.h b/tensorflow/core/profiler/internal/profiler_interface.h index 79dfc7af2b2..9fe85e38652 100644 --- a/tensorflow/core/profiler/internal/profiler_interface.h +++ b/tensorflow/core/profiler/internal/profiler_interface.h @@ -16,7 +16,6 @@ limitations under the License. #define TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_INTERFACE_H_ #include "tensorflow/core/platform/status.h" -#include "tensorflow/core/profiler/profiler_options.pb.h" #include "tensorflow/core/profiler/protobuf/xplane.pb.h" #include "tensorflow/core/protobuf/config.pb.h" diff --git a/tensorflow/core/profiler/internal/scoped_annotation_test.cc b/tensorflow/core/profiler/internal/scoped_annotation_test.cc index 70a627fd640..50c1244b9ee 100644 --- a/tensorflow/core/profiler/internal/scoped_annotation_test.cc +++ b/tensorflow/core/profiler/internal/scoped_annotation_test.cc @@ -15,10 +15,11 @@ limitations under the License. #include "tensorflow/core/profiler/lib/scoped_annotation.h" +#include <string> + #include "absl/strings/str_cat.h" #include "tensorflow/core/platform/test.h" #include "tensorflow/core/platform/test_benchmark.h" -#include "tensorflow/core/platform/types.h" #include "tensorflow/core/profiler/internal/annotation_stack.h" namespace tensorflow { @@ -48,11 +49,13 @@ TEST(ScopedAnnotation, Simple) { EXPECT_EQ(AnnotationStack::Get(), ""); // not enabled } -string GenerateRandomString(int length) { return string(length, 'a'); } +std::string GenerateRandomString(int length) { + return std::string(length, 'a'); +} void BM_ScopedAnnotationDisabled(int iters, int annotation_size) { testing::StopTiming(); - string annotation = GenerateRandomString(annotation_size); + std::string annotation = GenerateRandomString(annotation_size); testing::StartTiming(); for (int i = 0; i < iters; i++) { ScopedAnnotation trace(annotation); @@ -64,7 +67,7 @@ BENCHMARK(BM_ScopedAnnotationDisabled)->Arg(8)->Arg(32)->Arg(128); void BM_ScopedAnnotationEnabled(int iters, int annotation_size) { testing::StopTiming(); - string annotation = GenerateRandomString(annotation_size); + std::string annotation = GenerateRandomString(annotation_size); AnnotationStack::Enable(true); testing::StartTiming(); for (int i = 0; i < iters; i++) { @@ -78,7 +81,7 @@ BENCHMARK(BM_ScopedAnnotationEnabled)->Arg(8)->Arg(32)->Arg(128); void BM_ScopedAnnotationEnabled_Nested(int iters, int annotation_size) { testing::StopTiming(); - string annotation = GenerateRandomString(annotation_size); + std::string annotation = GenerateRandomString(annotation_size); AnnotationStack::Enable(true); testing::StartTiming(); for (int i = 0; i < iters; i++) { diff --git a/tensorflow/core/profiler/internal/traceme_recorder.cc b/tensorflow/core/profiler/internal/traceme_recorder.cc index 365e3992bc3..268585bde8c 100644 --- a/tensorflow/core/profiler/internal/traceme_recorder.cc +++ b/tensorflow/core/profiler/internal/traceme_recorder.cc @@ -16,8 +16,18 @@ limitations under the License. #include <stddef.h> +#include <algorithm> +#include <atomic> +#include <new> +#include <utility> +#include <vector> + +#include "absl/container/flat_hash_map.h" #include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/logging.h" +#include "tensorflow/core/platform/macros.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/types.h" namespace tensorflow { namespace profiler { diff --git a/tensorflow/core/profiler/internal/traceme_recorder.h b/tensorflow/core/profiler/internal/traceme_recorder.h index 8b5b32cf4bc..1da7d4cebb1 100644 --- a/tensorflow/core/profiler/internal/traceme_recorder.h +++ b/tensorflow/core/profiler/internal/traceme_recorder.h @@ -15,8 +15,6 @@ limitations under the License. #ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_TRACEME_RECORDER_H_ #define TENSORFLOW_CORE_PROFILER_INTERNAL_TRACEME_RECORDER_H_ -#include <stddef.h> - #include <atomic> #include <vector> diff --git a/tensorflow/core/profiler/internal/traceme_recorder_test.cc b/tensorflow/core/profiler/internal/traceme_recorder_test.cc index 90478881361..8d7abc94e8f 100644 --- a/tensorflow/core/profiler/internal/traceme_recorder_test.cc +++ b/tensorflow/core/profiler/internal/traceme_recorder_test.cc @@ -15,19 +15,28 @@ limitations under the License. #include "tensorflow/core/profiler/internal/traceme_recorder.h" #include <atomic> +#include <istream> +#include <set> +#include <string> +#include <utility> +#include <vector> #include <gmock/gmock.h> -#include <gtest/gtest.h> #include "absl/strings/str_cat.h" -#include "tensorflow/core/lib/core/threadpool.h" +#include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/env_time.h" +#include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/notification.h" +#include "tensorflow/core/platform/test.h" +#include "tensorflow/core/platform/threadpool.h" #include "tensorflow/core/platform/types.h" namespace tensorflow { namespace profiler { namespace { +using ::testing::ElementsAre; + MATCHER_P(Named, name, "") { return arg.name == name; } constexpr static uint64 kNanosInSec = 1000000000; @@ -45,7 +54,7 @@ TEST(RecorderTest, SingleThreaded) { ASSERT_EQ(results.size(), 1); EXPECT_THAT(results[0].events, - ::testing::ElementsAre(Named("during1"), Named("during2"))); + ElementsAre(Named("during1"), Named("during2"))); } void SpinNanos(int nanos) {