Skip to content

Commit 639480e

Browse files
bmass02copybara-github
authored andcommitted
Add PID metadata to XPlanes and TraceMeConsumers to enable producer/consumer differentiation across processes profiled together.
PiperOrigin-RevId: 824554472
1 parent eb3b790 commit 639480e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

tsl/profiler/lib/BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ cc_library(
217217
"@com_google_absl//absl/memory",
218218
"@com_google_absl//absl/status",
219219
"@com_google_absl//absl/synchronization",
220+
"@xla//xla/tsl/platform:env",
220221
"@xla//xla/tsl/platform:errors",
221222
"@xla//xla/tsl/platform:logging",
222223
"@xla//xla/tsl/platform:types",
@@ -357,8 +358,6 @@ cc_library(
357358
":context_types_hdrs",
358359
":traceme",
359360
":traceme_encode",
360-
"@com_google_absl//absl/strings",
361-
"@com_google_absl//absl/types:optional",
362361
"@xla//xla/tsl/platform:types",
363362
],
364363
)

tsl/profiler/lib/connected_traceme.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@ limitations under the License.
1616
#define TENSORFLOW_TSL_PROFILER_LIB_CONNECTED_TRACEME_H_
1717

1818
#include <optional>
19-
#include <string>
2019
#include <utility>
2120

22-
#include "absl/strings/string_view.h"
23-
#include "absl/types/optional.h"
2421
#include "xla/tsl/platform/types.h"
2522
#include "tsl/profiler/lib/context_types.h"
2623
#include "tsl/profiler/lib/traceme.h"

tsl/profiler/lib/profiler_session.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ limitations under the License.
3030
#include "tsl/profiler/protobuf/xplane.pb.h"
3131

3232
#if !defined(IS_MOBILE_PLATFORM)
33+
#include "xla/tsl/platform/env.h"
3334
#include "xla/tsl/profiler/convert/post_process_single_host_xplane.h"
3435
#include "xla/tsl/profiler/utils/time_utils.h"
3536
#include "tsl/platform/host_info.h"
@@ -95,6 +96,7 @@ absl::Status ProfilerSession::CollectData(XSpace* space) {
9596
#if !defined(IS_MOBILE_PLATFORM)
9697
space->add_hostnames(port::Hostname());
9798
TF_RETURN_IF_ERROR(CollectDataInternal(space));
99+
profiler::SetXSpacePidIfNotSet(*space, tsl::Env::Default()->GetProcessId());
98100
profiler::PostProcessSingleHostXSpace(space, start_time_ns_, stop_time_ns_);
99101
#endif
100102
SetProfileOptionsIntoSpace(options_, space);

0 commit comments

Comments
 (0)