Add TraceMe to track which step_id is from tf data.
PiperOrigin-RevId: 280760041 Change-Id: I76e41c26e21088c831d24a14201ac1adfb46b268
This commit is contained in:
parent
ad9485bd46
commit
2f63b65d95
@ -161,6 +161,7 @@ cc_library(
|
|||||||
"//tensorflow/core:lib_internal",
|
"//tensorflow/core:lib_internal",
|
||||||
"//tensorflow/core:protos_all_cc",
|
"//tensorflow/core:protos_all_cc",
|
||||||
"//tensorflow/core/kernels:variable_ops",
|
"//tensorflow/core/kernels:variable_ops",
|
||||||
|
"//tensorflow/core/profiler/lib:traceme",
|
||||||
"@com_google_absl//absl/time",
|
"@com_google_absl//absl/time",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -32,6 +32,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/core/lib/random/random.h"
|
#include "tensorflow/core/lib/random/random.h"
|
||||||
#include "tensorflow/core/lib/strings/strcat.h"
|
#include "tensorflow/core/lib/strings/strcat.h"
|
||||||
#include "tensorflow/core/platform/notification.h"
|
#include "tensorflow/core/platform/notification.h"
|
||||||
|
#include "tensorflow/core/profiler/lib/traceme.h"
|
||||||
|
|
||||||
namespace tensorflow {
|
namespace tensorflow {
|
||||||
namespace data {
|
namespace data {
|
||||||
@ -662,6 +663,12 @@ Status InstantiatedCapturedFunction::Run(IteratorContext* ctx,
|
|||||||
ret_types_);
|
ret_types_);
|
||||||
Notification n;
|
Notification n;
|
||||||
Status s;
|
Status s;
|
||||||
|
profiler::TraceMe activity(
|
||||||
|
[&] {
|
||||||
|
return absl::StrCat(
|
||||||
|
"InstantiatedCapturedFunction::Run#id=", f_opts.step_id, "#");
|
||||||
|
},
|
||||||
|
profiler::TraceMeLevel::kInfo);
|
||||||
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
||||||
s.Update(func_status);
|
s.Update(func_status);
|
||||||
n.Notify();
|
n.Notify();
|
||||||
@ -700,6 +707,13 @@ Status InstantiatedCapturedFunction::RunWithBorrowedArgs(
|
|||||||
Notification n;
|
Notification n;
|
||||||
Status s;
|
Status s;
|
||||||
|
|
||||||
|
profiler::TraceMe activity(
|
||||||
|
[&] {
|
||||||
|
return absl::StrCat(
|
||||||
|
"InstantiatedCapturedFunction::RunWithBorrowedArgs#id=",
|
||||||
|
f_opts.step_id, "#");
|
||||||
|
},
|
||||||
|
profiler::TraceMeLevel::kInfo);
|
||||||
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
||||||
s.Update(func_status);
|
s.Update(func_status);
|
||||||
n.Notify();
|
n.Notify();
|
||||||
@ -737,6 +751,12 @@ Status InstantiatedCapturedFunction::RunInstantiated(
|
|||||||
Notification n;
|
Notification n;
|
||||||
Status s;
|
Status s;
|
||||||
|
|
||||||
|
profiler::TraceMe activity(
|
||||||
|
[&] {
|
||||||
|
return absl::StrCat("InstantiatedCapturedFunction::RunInstantiated#id=",
|
||||||
|
f_opts.step_id, "#");
|
||||||
|
},
|
||||||
|
profiler::TraceMeLevel::kInfo);
|
||||||
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
lib_->Run(f_opts, f_handle_, &frame, [&n, &s](Status func_status) {
|
||||||
s.Update(func_status);
|
s.Update(func_status);
|
||||||
n.Notify();
|
n.Notify();
|
||||||
@ -839,6 +859,12 @@ void InstantiatedCapturedFunction::RunAsync(
|
|||||||
std::move(done), ctx, std::move(deregister_fn), prefix,
|
std::move(done), ctx, std::move(deregister_fn), prefix,
|
||||||
std::move(stats_collector), std::placeholders::_1);
|
std::move(stats_collector), std::placeholders::_1);
|
||||||
|
|
||||||
|
profiler::TraceMe activity(
|
||||||
|
[&] {
|
||||||
|
return absl::StrCat(
|
||||||
|
"InstantiatedCapturedFunction::RunAsync#id=", f_opts.step_id, "#");
|
||||||
|
},
|
||||||
|
profiler::TraceMeLevel::kInfo);
|
||||||
lib_->Run(f_opts, f_handle_, frame, std::move(callback));
|
lib_->Run(f_opts, f_handle_, frame, std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user