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 / seed / qualification / security673 / resources / measure.om
| 1 | note 63 paired samples of100 reserve/commit/reclaim cycles, same state/token/vector. |
| 2 | note Baseline uses trusted unchecked scalar mutation, not a safe implementation. |
| 3 | note Nanoseconds per100 cycles; host scheduling noise remains. No service throughput claim. |
| 4 | text title "MEASURE helper cycles=100 samples=63 baseline_ns p50/p95/p99 then checked_ns p50/p95/p99\n" |
| 5 | text samples "RAW paired samples: baseline_ns then checked_ns, 63 pairs in execution order\n" |
| 6 | text nl "\n" |
| 7 | global digits uchar 32 |
| 8 | fn number n ulong to void |
| 9 | p = ulong 32 |
| 10 | while gt n 9 bound 20 |
| 11 | p = sub p 1 |
| 12 | put digits p add uchar rem n 10 48 |
| 13 | n = div n 10 |
| 14 | end |
| 15 | p = sub p 1 |
| 16 | put digits p add uchar n 48 |
| 17 | w = write 1 digits p sub 32 p |
| 18 | w = write 1 nl 0 1 |
| 19 | end |
| 20 | fn order a edit ulong 63 to void |
| 21 | for i ulong 63 |
| 22 | for j ulong 62 |
| 23 | if gt get a j get a add j 1 |
| 24 | v = get a j |
| 25 | put a j get a add j 1 |
| 26 | put a add j 1 v |
| 27 | end |
| 28 | end |
| 29 | end |
| 30 | end |
| 31 | fn cycles s edit ulong 64 t edit ulong 8 q view ulong 8 checked bool to bool |
| 32 | for k ulong 100 |
| 33 | put t 1 get s 56 |
| 34 | put t 2 add get s 59 1 |
| 35 | if checked |
| 36 | if ne rv_reserve s t q 0 0 |
| 37 | ret false |
| 38 | end |
| 39 | if ne rv_commit s t q true true 0 |
| 40 | ret false |
| 41 | end |
| 42 | if ne rv_reclaim s t q true true 0 |
| 43 | ret false |
| 44 | end |
| 45 | else |
| 46 | for d ulong 8 |
| 47 | put s add 16 d get q d |
| 48 | put s add 8 d add get s add 8 d get q d |
| 49 | put s add 8 d sub get s add 8 d get q d |
| 50 | put s add 16 d 0 |
| 51 | end |
| 52 | put s 56 add get s 56 1 |
| 53 | put s 59 get t 2 |
| 54 | end |
| 55 | end |
| 56 | ret true |
| 57 | end |
| 58 | fn main to int |
| 59 | s = new ulong 64 0 |
| 60 | t = new ulong 8 0 |
| 61 | q = new ulong 8 4 |
| 62 | a = new ulong 63 0 |
| 63 | b = new ulong 63 0 |
| 64 | if ne setup s 6 0 |
| 65 | ret 1 |
| 66 | end |
| 67 | token t 0 1 1 |
| 68 | for i ulong 63 |
| 69 | start = monons |
| 70 | if not cycles s t q false |
| 71 | ret 2 |
| 72 | end |
| 73 | put a i ulong sub monons start |
| 74 | start = monons |
| 75 | if not cycles s t q true |
| 76 | ret 3 |
| 77 | end |
| 78 | put b i ulong sub monons start |
| 79 | end |
| 80 | w = write 1 samples 0 len samples |
| 81 | for i ulong 63 |
| 82 | number get a i |
| 83 | number get b i |
| 84 | end |
| 85 | order a |
| 86 | order b |
| 87 | w = write 1 title 0 len title |
| 88 | number get a 31 |
| 89 | number get a 59 |
| 90 | number get a 62 |
| 91 | number get b 31 |
| 92 | number get b 59 |
| 93 | number get b 62 |
| 94 | ret 0 |
| 95 | end |