Created
October 12, 2023 20:49
-
-
Save kng/0558ef4b24c618ab4d4112fa0f4e79b4 to your computer and use it in GitHub Desktop.
measure cpu thread time on a satnogs flowgraph with psutil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
import psutil | |
if(len(sys.argv) != 2): | |
print("supply process ID") | |
exit(1) | |
p = psutil.Process(int(sys.argv[1])) | |
print("cpu times {}".format(p.cpu_times())) | |
print("io counters {}".format(p.io_counters())) | |
print("thread name, user time, system time:") | |
for pt in p.threads(): | |
ps = psutil.Process(pt[0]).name() | |
print("{} {} {}".format(ps, pt[1], pt[2])) | |
print("terminating.") | |
p.terminate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FREQ=145917000 | |
DEVICE="driver=rtlsdr" | |
GAIN="20.7" | |
ANT="RX" | |
TMP="/tmp/rec" | |
DIR="1.3-1_udp" # directry that contains the flowgraphs | |
SCRIPT="satnogs_fsk.py" | |
TIME=600 | |
#SAMPRATES="250e3 1024e3 1536e3 1792e3 1920e3 2048e3 2160e3 2560e3 2880e3 3200e3" | |
SAMPRATES="1024e3 2048e3 2560e3 2880e3 3200e3" | |
#SAMPRATES="250e3" | |
for SR in $SAMPRATES; do | |
echo "launching flowgraph at $SR" | |
"$DIR/$SCRIPT" --soapy-rx-device="$DEVICE" --samp-rate-rx="$SR" --rx-freq="$FREQ" --file-path="$TMP.ogg" --waterfall-file-path="$TMP.wf" --decoded-data-file-path="$TMP.dec" --gain="$GAIN" --antenna="$ANT" > "$DIR/$SR.log" 2>&1 & | |
PID=$! | |
echo "waiting $TIME seconds" | |
sleep "$TIME" | |
./psu.py "$PID" > "$DIR/$SR.txt" | |
#kill "$PID" | |
echo -n "audio length: " >> "$DIR/$SR.txt" | |
soxi -D "$TMP.ogg" >> "$DIR/$SR.txt" | |
rm -f "$TMP".* | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment