hyperdrive-profiler 2.0.3 → 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 +32 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -65,12 +65,43 @@ const cmd = command('hyperdrive-profiler',
65
65
  timestampsInfo += secTillMetadata
66
66
  ? `${secTillMetadata.toFixed(2).toString()} seconds`
67
67
  : 'unknown (still connecting...)'
68
+ timestampsInfo += `\n - Metadata db: ${drive.db.core.contiguousLength} / ${drive.db.core.length} (contiguous length / length)`
69
+
70
+ const blobsContig = drive.blobs?.core?.contiguousLength == null
71
+ ? 'loading'
72
+ : drive.blobs.core.contiguousLength
73
+ const blobsLength = drive.blobs?.core?.length == null
74
+ ? 'loading'
75
+ : drive.blobs.core.length
76
+
77
+ timestampsInfo += `\n - Blobs core: ${blobsContig} / ${blobsLength} (contiguous length / length)`
68
78
  if (secTillFullyDownload) timestampsInfo += `\n - Fully downloaded in ${secTillFullyDownload.toFixed(2)} seconds`
69
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
+
70
101
  const udxInfo = getUdxInfo(swarmStats, elapsedSec)
71
102
  const swarmInfo = getSwarmInfo(swarmStats, { printIp, detail })
72
103
  const hypercoreInfo = getHypercoreInfo(hypercoreStats, { detail })
73
- console.log(`${timestampsInfo}\n${udxInfo}${swarmInfo}${hypercoreInfo}`)
104
+ console.log(`${timestampsInfo}\n${udxInfo}${swarmInfo}${hypercoreInfo}${contigInfo}`)
74
105
  console.log(`${'-'.repeat(50)}\n`)
75
106
  }
76
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.3",
3
+ "version": "2.1.0",
4
4
  "description": "Profile hyperdrive download performance",
5
5
  "main": "index.js",
6
6
  "scripts": {