From 9b4988d58a93a5aee9dd0ce160bc0bbe14aba6a4 Mon Sep 17 00:00:00 2001 From: Para Dox Date: Mon, 2 Jun 2025 01:04:21 +0700 Subject: [PATCH] measure nanoseconds --- split-proxy/proxy.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/split-proxy/proxy.js b/split-proxy/proxy.js index 2b05e683..b82d11d3 100644 --- a/split-proxy/proxy.js +++ b/split-proxy/proxy.js @@ -136,9 +136,6 @@ class RPCProxy { const requestId = this.generateRequestId(); const startTime = Date.now(); - // Add high-resolution timing - const hrStartTime = process.hrtime.bigint(); - const requestBody = req.body; // Validate request body @@ -350,6 +347,9 @@ class RPCProxy { let responseData = ''; let statusCode = 0; let upstreamResponse = null; + + // Add high-resolution timing for this method + const streamMethodStartTime = process.hrtime.bigint(); try { // Create fresh client for this request @@ -417,7 +417,7 @@ class RPCProxy { const streamLatency = Date.now() - startTime; // Calculate pre-streaming overhead in nanoseconds - const preStreamOverheadNs = Number(process.hrtime.bigint() - hrStartTime); + const preStreamOverheadNs = Number(process.hrtime.bigint() - streamMethodStartTime); logger.info({ requestId,