Skip to content

JonathanMH/nench-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nench Parser (for Node.js)

This is an (incomplete) parser for Nench log files for Node.js. I needed it for writing a blog post about comparing VPS performance, so I thought maybe somebody else might need this as well :)

Here's an example of how to use the parser:

const fs = require("fs");
const NenchParser = require("./NenchParser.js");

async function parseNenchLog(filePath) {
  fs.readFile(filePath, "utf8", async (err, content) => {
    const myParser = new NenchParser();
    const parsed = myParser.parse(content);
    console.log(JSON.stringify(parsed.results));
  });
}

parseNenchLog("example/2019-04-20-07_21_49.log");

This is an exmple of how you can automate running nench on the server and capture all nench log output (also the cpu timings) to a log file:

#!/bin/bash

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y time bzip2 wget

wget -O nench.sh wget.racing/nench.sh

chmod +x nench.sh

for ((n=1;n<11;n++))
TIMESTAMP=$(date "+%Y-%m-%d-%H_%M_%S")
touch "$TIMESTAMP.log"
# output rewriting necessary for the CPU timing logging to go where it should
exec 3>&1 4>&2 1>"$TIMESTAMP.log" 2>&1
./nench.sh
exec 1>&3 2>&4

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published