Skip to content

Instantly share code, notes, and snippets.

@mw2q
mw2q / dbt2-post-process.py
Created January 2, 2020 23:58
post processing dbt2 mix.log with python
#!/usr/bin/env python
import sys
from math import ceil, floor, fsum
def average(values):
count = float(len(values))
if count == 0:
return 0
return fsum(values) / float(len(values))
@mw2q
mw2q / dbt2-post-process.r
Created January 3, 2020 00:11
post processing dbt2 mix.log with r
#!/usr/bin/env Rscript
mixfile = commandArgs(trailingOnly=TRUE)[1]
mix <- read.csv(file=mixfile, header=F)
colnames(mix) <- c('ctime', 'txn', 'status', 'response', 'pthread')
# Get the ctime after the START marker and the ctime before the first
# TERMINATED marker.
start <- mix[1,]$ctime
@mw2q
mw2q / dbt2-post-process.jl
Created January 3, 2020 00:26
post processing dbt2 mix.log with julia
#!/usr/bin/env julia
using Printf
using Statistics
function process(mixfile::String)
ctime0 = missing
RampupTime = 0
StartTime = missing
SteadyStateTime = missing
@mw2q
mw2q / dbt2-post-process-df.jl
Created January 3, 2020 00:28
post processing dbt2 mix.log with julia and data frames
#!/usr/bin/env julia
using CSV
using DataFrames
using Printf
using Statistics
function displayreport(df::DataFrame)
errors = count(y -> (y .== "E"), skipmissing(df.code))