omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / estimation / est3b_collect.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # EST-3b fresh data collection (protocol v2, docs/estimation/EST23_PROTOCOL_V2.md; |
| 18 | # protocol v1 section 7): a 1 Hz shell reader of /sys/class/thermal. |
| 19 | # tools/estimation/est3b_collect.sh <fit|heldout|smoke> <seconds> <raw-root> |
| 20 | # Writes <raw-root>/<UTC>-est3b-<role>-silicon/ with machine-state.ndjson |
| 21 | # (same line shape as R15: {"t":<s.ns>,"thermal_mc":"<zone0> <zone1> ..."}), |
| 22 | # an empty machine-state-marks.txt (no trials), machine-state-start.txt and |
| 23 | # SHA256SUMS. No root, no perf, no /dev/null: read errors go to stderr. |
| 24 | set -u |
| 25 | role=${1:?fit, heldout or smoke} |
| 26 | secs=${2:?seconds} |
| 27 | root=${3:?raw root} |
| 28 | d=$root/$(date -u +%Y%m%dT%H%M%SZ)-est3b-$role-silicon |
| 29 | mkdir -p "$d" |
| 30 | date -u +%FT%TZ > "$d/machine-state-start.txt" |
| 31 | end=$(( $(date +%s) + secs )) |
| 32 | while [ "$(date +%s)" -lt "$end" ]; do |
| 33 | t=$(date +%s.%N) |
| 34 | th=$(cat /sys/class/thermal/thermal_zone*/temp | tr '\n' ' ') |
| 35 | printf '{"t":%s,"thermal_mc":"%s"}\n' "$t" "$th" >> "$d/machine-state.ndjson" |
| 36 | sleep 1 |
| 37 | done |
| 38 | : > "$d/machine-state-marks.txt" |
| 39 | (cd "$d" && sha256sum machine-state.ndjson machine-state-marks.txt machine-state-start.txt > SHA256SUMS) |
| 40 | echo "$d" |