turned sumfinder into a library, which allowed to better document expe001.5, but will also allow reuse

This commit is contained in:
Guillaume Raffy 2024-08-14 16:33:25 +02:00
parent 690b735d40
commit 34dd0bceb1
8 changed files with 438 additions and 33 deletions

View File

@ -1,7 +1,32 @@
find relations between meminfo variables using [/home/graffy/work/linuxram.git/src/sumfinder.py]
find relations between meminfo variables using [/home/graffy/work/linuxram.git/src/expe001.5.py]
```sh
20240814-15:22:42 graffy@graffy-ws2:~/work/linuxram.git/measurements/expe001.5$ ../../src/sumfinder.py
20240814-16:19:42 graffy@graffy-ws2:~/work/linuxram.git/measurements/expe001.5$ ../../src/expe001.5-set001.py
set of integer variables to explore: [c: 11, b: 8, h: 7, g: 6, d: 5, a: 3, f: 2, e: 1]
sum found: c = d + a + f + e
sum found: c = g + a + f
sum found: c = g + d
sum found: c = h + a + e
sum found: c = b + f + e
sum found: c = b + a
sum found: b = d + f + e
sum found: b = d + a
sum found: b = g + f
sum found: b = h + e
sum found: h = d + f
sum found: h = g + e
sum found: g = a + f + e
sum found: g = d + e
sum found: d = a + f
sum found: a = f + e
exporting sums to set001-sums.json
creating set001-sums.dot from set001-sums.json
creating set001-sums.svg from set001-sums.dot
last command status : [0]
```
```sh
20240814-15:22:42 graffy@graffy-ws2:~/work/linuxram.git/measurements/expe001.5$ ../../src/expe001.5-alambix97.py
set of integer variables to explore: [MemTotal: 201214205952, DirectMap1G: 199715979264, Committed_AS: 141631254528, CommitLimit: 133373001728, MemAvailable: 131466833920, Cached: 130939863040, Active: 103304773632, Inactive: 94177337344, Inactive(file): 67258384384, AnonPages: 65442127872, Active(file): 63633461248, AnonHugePages: 49218060288, Active(anon): 39671312384, SwapTotal: 32765898752, Inactive(anon): 26918952960, Dirty: 8546779136, DirectMap2M: 6434062336, Slab: 1991671808, KReclaimable: 1252827136, SReclaimable: 1252827136, SwapCached: 1088724992, MemFree: 803061760, SUnreclaim: 738844672, DirectMap4k: 554131456, VmallocUsed: 302333952, PageTables: 218902528, Percpu: 215089152, Mapped: 120565760, Shmem: 69955584, Buffers: 31981568, Unevictable: 23019520, Mlocked: 19873792, KernelStack: 17088512, Writeback: 5550080, Hugepagesize: 2097152, HardwareCorrupted: 53248]
sum found: MemTotal = Active(file) + AnonHugePages + Active(anon) + Inactive(anon) + Dirty + DirectMap2M + Slab + SReclaimable + SwapCached + MemFree + SUnreclaim + VmallocUsed + PageTables + Percpu + Mapped + Buffers + Mlocked + Writeback + Hugepagesize + HardwareCorrupted
sum found: MemTotal = Active(file) + AnonHugePages + Active(anon) + Inactive(anon) + Dirty + DirectMap2M + Slab + SReclaimable + SwapCached + MemFree + SUnreclaim + DirectMap4k + VmallocUsed + Unevictable + Mlocked + KernelStack

View File

@ -0,0 +1,29 @@
digraph set001_sums
{
layout = neato
overlap = false
h [label="h=7"];
b [label="b=8"];
c [label="c=11"];
e [label="e=1"];
f [label="f=2"];
a [label="a=3"];
d [label="d=5"];
g [label="g=6"];
c -> {d,a,f,e} [color=aliceblue, label=0];
c -> {g,a,f} [color=antiquewhite, label=1];
c -> {g,d} [color=aqua, label=2];
c -> {h,a,e} [color=aquamarine, label=3];
c -> {b,f,e} [color=azure, label=4];
c -> {b,a} [color=beige, label=5];
b -> {d,f,e} [color=bisque, label=6];
b -> {d,a} [color=black, label=7];
b -> {g,f} [color=blanchedalmond, label=8];
b -> {h,e} [color=blue, label=9];
h -> {d,f} [color=blueviolet, label=10];
h -> {g,e} [color=brown, label=11];
g -> {a,f,e} [color=burlywood, label=12];
g -> {d,e} [color=cadetblue, label=13];
d -> {a,f} [color=chartreuse, label=14];
a -> {f,e} [color=chocolate, label=15];
}

View File

@ -0,0 +1 @@
{"format": "sums-v001", "variables": {"d": 5, "c": 11, "a": 3, "g": 6, "h": 7, "b": 8, "e": 1, "f": 2}, "sums": [{"total": "c", "components": ["d", "a", "f", "e"]}, {"total": "c", "components": ["g", "a", "f"]}, {"total": "c", "components": ["g", "d"]}, {"total": "c", "components": ["h", "a", "e"]}, {"total": "c", "components": ["b", "f", "e"]}, {"total": "c", "components": ["b", "a"]}, {"total": "b", "components": ["d", "f", "e"]}, {"total": "b", "components": ["d", "a"]}, {"total": "b", "components": ["g", "f"]}, {"total": "b", "components": ["h", "e"]}, {"total": "h", "components": ["d", "f"]}, {"total": "h", "components": ["g", "e"]}, {"total": "g", "components": ["a", "f", "e"]}, {"total": "g", "components": ["d", "e"]}, {"total": "d", "components": ["a", "f"]}, {"total": "a", "components": ["f", "e"]}]}

View File

@ -0,0 +1,334 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: set001_sums Pages: 1 -->
<svg width="256pt" height="281pt"
viewBox="0.00 0.00 256.27 280.92" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 276.92)">
<title>set001_sums</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-276.92 252.27,-276.92 252.27,4 -4,4"/>
<!-- h -->
<g id="node1" class="node">
<title>h</title>
<ellipse fill="none" stroke="black" cx="30.55" cy="-127.5" rx="30.59" ry="18"/>
<text text-anchor="middle" x="30.55" y="-123.8" font-family="Times,serif" font-size="14.00">h=7</text>
</g>
<!-- e -->
<g id="node4" class="node">
<title>e</title>
<ellipse fill="none" stroke="black" cx="164.32" cy="-254.92" rx="29.8" ry="18"/>
<text text-anchor="middle" x="164.32" y="-251.22" font-family="Times,serif" font-size="14.00">e=1</text>
</g>
<!-- h&#45;&gt;e -->
<g id="edge29" class="edge">
<title>h&#45;&gt;e</title>
<path fill="none" stroke="brown" d="M46.68,-142.87C70.08,-165.16 113.59,-206.61 140.63,-232.36"/>
<polygon fill="brown" stroke="brown" points="138.47,-235.14 148.13,-239.5 143.3,-230.07 138.47,-235.14"/>
<text text-anchor="middle" x="103.16" y="-191.42" font-family="Times,serif" font-size="14.00">11</text>
</g>
<!-- f -->
<g id="node5" class="node">
<title>f</title>
<ellipse fill="none" stroke="black" cx="127.34" cy="-156.29" rx="27.9" ry="18"/>
<text text-anchor="middle" x="127.34" y="-152.59" font-family="Times,serif" font-size="14.00">f=2</text>
</g>
<!-- h&#45;&gt;f -->
<g id="edge27" class="edge">
<title>h&#45;&gt;f</title>
<path fill="none" stroke="blueviolet" d="M58.02,-135.68C68.55,-138.81 80.71,-142.42 91.88,-145.74"/>
<polygon fill="blueviolet" stroke="blueviolet" points="91.2,-149.19 101.78,-148.69 93.2,-142.48 91.2,-149.19"/>
<text text-anchor="middle" x="84.45" y="-144.51" font-family="Times,serif" font-size="14.00">10</text>
</g>
<!-- d -->
<g id="node7" class="node">
<title>d</title>
<ellipse fill="none" stroke="black" cx="54.94" cy="-18" rx="30.59" ry="18"/>
<text text-anchor="middle" x="54.94" y="-14.3" font-family="Times,serif" font-size="14.00">d=5</text>
</g>
<!-- h&#45;&gt;d -->
<g id="edge28" class="edge">
<title>h&#45;&gt;d</title>
<path fill="none" stroke="blueviolet" d="M34.58,-109.42C38.42,-92.14 44.28,-65.85 48.73,-45.89"/>
<polygon fill="blueviolet" stroke="blueviolet" points="52.15,-46.63 50.91,-36.11 45.32,-45.11 52.15,-46.63"/>
<text text-anchor="middle" x="32.15" y="-81.46" font-family="Times,serif" font-size="14.00">10</text>
</g>
<!-- g -->
<g id="node8" class="node">
<title>g</title>
<ellipse fill="none" stroke="black" cx="210.88" cy="-74" rx="30.59" ry="18"/>
<text text-anchor="middle" x="210.88" y="-70.3" font-family="Times,serif" font-size="14.00">g=6</text>
</g>
<!-- h&#45;&gt;g -->
<g id="edge30" class="edge">
<title>h&#45;&gt;g</title>
<path fill="none" stroke="brown" d="M57.94,-119.38C88.87,-110.2 139.39,-95.21 173.83,-84.99"/>
<polygon fill="brown" stroke="brown" points="174.94,-88.31 183.53,-82.11 172.95,-81.6 174.94,-88.31"/>
<text text-anchor="middle" x="106.38" y="-105.98" font-family="Times,serif" font-size="14.00">11</text>
</g>
<!-- b -->
<g id="node2" class="node">
<title>b</title>
<ellipse fill="none" stroke="black" cx="217.72" cy="-160.16" rx="30.59" ry="18"/>
<text text-anchor="middle" x="217.72" y="-156.46" font-family="Times,serif" font-size="14.00">b=8</text>
</g>
<!-- b&#45;&gt;h -->
<g id="edge25" class="edge">
<title>b&#45;&gt;h</title>
<path fill="none" stroke="blue" d="M188.06,-154.98C156.16,-149.42 105.28,-140.54 70.02,-134.39"/>
<polygon fill="blue" stroke="blue" points="70.52,-130.92 60.07,-132.65 69.32,-137.82 70.52,-130.92"/>
<text text-anchor="middle" x="124.04" y="-133.49" font-family="Times,serif" font-size="14.00">9</text>
</g>
<!-- b&#45;&gt;e -->
<g id="edge18" class="edge">
<title>b&#45;&gt;e</title>
<path fill="none" stroke="bisque" d="M202.38,-176.18C192.75,-190.24 180.91,-210.92 172.85,-227.58"/>
<polygon fill="bisque" stroke="bisque" points="169.59,-226.3 168.59,-236.84 175.95,-229.22 169.59,-226.3"/>
<text text-anchor="middle" x="182.62" y="-205.68" font-family="Times,serif" font-size="14.00">6</text>
</g>
<!-- b&#45;&gt;e -->
<g id="edge26" class="edge">
<title>b&#45;&gt;e</title>
<path fill="none" stroke="blue" d="M213.4,-178.34C206.93,-193.28 195.36,-214.49 184.98,-230.83"/>
<polygon fill="blue" stroke="blue" points="181.95,-229.06 179.37,-239.33 187.8,-232.91 181.95,-229.06"/>
<text text-anchor="middle" x="194.19" y="-208.39" font-family="Times,serif" font-size="14.00">9</text>
</g>
<!-- b&#45;&gt;f -->
<g id="edge19" class="edge">
<title>b&#45;&gt;f</title>
<path fill="none" stroke="bisque" d="M189.89,-152.66C181.87,-151.87 173,-151.38 164.52,-151.23"/>
<polygon fill="bisque" stroke="bisque" points="164.46,-147.73 154.45,-151.21 164.45,-154.73 164.46,-147.73"/>
<text text-anchor="middle" x="172.2" y="-140.74" font-family="Times,serif" font-size="14.00">6</text>
</g>
<!-- b&#45;&gt;f -->
<g id="edge23" class="edge">
<title>b&#45;&gt;f</title>
<path fill="none" stroke="blanchedalmond" d="M188.35,-165.26C180.35,-165.33 171.6,-165.04 163.28,-164.46"/>
<polygon fill="blanchedalmond" stroke="blanchedalmond" points="163.33,-160.95 153.06,-163.57 162.72,-167.93 163.33,-160.95"/>
<text text-anchor="middle" x="170.81" y="-168.66" font-family="Times,serif" font-size="14.00">8</text>
</g>
<!-- a -->
<g id="node6" class="node">
<title>a</title>
<ellipse fill="none" stroke="black" cx="50.63" cy="-196.68" rx="29.8" ry="18"/>
<text text-anchor="middle" x="50.63" y="-192.98" font-family="Times,serif" font-size="14.00">a=3</text>
</g>
<!-- b&#45;&gt;a -->
<g id="edge21" class="edge">
<title>b&#45;&gt;a</title>
<path fill="none" stroke="black" d="M189,-166.43C161.33,-172.48 119.31,-181.66 88.83,-188.32"/>
<polygon fill="black" stroke="black" points="88,-184.92 78.98,-190.48 89.5,-191.76 88,-184.92"/>
<text text-anchor="middle" x="133.92" y="-181.18" font-family="Times,serif" font-size="14.00">7</text>
</g>
<!-- b&#45;&gt;d -->
<g id="edge20" class="edge">
<title>b&#45;&gt;d</title>
<path fill="none" stroke="bisque" d="M205.13,-143.66C179.41,-117.07 120.66,-65.33 84.69,-37.17"/>
<polygon fill="bisque" stroke="bisque" points="86.56,-34.19 76.5,-30.87 82.3,-39.74 86.56,-34.19"/>
<text text-anchor="middle" x="139.91" y="-79.21" font-family="Times,serif" font-size="14.00">6</text>
</g>
<!-- b&#45;&gt;d -->
<g id="edge22" class="edge">
<title>b&#45;&gt;d</title>
<path fill="none" stroke="black" d="M196.09,-147.23C164.34,-123.31 105.78,-72.35 74.96,-41.98"/>
<polygon fill="black" stroke="black" points="77.29,-39.36 67.76,-34.73 72.32,-44.29 77.29,-39.36"/>
<text text-anchor="middle" x="130.53" y="-98.41" font-family="Times,serif" font-size="14.00">7</text>
</g>
<!-- b&#45;&gt;g -->
<g id="edge24" class="edge">
<title>b&#45;&gt;g</title>
<path fill="none" stroke="blanchedalmond" d="M216.27,-141.88C215.36,-130.46 214.18,-115.51 213.15,-102.54"/>
<polygon fill="blanchedalmond" stroke="blanchedalmond" points="216.61,-101.93 212.33,-92.24 209.63,-102.49 216.61,-101.93"/>
<text text-anchor="middle" x="209.71" y="-126.01" font-family="Times,serif" font-size="14.00">8</text>
</g>
<!-- c -->
<g id="node3" class="node">
<title>c</title>
<ellipse fill="none" stroke="black" cx="137.23" cy="-47.25" rx="35.19" ry="18"/>
<text text-anchor="middle" x="137.23" y="-43.55" font-family="Times,serif" font-size="14.00">c=11</text>
</g>
<!-- c&#45;&gt;h -->
<g id="edge10" class="edge">
<title>c&#45;&gt;h</title>
<path fill="none" stroke="aquamarine" d="M117.16,-62.35C100.31,-75.03 76.08,-93.25 57.52,-107.21"/>
<polygon fill="aquamarine" stroke="aquamarine" points="55.34,-104.48 49.45,-113.28 59.54,-110.07 55.34,-104.48"/>
<text text-anchor="middle" x="82.34" y="-88.58" font-family="Times,serif" font-size="14.00">3</text>
</g>
<!-- c&#45;&gt;b -->
<g id="edge13" class="edge">
<title>c&#45;&gt;b</title>
<path fill="none" stroke="azure" d="M144.18,-65.26C155.41,-84.82 177.21,-115.98 194.26,-137.25"/>
<polygon fill="azure" stroke="azure" points="191.71,-139.66 200.77,-145.15 197.11,-135.21 191.71,-139.66"/>
<text text-anchor="middle" x="164.22" y="-105.06" font-family="Times,serif" font-size="14.00">4</text>
</g>
<!-- c&#45;&gt;b -->
<g id="edge16" class="edge">
<title>c&#45;&gt;b</title>
<path fill="none" stroke="beige" d="M154.73,-62.9C170.15,-81.16 191.96,-111.5 205.58,-133.48"/>
<polygon fill="beige" stroke="beige" points="202.73,-135.55 210.87,-142.33 208.74,-131.95 202.73,-135.55"/>
<text text-anchor="middle" x="175.15" y="-86.99" font-family="Times,serif" font-size="14.00">5</text>
</g>
<!-- c&#45;&gt;e -->
<g id="edge1" class="edge">
<title>c&#45;&gt;e</title>
<path fill="none" stroke="aliceblue" d="M131.69,-65.26C129.48,-101.86 139.74,-185.06 151.15,-228.08"/>
<polygon fill="aliceblue" stroke="aliceblue" points="147.84,-229.22 153.99,-237.85 154.56,-227.27 147.84,-229.22"/>
<text text-anchor="middle" x="136.42" y="-135.47" font-family="Times,serif" font-size="14.00">0</text>
</g>
<!-- c&#45;&gt;e -->
<g id="edge11" class="edge">
<title>c&#45;&gt;e</title>
<path fill="none" stroke="aquamarine" d="M147.66,-64.63C159.13,-100.55 170.36,-183.17 170.16,-226.79"/>
<polygon fill="aquamarine" stroke="aquamarine" points="166.65,-226.89 169.86,-236.99 173.65,-227.1 166.65,-226.89"/>
<text text-anchor="middle" x="161.41" y="-134.51" font-family="Times,serif" font-size="14.00">3</text>
</g>
<!-- c&#45;&gt;e -->
<g id="edge14" class="edge">
<title>c&#45;&gt;e</title>
<path fill="none" stroke="azure" d="M139.58,-65.32C144.31,-101.53 154.96,-183.21 160.62,-226.6"/>
<polygon fill="azure" stroke="azure" points="157.18,-227.29 161.95,-236.75 164.13,-226.38 157.18,-227.29"/>
<text text-anchor="middle" x="150.1" y="-134.76" font-family="Times,serif" font-size="14.00">4</text>
</g>
<!-- c&#45;&gt;f -->
<g id="edge2" class="edge">
<title>c&#45;&gt;f</title>
<path fill="none" stroke="aliceblue" d="M125.3,-64.32C120.06,-81.53 117.14,-108.35 118.01,-128.59"/>
<polygon fill="aliceblue" stroke="aliceblue" points="114.54,-129.1 118.86,-138.78 121.52,-128.53 114.54,-129.1"/>
<text text-anchor="middle" x="116.66" y="-85.26" font-family="Times,serif" font-size="14.00">0</text>
</g>
<!-- c&#45;&gt;f -->
<g id="edge5" class="edge">
<title>c&#45;&gt;f</title>
<path fill="none" stroke="antiquewhite" d="M145.77,-65.2C147.99,-82.89 146.11,-110.09 141.62,-130.17"/>
<polygon fill="antiquewhite" stroke="antiquewhite" points="138.21,-129.37 139.04,-139.93 144.98,-131.16 138.21,-129.37"/>
<text text-anchor="middle" x="148.69" y="-101.49" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- c&#45;&gt;f -->
<g id="edge15" class="edge">
<title>c&#45;&gt;f</title>
<path fill="none" stroke="azure" d="M135.59,-65.26C134.04,-82.38 131.68,-108.4 129.88,-128.24"/>
<polygon fill="azure" stroke="azure" points="126.39,-127.98 128.97,-138.26 133.36,-128.61 126.39,-127.98"/>
<text text-anchor="middle" x="127.74" y="-85.55" font-family="Times,serif" font-size="14.00">4</text>
</g>
<!-- c&#45;&gt;a -->
<g id="edge3" class="edge">
<title>c&#45;&gt;a</title>
<path fill="none" stroke="aliceblue" d="M112.87,-60.47C89.73,-85.02 60.07,-136.14 50.11,-168.57"/>
<polygon fill="aliceblue" stroke="aliceblue" points="46.68,-167.83 47.6,-178.39 53.47,-169.57 46.68,-167.83"/>
<text text-anchor="middle" x="76.49" y="-118.32" font-family="Times,serif" font-size="14.00">0</text>
</g>
<!-- c&#45;&gt;a -->
<g id="edge6" class="edge">
<title>c&#45;&gt;a</title>
<path fill="none" stroke="antiquewhite" d="M140.29,-65.36C134.82,-94.02 105.27,-147.93 80.5,-177.26"/>
<polygon fill="antiquewhite" stroke="antiquewhite" points="77.76,-175.08 73.66,-184.85 82.96,-179.76 77.76,-175.08"/>
<text text-anchor="middle" x="105.4" y="-125.11" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- c&#45;&gt;a -->
<g id="edge12" class="edge">
<title>c&#45;&gt;a</title>
<path fill="none" stroke="aquamarine" d="M131.88,-65.14C119.69,-91.82 91.02,-141.95 71.09,-172.06"/>
<polygon fill="aquamarine" stroke="aquamarine" points="67.93,-170.47 65.21,-180.71 73.72,-174.41 67.93,-170.47"/>
<text text-anchor="middle" x="96.48" y="-122.4" font-family="Times,serif" font-size="14.00">3</text>
</g>
<!-- c&#45;&gt;a -->
<g id="edge17" class="edge">
<title>c&#45;&gt;a</title>
<path fill="none" stroke="beige" d="M122.22,-63.83C104.36,-89.46 75.6,-138.77 60.37,-169.6"/>
<polygon fill="beige" stroke="beige" points="57.07,-168.37 55.93,-178.91 63.39,-171.39 57.07,-168.37"/>
<text text-anchor="middle" x="86.29" y="-120.52" font-family="Times,serif" font-size="14.00">5</text>
</g>
<!-- c&#45;&gt;d -->
<g id="edge4" class="edge">
<title>c&#45;&gt;d</title>
<path fill="none" stroke="aliceblue" d="M115.5,-32.96C109.06,-30.19 101.8,-27.42 94.6,-24.96"/>
<polygon fill="aliceblue" stroke="aliceblue" points="95.5,-21.57 84.91,-21.83 93.35,-28.24 95.5,-21.57"/>
<text text-anchor="middle" x="100.05" y="-17.76" font-family="Times,serif" font-size="14.00">0</text>
</g>
<!-- c&#45;&gt;d -->
<g id="edge8" class="edge">
<title>c&#45;&gt;d</title>
<path fill="none" stroke="aqua" d="M103.44,-42.23C97.33,-40.28 91,-38.04 85,-35.7"/>
<polygon fill="aqua" stroke="aqua" points="85.91,-32.29 75.33,-31.71 83.24,-38.76 85.91,-32.29"/>
<text text-anchor="middle" x="89.22" y="-42.77" font-family="Times,serif" font-size="14.00">2</text>
</g>
<!-- c&#45;&gt;g -->
<g id="edge7" class="edge">
<title>c&#45;&gt;g</title>
<path fill="none" stroke="antiquewhite" d="M158.37,-61.66C162.42,-63.42 166.78,-65.15 171.19,-66.77"/>
<polygon fill="antiquewhite" stroke="antiquewhite" points="170.25,-70.14 180.85,-70.08 172.52,-63.52 170.25,-70.14"/>
<text text-anchor="middle" x="169.78" y="-68.01" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- c&#45;&gt;g -->
<g id="edge9" class="edge">
<title>c&#45;&gt;g</title>
<path fill="none" stroke="aqua" d="M171.17,-52.46C174.66,-53.64 178.18,-54.92 181.61,-56.25"/>
<polygon fill="aqua" stroke="aqua" points="180.35,-59.52 190.92,-60.11 183.02,-53.05 180.35,-59.52"/>
<text text-anchor="middle" x="181.39" y="-43.16" font-family="Times,serif" font-size="14.00">2</text>
</g>
<!-- a&#45;&gt;e -->
<g id="edge38" class="edge">
<title>a&#45;&gt;e</title>
<path fill="none" stroke="chocolate" d="M73.64,-208.46C90.51,-217.11 113.64,-228.96 132.31,-238.53"/>
<polygon fill="chocolate" stroke="chocolate" points="130.85,-241.71 141.35,-243.15 134.04,-235.48 130.85,-241.71"/>
<text text-anchor="middle" x="93.48" y="-227.29" font-family="Times,serif" font-size="14.00">15</text>
</g>
<!-- a&#45;&gt;f -->
<g id="edge39" class="edge">
<title>a&#45;&gt;f</title>
<path fill="none" stroke="chocolate" d="M73.23,-184.78C80.6,-180.9 88.91,-176.52 96.76,-172.39"/>
<polygon fill="chocolate" stroke="chocolate" points="98.47,-175.44 105.69,-167.69 95.21,-169.25 98.47,-175.44"/>
<text text-anchor="middle" x="75.5" y="-167.38" font-family="Times,serif" font-size="14.00">15</text>
</g>
<!-- d&#45;&gt;f -->
<g id="edge36" class="edge">
<title>d&#45;&gt;f</title>
<path fill="none" stroke="chartreuse" d="M63.96,-35.23C76.37,-58.94 98.82,-101.83 113.4,-129.67"/>
<polygon fill="chartreuse" stroke="chartreuse" points="110.46,-131.6 118.2,-138.84 116.66,-128.35 110.46,-131.6"/>
<text text-anchor="middle" x="79.18" y="-71.25" font-family="Times,serif" font-size="14.00">14</text>
</g>
<!-- d&#45;&gt;a -->
<g id="edge37" class="edge">
<title>d&#45;&gt;a</title>
<path fill="none" stroke="chartreuse" d="M54.5,-36.12C53.75,-67.28 52.21,-131.28 51.31,-168.37"/>
<polygon fill="chartreuse" stroke="chartreuse" points="47.81,-168.43 51.07,-178.51 54.81,-168.6 47.81,-168.43"/>
<text text-anchor="middle" x="62.41" y="-91.04" font-family="Times,serif" font-size="14.00">14</text>
</g>
<!-- g&#45;&gt;e -->
<g id="edge31" class="edge">
<title>g&#45;&gt;e</title>
<path fill="none" stroke="burlywood" d="M202.02,-91.28C190.8,-122.62 173.46,-189.07 166.4,-226.95"/>
<polygon fill="burlywood" stroke="burlywood" points="162.95,-226.38 164.69,-236.83 169.84,-227.57 162.95,-226.38"/>
<text text-anchor="middle" x="179.46" y="-147.91" font-family="Times,serif" font-size="14.00">12</text>
</g>
<!-- g&#45;&gt;e -->
<g id="edge34" class="edge">
<title>g&#45;&gt;e</title>
<path fill="none" stroke="cadetblue" d="M210.51,-92.05C205.54,-123.95 188.76,-190.38 176.53,-227.81"/>
<polygon fill="cadetblue" stroke="cadetblue" points="173.13,-226.95 173.22,-237.54 179.75,-229.2 173.13,-226.95"/>
<text text-anchor="middle" x="184.02" y="-163.73" font-family="Times,serif" font-size="14.00">13</text>
</g>
<!-- g&#45;&gt;f -->
<g id="edge32" class="edge">
<title>g&#45;&gt;f</title>
<path fill="none" stroke="burlywood" d="M195.17,-89.48C182.48,-101.97 164.47,-119.72 150.19,-133.78"/>
<polygon fill="burlywood" stroke="burlywood" points="147.37,-131.65 142.7,-141.16 152.28,-136.63 147.37,-131.65"/>
<text text-anchor="middle" x="182.18" y="-115.43" font-family="Times,serif" font-size="14.00">12</text>
</g>
<!-- g&#45;&gt;a -->
<g id="edge33" class="edge">
<title>g&#45;&gt;a</title>
<path fill="none" stroke="burlywood" d="M192.18,-88.31C163.84,-110.01 109.86,-151.33 77.37,-176.21"/>
<polygon fill="burlywood" stroke="burlywood" points="75.02,-173.6 69.21,-182.45 79.28,-179.15 75.02,-173.6"/>
<text text-anchor="middle" x="139.53" y="-121.06" font-family="Times,serif" font-size="14.00">12</text>
</g>
<!-- g&#45;&gt;d -->
<g id="edge35" class="edge">
<title>g&#45;&gt;d</title>
<path fill="none" stroke="cadetblue" d="M184.78,-64.63C159.03,-55.38 119.47,-41.17 90.78,-30.87"/>
<polygon fill="cadetblue" stroke="cadetblue" points="91.72,-27.49 81.13,-27.4 89.35,-34.08 91.72,-27.49"/>
<text text-anchor="middle" x="128.28" y="-51.55" font-family="Times,serif" font-size="14.00">13</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

21
src/expe001.5-alambix97.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# given a list of integer variables and their values, this tool aims at finding which varibales can be obtained by the sum of others
# note : this tool is used to find the sums in the variables output by /proc/meminfo
from sumfinder import find_and_graph_sums
def get_test_set_002():
# alambix97/20240805-191606-meminfo.stdout
return {'MemTotal': 201214205952, 'MemFree': 803061760, 'MemAvailable': 131466833920, 'Buffers': 31981568, 'Cached': 130939863040, 'SwapCached': 1088724992, 'Active': 103304773632, 'Inactive': 94177337344, 'Active(anon)': 39671312384, 'Inactive(anon)': 26918952960, 'Active(file)': 63633461248, 'Inactive(file)': 67258384384, 'Unevictable': 23019520, 'Mlocked': 19873792, 'SwapTotal': 32765898752, 'Dirty': 8546779136, 'Writeback': 5550080, 'AnonPages': 65442127872, 'Mapped': 120565760, 'Shmem': 69955584, 'KReclaimable': 1252827136, 'Slab': 1991671808, 'SReclaimable': 1252827136, 'SUnreclaim': 738844672, 'KernelStack': 17088512, 'PageTables': 218902528, 'CommitLimit': 133373001728, 'Committed_AS': 141631254528, 'VmallocTotal': 35184372087808, 'VmallocUsed': 302333952, 'Percpu': 215089152, 'HardwareCorrupted': 53248, 'AnonHugePages': 49218060288, 'Hugepagesize': 2097152, 'DirectMap4k': 554131456, 'DirectMap2M': 6434062336, 'DirectMap1G': 199715979264}
def get_test_set_003():
# same as test_set_002 but without VmallocTotal which for some reason causes the program to become extremeley slow (maybe because it's a huge integer ?)
return {'MemTotal': 201214205952, 'MemFree': 803061760, 'MemAvailable': 131466833920, 'Buffers': 31981568, 'Cached': 130939863040, 'SwapCached': 1088724992, 'Active': 103304773632, 'Inactive': 94177337344, 'Active(anon)': 39671312384, 'Inactive(anon)': 26918952960, 'Active(file)': 63633461248, 'Inactive(file)': 67258384384, 'Unevictable': 23019520, 'Mlocked': 19873792, 'SwapTotal': 32765898752, 'Dirty': 8546779136, 'Writeback': 5550080, 'AnonPages': 65442127872, 'Mapped': 120565760, 'Shmem': 69955584, 'KReclaimable': 1252827136, 'Slab': 1991671808, 'SReclaimable': 1252827136, 'SUnreclaim': 738844672, 'KernelStack': 17088512, 'PageTables': 218902528, 'CommitLimit': 133373001728, 'Committed_AS': 141631254528, 'VmallocUsed': 302333952, 'Percpu': 215089152, 'HardwareCorrupted': 53248, 'AnonHugePages': 49218060288, 'Hugepagesize': 2097152, 'DirectMap4k': 554131456, 'DirectMap2M': 6434062336, 'DirectMap1G': 199715979264}
def main():
find_and_graph_sums(get_test_set_003(), 'alambix97-meminfo')
main()

22
src/expe001.5-set001.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
from sumfinder import find_and_graph_sums
def get_test_set_001():
return {
'a': 3,
'b': 8,
'c': 11,
'd': 5,
'e': 1,
'f': 2,
'g': 6,
'h': 7
}
def main():
find_and_graph_sums(get_test_set_001(), 'set001')
main()

View File

@ -0,0 +1,4 @@
from .sumfinder import SumExporter # noqa
from .sumfinder import find_sums # noqa
from .sumfinder import sums_to_dot # noqa
from .sumfinder import find_and_graph_sums # noqa

View File

@ -280,29 +280,6 @@ def sums_to_dot(sum_file_path: Path, dot_file_path: Path):
dot_file.write('}\n')
def get_test_set_001():
return {
'a': 3,
'b': 8,
'c': 11,
'd': 5,
'e': 1,
'f': 2,
'g': 6,
'h': 7
}
def get_test_set_002():
# alambix97/20240805-191606-meminfo.stdout
return {'MemTotal': 201214205952, 'MemFree': 803061760, 'MemAvailable': 131466833920, 'Buffers': 31981568, 'Cached': 130939863040, 'SwapCached': 1088724992, 'Active': 103304773632, 'Inactive': 94177337344, 'Active(anon)': 39671312384, 'Inactive(anon)': 26918952960, 'Active(file)': 63633461248, 'Inactive(file)': 67258384384, 'Unevictable': 23019520, 'Mlocked': 19873792, 'SwapTotal': 32765898752, 'Dirty': 8546779136, 'Writeback': 5550080, 'AnonPages': 65442127872, 'Mapped': 120565760, 'Shmem': 69955584, 'KReclaimable': 1252827136, 'Slab': 1991671808, 'SReclaimable': 1252827136, 'SUnreclaim': 738844672, 'KernelStack': 17088512, 'PageTables': 218902528, 'CommitLimit': 133373001728, 'Committed_AS': 141631254528, 'VmallocTotal': 35184372087808, 'VmallocUsed': 302333952, 'Percpu': 215089152, 'HardwareCorrupted': 53248, 'AnonHugePages': 49218060288, 'Hugepagesize': 2097152, 'DirectMap4k': 554131456, 'DirectMap2M': 6434062336, 'DirectMap1G': 199715979264}
def get_test_set_003():
# same as test_set_002 but without VmallocTotal which for some reason causes the program to become extremeley slow (maybe because it's a huge integer ?)
return {'MemTotal': 201214205952, 'MemFree': 803061760, 'MemAvailable': 131466833920, 'Buffers': 31981568, 'Cached': 130939863040, 'SwapCached': 1088724992, 'Active': 103304773632, 'Inactive': 94177337344, 'Active(anon)': 39671312384, 'Inactive(anon)': 26918952960, 'Active(file)': 63633461248, 'Inactive(file)': 67258384384, 'Unevictable': 23019520, 'Mlocked': 19873792, 'SwapTotal': 32765898752, 'Dirty': 8546779136, 'Writeback': 5550080, 'AnonPages': 65442127872, 'Mapped': 120565760, 'Shmem': 69955584, 'KReclaimable': 1252827136, 'Slab': 1991671808, 'SReclaimable': 1252827136, 'SUnreclaim': 738844672, 'KernelStack': 17088512, 'PageTables': 218902528, 'CommitLimit': 133373001728, 'Committed_AS': 141631254528, 'VmallocUsed': 302333952, 'Percpu': 215089152, 'HardwareCorrupted': 53248, 'AnonHugePages': 49218060288, 'Hugepagesize': 2097152, 'DirectMap4k': 554131456, 'DirectMap2M': 6434062336, 'DirectMap1G': 199715979264}
def find_and_graph_sums(variables: Dict[str, int], set_id: str):
# set_id: eg 'set001' 'alambix97-meminfo'
sums_file_path = Path(f'{set_id}-sums.json')
@ -313,11 +290,3 @@ def find_and_graph_sums(variables: Dict[str, int], set_id: str):
sums_to_dot(sums_file_path, dot_file_path)
print(f'creating {svg_file_path} from {dot_file_path}')
subprocess.run(f'dot -Tsvg {dot_file_path} > {svg_file_path}', shell=True, check=True)
def main():
# find_and_graph_sums(get_test_set_001(), 'set001')
find_and_graph_sums(get_test_set_003(), 'alambix97-meminfo')
main()