#!/bin/sh # 4.1: the card's CPU with the dot showing (3 waiting) and after dismiss-all (0). N=/nix/store/3hc220fbhzqrci7yamhp4p35bkh3bych-k230-notifications/bin/k230-notifications card=$(cat /run/shell/exhibition.pid); foot=$(ps -o ppid= -p $card | tr -d ' ') ticks(){ awk '{print $14+$15}' /proc/$1/stat; } hz=$(getconf CLK_TCK) win(){ a=$(ticks $card); b=$(ticks $foot); t0=$(date +%s); sleep 120 a2=$(ticks $card); b2=$(ticks $foot); t=$(( $(date +%s) - t0 )) echo "$(date +%T) $1: card $(( (a2-a)*1000/hz )) ms + foot $(( (b2-b)*1000/hz )) ms CPU over ${t} s"; } echo "card pid $card ($(tr '\0' ' '