forked from Blendman974/faceclaw
Port the Developer app's resource monitor to iOS
This commit is contained in:
1 parent
c5f80a0b00
commit
f47d82b871
13 files changed
+344
-74
No files matched your search
@@ -0,0 +1,22 @@
|
||||
/** Platform-neutral process resource sample, shared by resource-usage.ts and resource-usage.ios.ts. */
|
||||
|
||||
export type ResourceSample = {
|
||||
/** Monotonic clock (counting deep sleep), ms. */
|
||||
atMs: number;
|
||||
/** Cumulative CPU time of every thread in the process, ms. */
|
||||
cpuMs: number;
|
||||
threads: number;
|
||||
/** One value per entry of the platform's MEMORY_SERIES, MiB. */
|
||||
memoryMb: number[];
|
||||
/** Platform-specific details for the latest sample (peaks, limits, thermal state). */
|
||||
status: string;
|
||||
};
|
||||
|
||||
export function kbToMb(kb: number): number {
|
||||
return Number.isFinite(kb) ? Math.max(0, kb) / 1024 : 0;
|
||||
}
|
||||
|
||||
export function formatMb(value: number): string {
|
||||
if (value >= 1024) return `${(value / 1024).toFixed(1)}G`;
|
||||
return `${Math.round(value)}M`;
|
||||
}
|
||||
Reference in new issue
Block a user