diff --git a/tensorflow/core/common_runtime/eager/kernel_and_device.cc b/tensorflow/core/common_runtime/eager/kernel_and_device.cc index eb7b1b7eb23..3492ddf7781 100644 --- a/tensorflow/core/common_runtime/eager/kernel_and_device.cc +++ b/tensorflow/core/common_runtime/eager/kernel_and_device.cc @@ -319,14 +319,14 @@ Status KernelAndDeviceOp::Run(ScopedStepContainer* step_container, // 'ScopedActivity' will trace the OpKernel scheduling time on host. profiler::TraceMe activity( [&] { - return strings::StrCat( - op_name, ":", kernel_->type_string(), - "#id=", step_container ? step_container->step_id() : 0, - ",device=", device_->name(), ",async=false#"); + return absl::StrCat(op_name, ":", kernel_->type_string(), "#id=", + step_container ? step_container->step_id() : 0, + ",device=", device_->name(), ",async=false#"); }, profiler::TraceMeLevel::kInfo); // 'ScopedAnnotation' will trace the OpKernel execution time on device. - tracing::ScopedAnnotation annotation(op_name, kernel_->type_string()); + tracing::ScopedAnnotation annotation( + [&]() { return absl::StrCat(op_name, ":", kernel_->type_string()); }); device_->Compute(kernel_.get(), &context); } else { profiler::TraceMe activity( diff --git a/tensorflow/core/platform/annotation.h b/tensorflow/core/platform/annotation.h index 660767eec25..3648a7e9ee2 100644 --- a/tensorflow/core/platform/annotation.h +++ b/tensorflow/core/platform/annotation.h @@ -114,12 +114,6 @@ class ScopedAnnotation { } } - // Deprecated: use the lambda version if you want to concatenate strings as - // annotation on the fly. - ScopedAnnotation(absl::string_view name_part1, absl::string_view name_part2) - : ScopedAnnotation( - [&]() { return StrCat(name_part1, ":", name_part2); }) {} - // Pops the name passed in the constructor from the current annotation. ~ScopedAnnotation() { // TODO(b/137971921): without this memory fence, two presubmit tests will diff --git a/tensorflow/core/profiler/internal/scoped_annotation_test.cc b/tensorflow/core/profiler/internal/scoped_annotation_test.cc index 53164f72fdb..56a5e974107 100644 --- a/tensorflow/core/profiler/internal/scoped_annotation_test.cc +++ b/tensorflow/core/profiler/internal/scoped_annotation_test.cc @@ -75,20 +75,6 @@ void BM_ScopedAnnotationEnabled(int iters, int annotation_size) { BENCHMARK(BM_ScopedAnnotationEnabled)->Arg(8)->Arg(32)->Arg(128); -void BM_ScopedAnnotationEnabled_TwoParts(int iters, int annotation_size) { - testing::StopTiming(); - std::string annotation = GenerateRandomString(annotation_size); - tracing::ScopedAnnotation::Enable(true); - testing::StartTiming(); - for (int i = 0; i < iters; i++) { - tracing::ScopedAnnotation trace(annotation, annotation); - } - testing::StopTiming(); - tracing::ScopedAnnotation::Enable(false); -} - -BENCHMARK(BM_ScopedAnnotationEnabled_TwoParts)->Arg(8)->Arg(32)->Arg(128); - void BM_ScopedAnnotationEnabled_Nested(int iters, int annotation_size) { testing::StopTiming(); std::string annotation = GenerateRandomString(annotation_size); @@ -138,20 +124,5 @@ void BM_ScopedAnnotationEnabled_Adhoc_Lambda(int iters, int annotation_size) { BENCHMARK(BM_ScopedAnnotationEnabled_Adhoc_Lambda)->Arg(8)->Arg(32)->Arg(128); -void BM_ScopedAnnotationEnabled_TwoPartsLambda(int iters, int annotation_size) { - testing::StopTiming(); - std::string annotation = GenerateRandomString(annotation_size); - tracing::ScopedAnnotation::Enable(true); - testing::StartTiming(); - for (int i = 0; i < iters; i++) { - tracing::ScopedAnnotation trace( - [&]() { return absl::StrCat(annotation, ":", annotation); }); - } - testing::StopTiming(); - tracing::ScopedAnnotation::Enable(false); -} - -BENCHMARK(BM_ScopedAnnotationEnabled_TwoPartsLambda)->Arg(8)->Arg(32)->Arg(128); - } // namespace } // namespace tensorflow