#!/bin/bash

. ./config.sh

IOR_PARAMS=$1
NETOUTDIR=$2
HOST="$hostname"
PID=$$

NETOUTFILE="$NETOUTDIR/HOST:$HOST-PID:$PID-LABEL:"

function capture_network_state {
    echo "TIMESTAMP $(date +%s)"
    perfquery -x
    cat /proc/net/dev
    free -m
    #cat /proc/fs/lustre/llite/esfs-*/max_cached_mb
    cat /proc/stat
}

echo "$( capture_network_state )" &> "${NETOUTFILE}start.txt"
$IOR $IOR_PARAMS
echo "$( capture_network_state )" &> "${NETOUTFILE}stop.txt"

exit 0
