UNPKG

@cocalc/project

Version:
19 lines 789 B
"use strict"; /* * This file is part of CoCalc: Copyright © 2020 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ Object.defineProperty(exports, "__esModule", { value: true }); exports.cgroup_stats = void 0; // DiskUsage for /tmp ! function cgroup_stats(cg, du) { // why? /tmp is a memory disk in kucalc const mem_rss = cg.mem_stat.total_rss + (du?.usage ?? 0); const mem_tot = cg.mem_stat.hierarchical_memory_limit; const mem_pct = 100 * Math.min(1, mem_rss / mem_tot); const cpu_pct = 100 * Math.min(1, cg.cpu_usage_rate / cg.cpu_cores_limit); const cpu_tot = cg.cpu_usage; // seconds return { mem_rss, mem_tot, mem_pct, cpu_pct, cpu_tot }; } exports.cgroup_stats = cgroup_stats; //# sourceMappingURL=utils.js.map