From bf60f59802eca2943854bc07402f715d037b28c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=81=D0=B5=D0=B2=D0=BE=D0=BB=D0=BE=D0=B4?= Date: Sun, 10 Mar 2024 11:11:24 +0300 Subject: [PATCH] Add maximum mem usage in stats --- TODO.md | 2 +- api/src/job.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 4dfdc47..b551121 100644 --- a/TODO.md +++ b/TODO.md @@ -1 +1 @@ -1. add time format line (https://www.man7.org/linux/man-pages/man1/time.1.html#top_of_page) \ No newline at end of file +1. ~~add time format line (https://www.man7.org/linux/man-pages/man1/time.1.html#top_of_page)~~ \ No newline at end of file diff --git a/api/src/job.js b/api/src/job.js index 957ddc6..e038a75 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -155,7 +155,8 @@ class Job { ]; const time_format = [ - '-p' + '-f', + 'real %es\\nuser %Us\\nsys %Ss\\nmem %MKb', ] if (memory_limit >= 0) { @@ -274,10 +275,10 @@ class Job { this.close_cleanup(); if (stderr.length > 0) { - var stats = stderr.trim().split('\n').slice(-3).join('\n'); + var stats = stderr.trim().split('\n').slice(-4).join('\n'); - stderr = stderr.trim().split('\n').slice(0, -3).join('\n'); - output = output.trim().split('\n').slice(0, -3).join('\n'); + stderr = stderr.trim().split('\n').slice(0, -4).join('\n'); + output = output.trim().split('\n').slice(0, -4).join('\n'); } var end_time = new Date().getTime(); @@ -292,10 +293,10 @@ class Job { this.close_cleanup(); if (stderr.length > 0) { - var stats = stderr.trim().split('\n').slice(-3).join('\n'); + var stats = stderr.trim().split('\n').slice(-4).join('\n'); - stderr = stderr.trim().split('\n').slice(0, -3).join('\n'); - output = output.trim().split('\n').slice(0, -3).join('\n'); + stderr = stderr.trim().split('\n').slice(0, -4).join('\n'); + output = output.trim().split('\n').slice(0, -4).join('\n'); } var end_time = new Date().getTime();