MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ProcessStats

Method ProcessStats

tensorflow/core/distributed_runtime/master_session.cc:916–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

914}
915
916void MasterSession::ReffedClientGraph::ProcessStats(int64 step_id,
917 PerStepState* pss,
918 ProfileHandler* ph,
919 const RunOptions& options,
920 RunMetadata* resp) {
921 if (!pss->collect_costs && !pss->collect_timeline) return;
922
923 // Out-of-band logging data is collected now, during post-processing.
924 if (pss->collect_timeline) {
925 SetRPCLogging(false);
926 RetrieveLogs(step_id, &pss->rpc_stats);
927 }
928 for (size_t i = 0; i < partitions_.size(); ++i) {
929 const StepStats& ss = pss->step_stats[i];
930 if (ph) {
931 for (const auto& ds : ss.dev_stats()) {
932 ProcessDeviceStats(ph, ds, false /*is_rpc*/);
933 }
934 }
935 }
936 if (ph) {
937 for (const auto& ds : pss->rpc_stats.dev_stats()) {
938 ProcessDeviceStats(ph, ds, true /*is_rpc*/);
939 }
940 ph->StepDone(pss->start_micros, pss->end_micros,
941 Microseconds(0) /*cleanup_time*/, 0 /*total_runops*/,
942 Status::OK());
943 }
944 // Assemble all stats for this timeline into a merged StepStats.
945 if (pss->collect_timeline) {
946 StepStats step_stats_proto;
947 step_stats_proto.Swap(&pss->rpc_stats);
948 for (size_t i = 0; i < partitions_.size(); ++i) {
949 step_stats_proto.MergeFrom(pss->step_stats[i]);
950 pss->step_stats[i].Clear();
951 }
952 pss->step_stats.clear();
953 // Copy the stats back, but only for on-demand profiling to avoid slowing
954 // down calls that trigger the automatic profiling.
955 if (options.trace_level() == RunOptions::FULL_TRACE) {
956 resp->mutable_step_stats()->Swap(&step_stats_proto);
957 } else {
958 // If FULL_TRACE, it can be fetched from Session API, no need for
959 // duplicated publishing.
960 stats_publisher_->PublishStatsProto(step_stats_proto);
961 }
962 }
963}
964
965void MasterSession::ReffedClientGraph::ProcessDeviceStats(
966 ProfileHandler* ph, const DeviceStepStats& ds, bool is_rpc) {

Callers 2

DoPartialRunMethod · 0.80
PostRunCleanupMethod · 0.80

Calls 6

mutable_step_statsMethod · 0.80
PublishStatsProtoMethod · 0.80
sizeMethod · 0.45
SwapMethod · 0.45
ClearMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected