hyperdrive-profiler 2.0.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +22 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -77,10 +77,31 @@ const cmd = command('hyperdrive-profiler',
77
77
  timestampsInfo += `\n - Blobs core: ${blobsContig} / ${blobsLength} (contiguous length / length)`
78
78
  if (secTillFullyDownload) timestampsInfo += `\n - Fully downloaded in ${secTillFullyDownload.toFixed(2)} seconds`
79
79
 
80
+ let remoteLength = 0
81
+ let remoteContiguousLength = 0
82
+ let blobRemoteLength = 0
83
+ let blobRemoteContiguousLength = 0
84
+
85
+ for (const peer of drive.core.peers) {
86
+ remoteLength = Math.max(peer.remoteLength, remoteLength)
87
+ remoteContiguousLength = Math.max(peer.remoteContiguousLength, remoteContiguousLength)
88
+ }
89
+
90
+ for (const peer of drive.blobs?.core.peers) {
91
+ blobRemoteLength = Math.max(peer.remoteLength, blobRemoteLength)
92
+ blobRemoteContiguousLength = Math.max(peer.remoteContiguousLength, blobRemoteContiguousLength)
93
+ }
94
+
95
+ let contigInfo = 'Availability:\n'
96
+ contigInfo += ' - Metadata remote length: ' + remoteLength + '\n'
97
+ contigInfo += ' - Metadata remote contiguous length: ' + remoteContiguousLength + '\n'
98
+ contigInfo += ' - Blob remote length: ' + blobRemoteLength + '\n'
99
+ contigInfo += ' - Blob remote contiguous length: ' + blobRemoteContiguousLength + '\n'
100
+
80
101
  const udxInfo = getUdxInfo(swarmStats, elapsedSec)
81
102
  const swarmInfo = getSwarmInfo(swarmStats, { printIp, detail })
82
103
  const hypercoreInfo = getHypercoreInfo(hypercoreStats, { detail })
83
- console.log(`${timestampsInfo}\n${udxInfo}${swarmInfo}${hypercoreInfo}`)
104
+ console.log(`${timestampsInfo}\n${udxInfo}${swarmInfo}${hypercoreInfo}${contigInfo}`)
84
105
  console.log(`${'-'.repeat(50)}\n`)
85
106
  }
86
107
  const statsInterval = setInterval(printStats, statsIntervalMs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperdrive-profiler",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "Profile hyperdrive download performance",
5
5
  "main": "index.js",
6
6
  "scripts": {