@@ -89,24 +89,24 @@ nixlXferReqH::updateRequestStats(std::unique_ptr<nixlTelemetry> &telemetry_pub,
8989 static const std::array<std::string, 3 > nixl_post_status_str = {
9090 " Posted" , " Posted and Completed" , " Completed" };
9191 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
92- std::chrono::steady_clock::now () - telemetry.startTime );
92+ std::chrono::steady_clock::now () - telemetry.startTime_ );
9393
9494 if (stat_status == NIXL_TELEMETRY_POST) {
9595 telemetry.postDuration_ = duration;
9696 } else if (stat_status == NIXL_TELEMETRY_POST_AND_FINISH) {
9797 telemetry.postDuration_ = duration;
9898 telemetry.xferDuration_ = duration;
9999 telemetry_pub->addPostTime (duration);
100- telemetry_pub->addXferTime (duration, backendOp == NIXL_WRITE, telemetry.totalBytes );
100+ telemetry_pub->addXferTime (duration, backendOp == NIXL_WRITE, telemetry.totalBytes_ );
101101 } else { // stat_status == NIXL_TELEMETRY_FINISH
102102 telemetry.xferDuration_ = duration;
103103 telemetry_pub->addPostTime (telemetry.postDuration_ );
104- telemetry_pub->addXferTime (duration, backendOp == NIXL_WRITE, telemetry.totalBytes );
104+ telemetry_pub->addXferTime (duration, backendOp == NIXL_WRITE, telemetry.totalBytes_ );
105105 }
106106
107107 NIXL_TRACE << " [NIXL TELEMETRY]: From backend " << engine->getType ()
108108 << nixl_post_status_str[stat_status] << " Xfer with " << initiatorDescs->descCount ()
109- << " descriptors of total size " << telemetry.totalBytes << " B in "
109+ << " descriptors of total size " << telemetry.totalBytes_ << " B in "
110110 << duration.count () << " us." ;
111111}
112112
@@ -751,7 +751,7 @@ nixlAgent::makeXferReq (const nixl_xfer_op_t &operation,
751751 handle->hasNotif = opt_args.hasNotif ;
752752 handle->backendOp = operation;
753753 handle->status = NIXL_ERR_NOT_POSTED;
754- handle->telemetry .totalBytes = total_bytes;
754+ handle->telemetry .totalBytes_ = total_bytes;
755755
756756 ret = handle->engine ->prepXfer (handle->backendOp ,
757757 *handle->initiatorDescs ,
@@ -877,7 +877,7 @@ nixlAgent::createXferReq(const nixl_xfer_op_t &operation,
877877 handle->status = NIXL_ERR_NOT_POSTED;
878878 handle->notifMsg = opt_args.notifMsg ;
879879 handle->hasNotif = opt_args.hasNotif ;
880- handle->telemetry .totalBytes = total_bytes;
880+ handle->telemetry .totalBytes_ = total_bytes;
881881
882882 ret1 = handle->engine ->prepXfer (handle->backendOp ,
883883 *handle->initiatorDescs ,
@@ -941,7 +941,7 @@ nixlAgent::postXferReq(nixlXferReqH *req_hndl,
941941 return NIXL_ERR_INVALID_PARAM;
942942 }
943943
944- if (data->telemetry_ ) req_hndl->telemetry .startTime = std::chrono::steady_clock::now ();
944+ if (data->telemetry_ ) req_hndl->telemetry .startTime_ = std::chrono::steady_clock::now ();
945945
946946 NIXL_SHARED_LOCK_GUARD (data->lock );
947947 // Check if the remote was invalidated before post/repost
@@ -1049,6 +1049,25 @@ nixlAgent::getXferStatus (nixlXferReqH *req_hndl) const {
10491049 return req_hndl->status ;
10501050}
10511051
1052+ nixl_status_t
1053+ nixlAgent::getXferTelemetry (const nixlXferReqH* req_hndl,
1054+ nixl_xfer_telem_t &telemetry) const {
1055+ if (!data->telemetry_ )
1056+ return NIXL_ERR_NO_TELEMETRY;
1057+
1058+ if (req_hndl->status <0 )
1059+ return req_hndl->status ;
1060+
1061+ // NIXL_SUCCESS or NIXL_IN_PROG, values are initialized
1062+ telemetry.backendType = req_hndl->engine ->getType ();
1063+ telemetry.startTime = req_hndl->telemetry .startTime_ ;
1064+ telemetry.postDuration = req_hndl->telemetry .postDuration_ ;
1065+ telemetry.xferDuration = req_hndl->telemetry .xferDuration_ ;
1066+ telemetry.totalBytes = req_hndl->telemetry .totalBytes_ ;
1067+ telemetry.descCount = req_hndl->initiatorDescs ->descCount ();
1068+
1069+ return req_hndl->status ;
1070+ }
10521071
10531072nixl_status_t
10541073nixlAgent::queryXferBackend (const nixlXferReqH* req_hndl,
0 commit comments