Skip to content

Commit

Permalink
rename pdu_stat.[enqueue|send]_time to ..._timestamp
Browse files Browse the repository at this point in the history
So we make it more clear that [enqueue|send]_timestamp is the timestamp when
these two events occured and that response_time is different, i.e. the
relative time between when a request was sent to the server and the response
was received.

Signed-off-by: Ronnie Sahlberg <[email protected]>
  • Loading branch information
sahlberg committed Aug 16, 2024
1 parent 768f88f commit 957dc39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/nfsc/libnfs-raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ struct rpc_pdu_stats {
uint32_t prog;
uint32_t vers;
uint32_t proc;
uint64_t enqueue_time; /* us, when the pdu was enqueued */
uint64_t send_time; /* us, when the pdu was sent */
uint64_t response_time; /* us, only valid in replies */
uint64_t enqueue_timestamp; /* us, when the pdu was enqueued */
uint64_t send_timestamp; /* us, when the pdu was sent */
uint64_t response_time; /* us, only valid in replies */
};
typedef void (*rpc_stats_cb)(struct rpc_context *rpc,
struct rpc_pdu_stats *data,
Expand Down
4 changes: 2 additions & 2 deletions lib/pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu)
recordmarker = htonl(size | 0x80000000);
memcpy(pdu->out.iov[0].buf, &recordmarker, 4);

pdu->pdu_stats.enqueue_time = rpc_current_time_us();
pdu->pdu_stats.enqueue_timestamp = rpc_current_time_us();
pdu->pdu_stats.size = size;
pdu->pdu_stats.xid = pdu->msg.xid;
pdu->pdu_stats.direction = CALL;
Expand Down Expand Up @@ -882,7 +882,7 @@ static int rpc_process_reply(struct rpc_context *rpc, ZDR *zdr)
pdu->pdu_stats.size = rpc->rm_xid[0];
pdu->pdu_stats.direction = REPLY;
pdu->pdu_stats.status = msg.body.rbody.stat;
pdu->pdu_stats.response_time = rpc_current_time_us() - pdu->pdu_stats.send_time;
pdu->pdu_stats.response_time = rpc_current_time_us() - pdu->pdu_stats.send_timestamp;
if (rpc->stats_cb) {
rpc->stats_cb(rpc, &pdu->pdu_stats, rpc->stats_private_data);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ rpc_write_to_socket(struct rpc_context *rpc)
rpc_enqueue(&rpc->waitpdu[hash], pdu);
rpc->waitpdu_len++;

pdu->pdu_stats.send_time = rpc_current_time_us();
pdu->pdu_stats.send_timestamp = rpc_current_time_us();
if (rpc->stats_cb) {
rpc->stats_cb(rpc, &pdu->pdu_stats, rpc->stats_private_data);
}
Expand Down

0 comments on commit 957dc39

Please sign in to comment.