@pi-unipi/info-screen 0.1.5 → 0.1.7
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.
- package/core-groups.ts +3 -33
- package/index.ts +1 -1
- package/package.json +1 -1
- package/types.ts +1 -1
package/core-groups.ts
CHANGED
|
@@ -367,6 +367,7 @@ export function registerCoreGroups(): void {
|
|
|
367
367
|
{ id: "cwd", label: "Working Directory", show: true },
|
|
368
368
|
{ id: "modules", label: "Active Modules", show: true },
|
|
369
369
|
{ id: "uptime", label: "Session Uptime", show: true },
|
|
370
|
+
{ id: "loadTime", label: "Total Load Time", show: true },
|
|
370
371
|
],
|
|
371
372
|
},
|
|
372
373
|
dataProvider: async () => {
|
|
@@ -376,6 +377,7 @@ export function registerCoreGroups(): void {
|
|
|
376
377
|
|
|
377
378
|
const modules = getAnnouncedModules();
|
|
378
379
|
const moduleNames = modules.map((m) => m.name.replace(/^@[^/]+\//, ""));
|
|
380
|
+
const totalLoadTime = getTotalLoadTime();
|
|
379
381
|
|
|
380
382
|
return {
|
|
381
383
|
version: { value: getPiVersion(), detail: "pi" },
|
|
@@ -385,39 +387,7 @@ export function registerCoreGroups(): void {
|
|
|
385
387
|
detail: moduleNames.slice(0, 4).join(", ") + (moduleNames.length > 4 ? ` +${moduleNames.length - 4} more` : ""),
|
|
386
388
|
},
|
|
387
389
|
uptime: { value: formatUptime(process.uptime()) },
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
// 1b. Load time group
|
|
393
|
-
infoRegistry.registerGroup({
|
|
394
|
-
id: "loadtime",
|
|
395
|
-
name: "Load Time",
|
|
396
|
-
icon: "⏱️",
|
|
397
|
-
priority: 15,
|
|
398
|
-
config: {
|
|
399
|
-
showByDefault: true,
|
|
400
|
-
stats: [
|
|
401
|
-
{ id: "total", label: "Total Load Time", show: true },
|
|
402
|
-
{ id: "count", label: "Items Loaded", show: true },
|
|
403
|
-
{ id: "list", label: "Load Times", show: true },
|
|
404
|
-
],
|
|
405
|
-
},
|
|
406
|
-
dataProvider: async () => {
|
|
407
|
-
const times = getLoadTimes();
|
|
408
|
-
const total = getTotalLoadTime();
|
|
409
|
-
|
|
410
|
-
// Filter out 0ms entries and sort by load time descending
|
|
411
|
-
const validTimes = times.filter(t => t.ms > 0);
|
|
412
|
-
const sorted = [...validTimes].sort((a, b) => b.ms - a.ms);
|
|
413
|
-
|
|
414
|
-
return {
|
|
415
|
-
total: { value: `${total}ms` },
|
|
416
|
-
count: { value: String(validTimes.length) },
|
|
417
|
-
list: {
|
|
418
|
-
value: sorted.length > 0 ? `${sorted[0].name} (${sorted[0].ms}ms)` : "none",
|
|
419
|
-
detail: sorted.length > 1 ? sorted.slice(1).map(t => `${t.name} (${t.ms}ms)`).join(", ") : undefined,
|
|
420
|
-
},
|
|
390
|
+
loadTime: { value: `${totalLoadTime}ms` },
|
|
421
391
|
};
|
|
422
392
|
},
|
|
423
393
|
});
|
package/index.ts
CHANGED
package/package.json
CHANGED