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 / est5_window_scan.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 | # ESTIMATION v5 window scan: print one line per foreign build/test/chip-gate process |
| 18 | # currently running, "FOREIGN <pid> <ppid> <comm>", excluding the collector's own load |
| 19 | # generator (pid $1, its children), the scan's own ancestors (the collector and whatever |
| 20 | # launched it) and the scan itself. Prints nothing when the machine is clean. |
| 21 | # est5_window_scan.sh [own-load-pid] |
| 22 | own=${1:-0} |
| 23 | anc=" " |
| 24 | p=$$ |
| 25 | while [ -n "$p" ] && [ "$p" -gt 1 ] 2> /dev/null; do |
| 26 | anc="$anc$p " |
| 27 | p=$(awk '{ sub(/^.*\) /, ""); print $2 }' "/proc/$p/stat" 2> /dev/null) |
| 28 | done |
| 29 | ps -eo pid=,ppid=,comm= | awk -v own="$own" -v anc="$anc" ' |
| 30 | $3 ~ /^(make|gmake|cc|gcc|g\+\+|c\+\+|cc1|cc1plus|clang.*|ld|ld\..*|as|collect2|cmake|ninja|ctest|cargo|rustc|qemu-system.*|test_.*|est_load|est[0-9a-z_]*|verify_all.*|run_gate.*|t)$/ { |
| 31 | if ($1 == own || $2 == own) next |
| 32 | if (index(anc, " " $1 " ")) next |
| 33 | print "FOREIGN", $1, $2, $3 |
| 34 | }' |