-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmu.js
37 lines (32 loc) · 1014 Bytes
/
mu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { open } from 'node:fs/promises';
import fs from 'node:fs';
fileReader().finally();
let values = [];
let currentMax = 0;
async function fileReader() {
const file = await open('mu-out.log');
let process = false;
for await (let line of file.readLines()) {
if (!process) {
process = line.includes('START');
}
if (line.includes('Processing Data Item')) {
line = line.slice('[2024-10-29T19:00:00.770Z] '.length);
//console.log(process);
if (process) {
const onlyValue = parseInt(line.replace('Processing Data Item took ', ''));
//console.log(onlyValue);
values.push(onlyValue);
if (onlyValue > currentMax) {
currentMax = onlyValue;
}
}
}
}
values = values.sort((a, b) => b - a).filter((v) => v > 1000);
console.log(values.length);
const now = new Date();
console.log(`${now.toISOString()}`, now.getTime());
console.log('max', currentMax);
fs.writeFileSync('mu-lag.csv', values.join(','));
}