dot

packages and services management
Log | Files | Refs | README

commit 1de51814f0b466d4c4d9967767812aee275a8fb8
parent 732ee9a423a6723a0b10c2f463652e9723eef7c7
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Sun,  6 Aug 2017 11:57:17 +0200

monitor/bin/monitor-plot: fix data timstamps alignment

Diffstat:
Mmonitor/bin/monitor | 2++
Mmonitor/bin/monitor-plot | 6++++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/monitor/bin/monitor b/monitor/bin/monitor @@ -1,3 +1,5 @@ +# script monitoring performances and recording data to $VAR/stat + VAR=${VAR:-$HOME/var} STEP="${1:-900}" diff --git a/monitor/bin/monitor-plot b/monitor/bin/monitor-plot @@ -1,6 +1,6 @@ # read the data from "$VAR/stat/data" and fills missing entries with "?" -awk -v STEP="${1:?Usage: ${0##*/} step}" ' +awk -v STEP="${1:?argument missing} step}" ' BEGIN { fields[2] = "time" @@ -19,9 +19,11 @@ BEGIN { } END { + # find the alignment of the data timestamps (phase) for (i = 1; i <= NR; i++) start += data[2"]["i] % STEP - start = start / NR + int(data[2"]["1] / STEP) * STEP + start = int(start / NR + STEP / 2) + start += data[2"]["1] - data[2"]["1] % STEP for (i = 3; i <= nfields; i++) { offset = start