MCPcopy
hub / github.com/deepnote/deepnote / displayMetrics

Function displayMetrics

packages/cli/src/utils/metrics.ts:87–103  ·  view source on GitHub ↗
(metrics: JupyterMetricsResponse)

Source from the content-addressed store, hash-verified

85
86/** Display resource metrics inline */
87export function displayMetrics(metrics: JupyterMetricsResponse): void {
88 const c = getChalk()
89 const cpuBar = createProgressBar(metrics.cpu_percent, 15)
90 const memUsed = formatBytes(metrics.rss)
91
92 let memDisplay: string
93 if (metrics.limits.memory.rss > 0) {
94 const memLimit = formatBytes(metrics.limits.memory.rss)
95 const memPercent = (metrics.rss / metrics.limits.memory.rss) * 100
96 const memBar = createProgressBar(memPercent, 15)
97 memDisplay = `${memBar} ${memUsed}/${memLimit}`
98 } else {
99 memDisplay = memUsed
100 }
101
102 output(c.dim(` CPU: ${cpuBar} ${metrics.cpu_percent.toFixed(1)}% | Memory: ${memDisplay}`))
103}
104
105/** Format memory delta as human-readable string with sign */
106export function formatMemoryDelta(bytes: number): string {

Callers 3

metrics.test.tsFile · 0.90
startMetricsMonitoringFunction · 0.90
outputHumanRunSummaryFunction · 0.90

Calls 4

getChalkFunction · 0.90
outputFunction · 0.90
createProgressBarFunction · 0.85
formatBytesFunction · 0.85

Tested by

no test coverage detected