Move TF 2.x profiler files out of top-level profiler/internal

profiler_interface,profiler_factory -> lib/
parse_annotation -> utils/
traceme_recorder,annotation_stack -> internal/cpu/

PiperOrigin-RevId: 335496875
Change-Id: I8f1483437ee4f3bbe37b3d3450a3e690cb6dfa90
This commit is contained in:
Jose Baiocchi 2020-10-05 14:15:15 -07:00 committed by TensorFlower Gardener
parent a6da0e7fd9
commit 122655424e
37 changed files with 226 additions and 245 deletions

View File

@ -89,9 +89,9 @@ cc_library(
name = "profiler_impl",
visibility = ["//tensorflow:__pkg__"],
deps = [
"//tensorflow/core/profiler/internal:annotation_stack_impl",
"//tensorflow/core/profiler/internal:profiler_factory_impl",
"//tensorflow/core/profiler/internal:traceme_recorder_impl",
"//tensorflow/core/profiler/internal/cpu:annotation_stack_impl",
"//tensorflow/core/profiler/internal/cpu:traceme_recorder_impl",
"//tensorflow/core/profiler/lib:profiler_factory_impl",
"//tensorflow/core/profiler/lib:profiler_session_impl",
],
alwayslink = True,
@ -135,7 +135,6 @@ cc_library(
filegroup(
name = "mobile_srcs",
srcs = [
"//tensorflow/core/profiler/internal:mobile_srcs",
"//tensorflow/core/profiler/lib:mobile_srcs",
],
visibility = ["//tensorflow/core:__pkg__"],

View File

@ -571,7 +571,6 @@ cc_library(
visibility = ["//tensorflow/core/profiler:internal"],
deps = [
"//tensorflow/core:lib",
"//tensorflow/core/profiler/internal:profiler_factory",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:derived_timeline",
"//tensorflow/core/profiler/utils:group_events",

View File

@ -14,13 +14,10 @@ limitations under the License.
==============================================================================*/
#include "tensorflow/core/profiler/convert/post_process_single_host_xplane.h"
#if !defined(IS_MOBILE_PLATFORM)
#include "tensorflow/core/profiler/internal/profiler_factory.h"
#include "tensorflow/core/profiler/utils/derived_timeline.h"
#include "tensorflow/core/profiler/utils/group_events.h"
#include "tensorflow/core/profiler/utils/xplane_schema.h"
#include "tensorflow/core/profiler/utils/xplane_utils.h"
#endif
namespace tensorflow {
namespace profiler {

View File

@ -1,7 +1,5 @@
load("//tensorflow:tensorflow.bzl", "filegroup")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
load("//tensorflow:tensorflow.bzl", "if_not_windows", "tf_cc_test")
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
package(
default_visibility = ["//tensorflow:internal"],
@ -363,162 +361,3 @@ cc_library(
"//tensorflow/core:regexp_internal",
],
)
cc_library(
name = "traceme_recorder",
hdrs = ["traceme_recorder.h"],
visibility = [
"//perftools/accelerators/xprof/xprofilez:__subpackages__",
"//tensorflow/core/profiler:__subpackages__",
"//third_party/tf_runtime_google:__subpackages__",
],
deps = [
"@com_google_absl//absl/container:flat_hash_map",
"//tensorflow/core:lib",
] + if_static([
":traceme_recorder_impl",
]),
)
cc_library(
name = "traceme_recorder_impl",
srcs = [
"traceme_recorder.cc",
"traceme_recorder.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
"//tensorflow/python:__pkg__",
],
deps = [
"//tensorflow/core:lib",
"@com_google_absl//absl/container:flat_hash_map",
],
alwayslink = True,
)
tf_cc_test(
name = "traceme_recorder_test",
srcs = ["traceme_recorder_test.cc"],
deps = [
":traceme_recorder",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"@com_google_absl//absl/strings",
],
)
cc_library(
name = "profiler_interface",
hdrs = ["profiler_interface.h"],
deps = [
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
],
)
cc_library(
name = "profiler_factory",
hdrs = ["profiler_factory.h"],
deps = [
":profiler_interface",
"//tensorflow/core/profiler:profiler_options_proto_cc",
] + if_static([
":profiler_factory_impl",
]),
)
cc_library(
name = "profiler_factory_impl",
srcs = [
"profiler_factory.cc",
"profiler_factory.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
],
deps = [
":profiler_interface",
"//tensorflow/core:lib",
"//tensorflow/core/profiler:profiler_options_proto_cc",
],
alwayslink = True,
)
filegroup(
name = "mobile_srcs",
srcs = [
"profiler_interface.h",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "annotation_stack",
hdrs = ["annotation_stack.h"],
visibility = [
"//perftools/accelerators/xprof/xprofilez:__subpackages__",
"//tensorflow/core/profiler:__subpackages__",
],
deps = [
"@com_google_absl//absl/strings",
"//tensorflow/core:lib",
] + if_static([
":annotation_stack_impl",
]),
)
cc_library(
name = "annotation_stack_impl",
srcs = [
"annotation_stack.cc",
"annotation_stack.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
"//tensorflow/python:__pkg__",
],
deps = [
"//tensorflow/core:lib",
"@com_google_absl//absl/strings",
],
alwayslink = True,
)
tf_cc_test(
name = "scoped_annotation_test",
size = "small",
srcs = ["scoped_annotation_test.cc"],
deps = [
":annotation_stack",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:lib_internal",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"//tensorflow/core/profiler/lib:scoped_annotation",
"@com_google_absl//absl/strings",
],
)
cc_library(
name = "parse_annotation",
srcs = ["parse_annotation.cc"],
hdrs = ["parse_annotation.h"],
visibility = ["//visibility:public"],
deps = [
"@com_google_absl//absl/strings",
],
)
tf_cc_test(
name = "parse_annotation_test",
srcs = ["parse_annotation_test.cc"],
deps = [
":parse_annotation",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"@com_google_absl//absl/strings",
],
)

View File

@ -1,3 +1,4 @@
load("//tensorflow/core/platform:build_config_root.bzl", "if_static")
load("//tensorflow/core/platform:rules_cc.bzl", "cc_library")
load("//tensorflow:tensorflow.bzl", "tf_cc_test")
@ -12,10 +13,10 @@ cc_library(
hdrs = ["host_tracer_utils.h"],
visibility = ["//tensorflow/core/profiler:friends"],
deps = [
":traceme_recorder",
"//tensorflow/core:lib",
"//tensorflow/core/profiler/internal:parse_annotation",
"//tensorflow/core/profiler/internal:traceme_recorder",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:parse_annotation",
"//tensorflow/core/profiler/utils:tf_op_utils",
"//tensorflow/core/profiler/utils:xplane_builder",
"//tensorflow/core/profiler/utils:xplane_utils",
@ -29,12 +30,12 @@ cc_library(
srcs = ["host_tracer.cc"],
deps = [
":host_tracer_utils",
":traceme_recorder",
"//tensorflow/core:lib",
"//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",
"//tensorflow/core/profiler/lib:profiler_factory",
"//tensorflow/core/profiler/lib:profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:xplane_schema",
"//tensorflow/core/profiler/utils:xplane_utils",
@ -54,7 +55,7 @@ tf_cc_test(
"//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_interface",
"//tensorflow/core/profiler/lib:profiler_session",
"//tensorflow/core/profiler/lib:traceme",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
@ -65,6 +66,76 @@ tf_cc_test(
],
)
cc_library(
name = "traceme_recorder",
hdrs = ["traceme_recorder.h"],
visibility = ["//tensorflow/core/profiler:internal"],
deps = [
"@com_google_absl//absl/container:flat_hash_map",
"//tensorflow/core:lib",
] + if_static([
":traceme_recorder_impl",
]),
)
cc_library(
name = "traceme_recorder_impl",
srcs = [
"traceme_recorder.cc",
"traceme_recorder.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
"//tensorflow/python:__pkg__",
],
deps = [
"//tensorflow/core:lib",
"@com_google_absl//absl/container:flat_hash_map",
],
alwayslink = True,
)
tf_cc_test(
name = "traceme_recorder_test",
srcs = ["traceme_recorder_test.cc"],
deps = [
":traceme_recorder",
"//tensorflow/core:lib",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"@com_google_absl//absl/strings",
],
)
cc_library(
name = "annotation_stack",
hdrs = ["annotation_stack.h"],
visibility = ["//tensorflow/core/profiler:internal"],
deps = [
"@com_google_absl//absl/strings",
"//tensorflow/core:lib",
] + if_static([
":annotation_stack_impl",
]),
)
cc_library(
name = "annotation_stack_impl",
srcs = [
"annotation_stack.cc",
"annotation_stack.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
"//tensorflow/python:__pkg__",
],
deps = [
"//tensorflow/core:lib",
"@com_google_absl//absl/strings",
],
alwayslink = True,
)
cc_library(
name = "python_tracer",
srcs = ["python_tracer.cc"],
@ -74,8 +145,8 @@ cc_library(
"//tensorflow/core:lib",
"//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/lib:profiler_factory",
"//tensorflow/core/profiler/lib:profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/python/profiler/internal:python_hooks",
],
@ -91,8 +162,8 @@ cc_library(
"//tensorflow/core:lib",
"//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/lib:profiler_factory",
"//tensorflow/core/profiler/lib:profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:xplane_builder",
"//tensorflow/core/profiler/utils:xplane_schema",

View File

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/profiler/internal/annotation_stack.h"
#include "tensorflow/core/profiler/internal/cpu/annotation_stack.h"
#include <atomic>

View File

@ -12,8 +12,8 @@ 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.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_ANNOTATION_STACK_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_ANNOTATION_STACK_H_
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_ANNOTATION_STACK_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_ANNOTATION_STACK_H_
#include <stddef.h>
@ -93,4 +93,4 @@ class AnnotationStack {
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_ANNOTATION_STACK_H_
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_ANNOTATION_STACK_H_

View File

@ -25,9 +25,9 @@ limitations under the License.
#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/internal/cpu/traceme_recorder.h"
#include "tensorflow/core/profiler/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/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_schema.h"

View File

@ -24,7 +24,7 @@ limitations under the License.
#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_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"

View File

@ -21,9 +21,9 @@ limitations under the License.
#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/internal/cpu/traceme_recorder.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"
#include "tensorflow/core/profiler/utils/parse_annotation.h"
#include "tensorflow/core/profiler/utils/tf_op_utils.h"
#include "tensorflow/core/profiler/utils/xplane_builder.h"
#include "tensorflow/core/profiler/utils/xplane_utils.h"

View File

@ -16,7 +16,7 @@ limitations under the License.
#define TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_HOST_TRACER_UTILS_H_
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/internal/traceme_recorder.h"
#include "tensorflow/core/profiler/internal/cpu/traceme_recorder.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"
namespace tensorflow {

View File

@ -22,8 +22,8 @@ limitations under the License.
#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/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/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"

View File

@ -18,8 +18,8 @@ limitations under the License.
#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/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/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"

View File

@ -12,7 +12,7 @@ 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 "tensorflow/core/profiler/internal/traceme_recorder.h"
#include "tensorflow/core/profiler/internal/cpu/traceme_recorder.h"
#include <stddef.h>

View File

@ -12,8 +12,8 @@ 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.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_TRACEME_RECORDER_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_TRACEME_RECORDER_H_
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_TRACEME_RECORDER_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_TRACEME_RECORDER_H_
#include <atomic>
#include <string>
@ -120,4 +120,5 @@ class TraceMeRecorder {
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_TRACEME_RECORDER_H_
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_CPU_TRACEME_RECORDER_H_

View File

@ -12,7 +12,7 @@ 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 "tensorflow/core/profiler/internal/traceme_recorder.h"
#include "tensorflow/core/profiler/internal/cpu/traceme_recorder.h"
#include <atomic>
#include <istream>

View File

@ -38,11 +38,11 @@ tf_cuda_library(
"//tensorflow/core:lib",
"//tensorflow/core:lib_internal",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/profiler/internal:annotation_stack",
"//tensorflow/core/profiler/internal:parse_annotation",
"//tensorflow/core/profiler/internal:profiler_factory",
"//tensorflow/core/profiler/internal:profiler_interface",
"//tensorflow/core/profiler/internal/cpu:annotation_stack",
"//tensorflow/core/profiler/lib:profiler_factory",
"//tensorflow/core/profiler/lib:profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:parse_annotation",
"//tensorflow/core/profiler/utils:xplane_builder",
"//tensorflow/core/profiler/utils:xplane_schema",
"//tensorflow/core/profiler/utils:xplane_utils",
@ -84,7 +84,7 @@ tf_cc_test_gpu(
"//tensorflow/core:test_main",
"//tensorflow/core:testlib",
"//tensorflow/core/kernels:ops_util",
"//tensorflow/core/profiler/internal:profiler_interface",
"//tensorflow/core/profiler/lib:profiler_interface",
"//tensorflow/core/profiler/lib:profiler_session",
"//tensorflow/core/profiler/utils:tf_xplane_visitor",
"//tensorflow/core/profiler/utils:xplane_schema",
@ -131,7 +131,7 @@ tf_cuda_library(
":cupti_interface",
":cupti_utils",
"//tensorflow/core:lib",
"//tensorflow/core/profiler/internal:annotation_stack",
"//tensorflow/core/profiler/internal/cpu:annotation_stack",
"@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:node_hash_map",

View File

@ -25,7 +25,7 @@ limitations under the License.
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/mem.h"
#include "tensorflow/core/profiler/internal/annotation_stack.h"
#include "tensorflow/core/profiler/internal/cpu/annotation_stack.h"
namespace tensorflow {
namespace profiler {

View File

@ -35,13 +35,13 @@ limitations under the License.
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/thread_annotations.h"
#include "tensorflow/core/profiler/internal/annotation_stack.h"
#include "tensorflow/core/profiler/internal/cpu/annotation_stack.h"
#include "tensorflow/core/profiler/internal/gpu/cupti_tracer.h"
#include "tensorflow/core/profiler/internal/gpu/cupti_wrapper.h"
#include "tensorflow/core/profiler/internal/parse_annotation.h"
#include "tensorflow/core/profiler/internal/profiler_factory.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"
#include "tensorflow/core/profiler/utils/parse_annotation.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"

View File

@ -34,7 +34,7 @@ limitations under the License.
#include "tensorflow/core/lib/core/threadpool.h"
#include "tensorflow/core/platform/strcat.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_session.h"
#include "tensorflow/core/profiler/utils/tf_xplane_visitor.h"
#include "tensorflow/core/profiler/utils/xplane_schema.h"

View File

@ -30,7 +30,7 @@ cc_library(
hdrs = ["profiler_session.h"],
visibility = ["//tensorflow:internal"],
deps = [
"//tensorflow/core/profiler/internal:profiler_interface",
":profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler:profiler_options_proto_cc",
"//tensorflow/core:lib",
@ -53,7 +53,7 @@ cc_library(
deps = [
"//tensorflow/core:lib",
"//tensorflow/core/platform",
"//tensorflow/core/profiler/internal:profiler_interface",
":profiler_interface",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler:profiler_options_proto_cc",
"@com_google_absl//absl/memory",
@ -61,7 +61,7 @@ cc_library(
] + if_not_android([
":profiler_lock",
"//tensorflow/core/profiler/convert:post_process_single_host_xplane",
"//tensorflow/core/profiler/internal:profiler_factory",
"//tensorflow/core/profiler/lib:profiler_factory",
"//tensorflow/core/profiler/utils:derived_timeline",
"//tensorflow/core/profiler/utils:group_events",
"//tensorflow/core/profiler/utils:xplane_utils",
@ -90,7 +90,7 @@ cc_library(
"//tensorflow/core/platform",
"//tensorflow/core/profiler:profiler_options_proto_cc",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/internal:profiler_interface",
":profiler_interface",
] + if_static([
":local_profiler_impl",
]),
@ -102,14 +102,14 @@ cc_library(
hdrs = ["local_profiler.h"],
visibility = ["//tensorflow/core/profiler:internal"],
deps = [
":profiler_interface",
":profiler_lock",
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/platform",
"//tensorflow/core/profiler:profiler_options_proto_cc",
"//tensorflow/core/profiler/convert:post_process_single_host_xplane",
"//tensorflow/core/profiler/internal:profiler_factory",
"//tensorflow/core/profiler/internal:profiler_interface",
"//tensorflow/core/profiler/lib:profiler_factory",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
"//tensorflow/core/profiler/utils:derived_timeline",
"//tensorflow/core/profiler/utils:group_events",
@ -121,6 +121,44 @@ cc_library(
alwayslink = True,
)
cc_library(
name = "profiler_factory",
hdrs = ["profiler_factory.h"],
deps = [
":profiler_interface",
"//tensorflow/core/profiler:profiler_options_proto_cc",
] + if_static([
":profiler_factory_impl",
]),
)
cc_library(
name = "profiler_factory_impl",
srcs = [
"profiler_factory.cc",
"profiler_factory.h",
],
visibility = [
"//tensorflow/core/profiler:__pkg__",
],
deps = [
":profiler_interface",
"//tensorflow/core:lib",
"//tensorflow/core/profiler:profiler_options_proto_cc",
],
alwayslink = True,
)
cc_library(
name = "profiler_interface",
hdrs = ["profiler_interface.h"],
deps = [
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core/profiler/protobuf:xplane_proto_cc",
],
)
tf_cuda_library(
name = "profiler_backends",
cuda_deps = [
@ -156,7 +194,7 @@ cc_library(
"//tensorflow/core:lib",
"//tensorflow/core/platform",
] + if_not_android([
"//tensorflow/core/profiler/internal:traceme_recorder",
"//tensorflow/core/profiler/internal/cpu:traceme_recorder",
]),
)
@ -217,10 +255,25 @@ cc_library(
"//tensorflow/core:lib",
"//tensorflow/core/platform",
] + if_not_android([
"//tensorflow/core/profiler/internal:annotation_stack",
"//tensorflow/core/profiler/internal/cpu:annotation_stack",
]),
)
tf_cc_test(
name = "scoped_annotation_test",
size = "small",
srcs = ["scoped_annotation_test.cc"],
deps = [
":scoped_annotation",
"//tensorflow/core:core_cpu_internal",
"//tensorflow/core:lib_internal",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"//tensorflow/core/profiler/internal/cpu:annotation_stack",
"@com_google_absl//absl/strings",
],
)
cc_library(
name = "profiler_lock",
srcs = ["profiler_lock.cc"],
@ -233,6 +286,7 @@ filegroup(
srcs = [
"annotated_traceme.h",
"connected_traceme.h",
"profiler_interface.h",
"profiler_session.cc",
"profiler_session.h",
"scoped_annotation.h",

View File

@ -27,8 +27,8 @@ limitations under the License.
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/convert/post_process_single_host_xplane.h"
#include "tensorflow/core/profiler/internal/profiler_factory.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_lock.h"
#include "tensorflow/core/profiler/profiler_options.pb.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"

View File

@ -23,7 +23,7 @@ limitations under the License.
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/thread_annotations.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/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"

View File

@ -12,7 +12,7 @@ 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 "tensorflow/core/profiler/internal/profiler_factory.h"
#include "tensorflow/core/profiler/lib/profiler_factory.h"
#include <memory>
#include <utility>
@ -20,7 +20,7 @@ limitations under the License.
#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/lib/profiler_interface.h"
#include "tensorflow/core/profiler/profiler_options.pb.h"
namespace tensorflow {

View File

@ -12,13 +12,13 @@ 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.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_FACTORY_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_FACTORY_H_
#ifndef TENSORFLOW_CORE_PROFILER_LIB_PROFILER_FACTORY_H_
#define TENSORFLOW_CORE_PROFILER_LIB_PROFILER_FACTORY_H_
#include <memory>
#include <vector>
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/profiler_options.pb.h"
namespace tensorflow {
@ -35,4 +35,4 @@ void CreateProfilers(const ProfileOptions& options,
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_FACTORY_H_
#endif // TENSORFLOW_CORE_PROFILER_LIB_PROFILER_FACTORY_H_

View File

@ -12,8 +12,8 @@ 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.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_INTERFACE_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_INTERFACE_H_
#ifndef TENSORFLOW_CORE_PROFILER_LIB_PROFILER_INTERFACE_H_
#define TENSORFLOW_CORE_PROFILER_LIB_PROFILER_INTERFACE_H_
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/profiler/protobuf/xplane.pb.h"
@ -54,4 +54,4 @@ class ProfilerInterface {
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_PROFILER_INTERFACE_H_
#endif // TENSORFLOW_CORE_PROFILER_LIB_PROFILER_INTERFACE_H_

View File

@ -24,7 +24,7 @@ limitations under the License.
#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/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"
@ -32,7 +32,7 @@ limitations under the License.
#if !defined(IS_MOBILE_PLATFORM)
#include "tensorflow/core/profiler/convert/post_process_single_host_xplane.h"
#include "tensorflow/core/profiler/internal/profiler_factory.h"
#include "tensorflow/core/profiler/lib/profiler_factory.h"
#include "tensorflow/core/profiler/lib/profiler_lock.h"
#include "tensorflow/core/profiler/utils/derived_timeline.h"
#include "tensorflow/core/profiler/utils/group_events.h"

View File

@ -22,7 +22,7 @@ limitations under the License.
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/platform/thread_annotations.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/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"

View File

@ -25,7 +25,7 @@ limitations under the License.
#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/types.h"
#if !defined(IS_MOBILE_PLATFORM)
#include "tensorflow/core/profiler/internal/annotation_stack.h"
#include "tensorflow/core/profiler/internal/cpu/annotation_stack.h"
#endif
namespace tensorflow {

View File

@ -20,7 +20,7 @@ limitations under the License.
#include "absl/strings/str_cat.h"
#include "tensorflow/core/platform/test.h"
#include "tensorflow/core/platform/test_benchmark.h"
#include "tensorflow/core/profiler/internal/annotation_stack.h"
#include "tensorflow/core/profiler/internal/cpu/annotation_stack.h"
namespace tensorflow {
namespace profiler {

View File

@ -26,7 +26,7 @@ limitations under the License.
#include "tensorflow/core/platform/platform.h"
#include "tensorflow/core/platform/types.h"
#if !defined(IS_MOBILE_PLATFORM)
#include "tensorflow/core/profiler/internal/traceme_recorder.h"
#include "tensorflow/core/profiler/internal/cpu/traceme_recorder.h"
#endif
#include "tensorflow/core/profiler/lib/traceme_encode.h" // IWYU pragma: export

View File

@ -27,7 +27,7 @@ limitations under the License.
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/status.h"
#include "tensorflow/core/profiler/internal/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_interface.h"
#include "tensorflow/core/profiler/lib/profiler_session.h"
#include "tensorflow/core/profiler/profiler_service.grpc.pb.h"
#include "tensorflow/core/profiler/profiler_service.pb.h"

View File

@ -472,3 +472,24 @@ cc_library(
"@com_google_absl//absl/strings",
],
)
cc_library(
name = "parse_annotation",
srcs = ["parse_annotation.cc"],
hdrs = ["parse_annotation.h"],
visibility = ["//tensorflow/core/profiler:friends"],
deps = [
"@com_google_absl//absl/strings",
],
)
tf_cc_test(
name = "parse_annotation_test",
srcs = ["parse_annotation_test.cc"],
deps = [
":parse_annotation",
"//tensorflow/core:test",
"//tensorflow/core:test_main",
"@com_google_absl//absl/strings",
],
)

View File

@ -12,7 +12,7 @@ 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 "tensorflow/core/profiler/internal/parse_annotation.h"
#include "tensorflow/core/profiler/utils/parse_annotation.h"
#include <stack>
#include <string>

View File

@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_PROFILER_INTERNAL_PARSE_ANNOTATION_H_
#define TENSORFLOW_CORE_PROFILER_INTERNAL_PARSE_ANNOTATION_H_
#ifndef TENSORFLOW_CORE_PROFILER_UTILS_PARSE_ANNOTATION_H_
#define TENSORFLOW_CORE_PROFILER_UTILS_PARSE_ANNOTATION_H_
#include <vector>
@ -43,4 +43,4 @@ std::vector<Annotation> ParseAnnotationStack(
} // namespace profiler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_PROFILER_INTERNAL_PARSE_ANNOTATION_H_
#endif // TENSORFLOW_CORE_PROFILER_UTILS_PARSE_ANNOTATION_H_

View File

@ -12,7 +12,7 @@ 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 "tensorflow/core/profiler/internal/parse_annotation.h"
#include "tensorflow/core/profiler/utils/parse_annotation.h"
#include <vector>

View File

@ -6114,9 +6114,9 @@ filegroup(
"//tensorflow/core/grappler/optimizers:meta_optimizer", # tf_optimizer
"//tensorflow/core/grappler/utils:topological_sort", # tf_item
"//tensorflow/core/platform:tensor_float_32_utils", # tensor_float_32
"//tensorflow/core/profiler/internal:annotation_stack_impl", # profiler
"//tensorflow/core/profiler/internal:print_model_analysis", # tfprof
"//tensorflow/core/profiler/internal:traceme_recorder_impl", # profiler
"//tensorflow/core/profiler/internal/cpu:annotation_stack_impl", # profiler
"//tensorflow/core/profiler/internal/cpu:traceme_recorder_impl", # profiler
"//tensorflow/core/profiler/lib:profiler_session_impl", # profiler
"//tensorflow/core/profiler/rpc:profiler_server_impl", # profiler
"//tensorflow/core/profiler/rpc/client:profiler_client_impl", # profiler