Skip to content

Commit

Permalink
Sleep before/after originalFreeMemory
Browse files Browse the repository at this point in the history
  • Loading branch information
Elanis committed Feb 8, 2023
1 parent 139e7c4 commit ff15574
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions runner/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,23 @@ export function killAll(pid, signal='SIGTERM'){
}
}

async function sleep(seconds) {
return (await new Promise((resolve, _reject) => {
setTimeout(resolve, seconds * 1000);
});
}

async function getMemoryUsageHistoryOfProcess(processPath, processExe, timeout=DEFAULT_TIMEOUT) {
return new Promise((resolve, reject) => {
return new Promise(async(resolve, reject) => {
let memUsageHistory = [];
let sysMemUsageHistory = [];
let startTime = '?';
let done = false;
let time = 0;
let originalFreeMemory = os.freemem();

await sleep(5);
const originalFreeMemory = os.freemem();
await sleep(1);

// Spawn process
const startTimestamp = performance.now();
Expand Down

0 comments on commit ff15574

Please sign in to comment.