Skip to content

Instantly share code, notes, and snippets.

@superboum
Created November 7, 2018 10:09
Show Gist options
  • Save superboum/1c4f78d3ab4426594b0618683ef11d95 to your computer and use it in GitHub Desktop.
Save superboum/1c4f78d3ab4426594b0618683ef11d95 to your computer and use it in GitHub Desktop.
const fs = require('fs')
const content = fs.readFileSync('single-host_latency.json').toString('utf-8').split("\n")
content.pop()
const parsed = content.map(JSON.parse)
console.log("Number of RTT measured for Tor Circuit 0:", parsed[0][10].length)
console.log("Number of Tor Circuit created:", parsed.length)
const broken_from_beginning = parsed.filter(l => l[10].length == 0).length
const broken_en_route = parsed.filter(l => l[10].length > 0 && l[10].length < 600).length
console.log("Percentage of Tor Circuits that have 0 RTT measurement:", broken_from_beginning/parsed.length*100)
console.log("Percentage of Tor Circuits that have at least 1 RTT measurement but less than 600:",broken_en_route/parsed.length*100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment