I’m selling my Glowforge Basic and a potential buyer rightly asked how many hours I have on my machine. It sounds like this is a common question among users–and unless you’ve been keeping your own logs by hand, there is no easy way to determine the total print hours.
The only information I could find that was actionable came from this message: Not Calibrating or Scanning - #10
I followed those instructions and took a look at the files. In the glowforge/
directory, there are some log files with lines that reference HWFSM
, which I interpreted as “HardWare Finite State Machine,” as they seem to describe state transitions. There are two transitions that seem relevant to the actual print duration, starting => running
and running => finished
.
I wrote a quick script to parse these log messages to tally up my total print time (based on the above assumptions):
#!/bin/sh
lastts=''
total=0
die() {
echo "$1" 1>&2; exit 1
}
epochts() {
timestamp="$(echo "$1" | tr _ T)"
date -d "$timestamp" +%s
}
find . -name '*.u' -exec grep 'HWFSM: starting\|HWFSM: running' {} \; | \
while read -r timestamp idk debug hwfsm state rest; do
case "$state" in
'starting')
[ -n "$lastts" ] && die 'unexpected state'
lastts="$(epochts "$timestamp")"
;;
'running')
[ -z "$lastts" ] && die 'unexpected state'
thists="$(epochts "$timestamp")"
diff=$(( thists - lastts ))
total=$(( total + diff ))
lastts=
;;
*) die 'unexpected state' ;;
esac
echo "total: $total seconds"
done
Caveats/disclaimers:
- I got this script to a working state for my needs, I make no guarantees as to its robustness or correctness
- My log dump only included files from a few years back, so depending on your usage this is likely not an accurate lifetime total.
- I only ran this against data from my Glowforge Basic, the file structure and log format for any other models may differ
Hope this helps some other folks!