Dot: Difference between revisions

No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
If nothing else, remember that '''subgraphs must start with "cluster", yes in their identifier name, to be visually distinguishable i.e. apply label/color''' augh.
==SVG==
==SVG==
* graphviz tools generate svg via -Tsvg
* graphviz tools generate svg via -Tsvg
* [http://github.com/vidarh/diagram-tools notugly] is some XSL to beautify dot's SVG output
* [http://github.com/vidarh/diagram-tools notugly] is some XSL to beautify dot's SVG output
==Examples==
==Examples==
Generated using Graphviz 2.20.2 and postprocessing via <tt>xsltproc</tt> and [http://github.com/vidarh/diagram-tools notugly]. I hand-wrote the dot sources.
===Packed Record===
===Packed Record===
[[Image:Opteron.svg|right|alt="Dot SVG example (packed record)"|A packed record-type node]]
[[Image:Opteron.svg|thumb|right|alt="Dot SVG example (packed record)"|A packed record-type node (click to enlarge)]]
<pre>digraph G {
<pre>digraph G {
subgraph clusterOpteron {
subgraph clusterOpteron {
Line 15: Line 18:


===Rectilinear arrangement A===
===Rectilinear arrangement A===
[[Image:Deneb.svg|left|alt="Dot SVG example (rectilinear)"|A rectilinear graph]]
[[Image:Deneb.svg|thumb|right|alt="Dot SVG example (rectilinear)"|A rectilinear graph (click to enlarge)]]
<pre>digraph G {
<pre>digraph G {
subgraph clusterOpteronNUMA {
subgraph clusterOpteronNUMA {
Line 35: Line 38:


===Rectilinear arrangement B===
===Rectilinear arrangement B===
[[Image:Nehalem.svg|thumb|right|alt="Dot SVG example (rectilinear)"|A rectilinear graph  (click to enlarge)]]
<pre>digraph G {
<pre>digraph G {
nodesep="1"
nodesep="1"
Line 73: Line 77:
DDR1 [style=filled fillcolor=grey shape=trapezium]
DDR1 [style=filled fillcolor=grey shape=trapezium]
HostBus [style=filled fillcolor=green shape=Msquare]
HostBus [style=filled fillcolor=green shape=Msquare]
}
} </pre>
===Large flow===
[[Image:libtorque.svg|thumb|right|alt="DOT SVG example (large flow)"|A large flow (click to enlarge)]]
<pre>digraph G {
nodesep="0.5"
subgraph clusterPrime {
labelloc="b";
compound="true"
subgraph clusterKernel {
label="Kernelspace (Linux epoll, FreeBSD kqueue, etc...)"
style=filled;
color=cadetblue;
wqueue0 [style=filled fillcolor=steelblue shape=Mdiamond]
wqueueN [style=filled fillcolor=steelblue shape=Mdiamond]
wqueue0 -> nics [dir=both]
nics [style="filled,diagonals" fillcolor=greenyellow label="Devices/IPC"]
nics -> wqueueN [dir=both]
{ rank=same; wqueue0 wqueueN nics }
}
subgraph clusterUser {
label="Userspace (libtorque-enabled process)";
style=filled;
color=gold;
evqueueN [style="diagonals,filled" fillcolor=mediumpurple shape=invtrapezium group="evq"]
evqueue0 [style="diagonals,filled" fillcolor=mediumpurple shape=invtrapezium group="evq"]
wqueue0 -> evqueue0 [dir=both style=bold color="blue:purple"]
wqueueN -> evqueueN [dir=both style=bold color="blue:purple"]
evqueue0 -> evqueueN [label="About sqrt(cpus) evqueues, usually" dir=both style=dotted color=maroon]
API -> evqueue0 [style=bold color=purple]
API -> evqueueN [style=bold color=purple]
API [style=filled fillcolor=green shape=box group="evq"];
{ rank=same; evqueue0 evqueueN }
node [shape=record];
thr0 [label="<t0>T0|<t1>T1|<t2>T2|<tN>TN"];
thrN [label="<t0>T0|<t1>T1|<t2>T2|<tN>TN"];
color=red;
evqueue0 -> thr0:t0 [color=blue]
evqueue0 -> thr0:t1 [color=blue]
evqueue0 -> thr0:t2 [color=blue]
evqueue0 -> thr0:tN [color=blue]
evqueueN -> thrN:t0 [color=blue]
evqueueN -> thrN:t1 [color=blue]
evqueueN -> thrN:t2 [color=blue]
evqueueN -> thrN:tN [color=blue]
{ rank=same; thr0 thrN }
thr0 -> sigtable [color=lightblue style=bold]
thr0 -> fdtable [color=lightblue style=bold]
thr0 -> twheel [color=lightblue style=bold]
thrN -> sigtable [color=lightblue style=bold]
thrN -> fdtable [color=lightblue style=bold]
thrN -> twheel [color=lightblue style=bold]
fdtable [style=filled fillcolor=lightgreen shape=box label="fd monads\n(array)"]
twheel [style=filled fillcolor=lightgreen shape=box label="timer monads\n(hwheel or array)"]
sigtable [style=filled fillcolor=lightgreen shape=box label="sig monads\n(array)"]
sigtable -> fdtable [color=lightblue label="AIO"]
fdtable -> buf [color=lightblue]
fdtable -> dnsssl [color=lightblue]
twheel -> dnsssl [color=lightblue]
buf -> API
{ rank=same; sigtable fdtable twheel }
dnsssl -> API
dnsssl [style=filled fillcolor=lightgreen shape=box label="DNS, SSL/TLS\n(adns, OpenSSL)"]
buf [style=filled fillcolor=lightgreen shape=box label="Buffering\n(arch-adaptive)"]
node [shape=record];
appthr [label="<tmain>Main\nthread|<t1>T1|<t2>T2|<tN>TN"];
cbs [style=filled fillcolor=orange shape=box label="Registered callbacks"];
cbs -> appthr [dir=both color=darkgreen]
sigtable -> cbs [color=green]
fdtable -> cbs [color=green]
twheel -> cbs [color=green]
buf -> cbs [color=green]
dnsssl -> cbs [color=green]
cbs -> API;
appthr -> API;
/*API -> fdtable [color=blueviolet]
API -> sigtable [color=blueviolet]
API -> twheel [color=blueviolet]*/
}
}
} </pre>
==PNG==
Generated with <tt>dot -Tpng</tt>, no postprocessing.
===Multiple records===
[[Image:CUDASHA1input.png|thumb|right|alt="DOT PNG example (multiple records)"|Multiple records (click to enlarge)]]
<pre>digraph G {
nodesep="0.1"
rankdir=RL;
subgraph clusterPrime {
label="SHA-1 input layout\ (b\ hashes\ per\ thread)\nNx1x1 block geometry,\ Gx1x1\ grid\ geometry";
labelloc="b";
compound="true"
subgraph clusterKernel {
color=darkgoldenrod;
style=filled;
label="bl0";
b0 [style=filled,width=5,shape=record,label="{ {Hash\ set\ 1\n(512n\ bits)}\
                        |{T0[0x0]|T0[0x1]|T0[...]|T0[0xf]}|{T1[0x0]|T1[0x1]|T1[...]|T1[0xf]}|{...|...|...|...}|{Tn[0x0]|Tn[0x1]|Tn[...]|Tn[0xf]}}"];
b1 [style=filled,width=5,shape=record,label="{ {Hash\ set\ b\n(512n\ bits)}\
                        |{T0[0x0]|T0[0x1]|T0[...]|T0[0xf]}|{T1[0x0]|T1[0x1]|T1[...]|T1[0xf]}|{...|...|...|...}|{Tn[0x0]|Tn[0x1]|Tn[...]|Tn[0xf]}}"];
label="Input to block 1 (512*n*b bits)";
}
subgraph clusterUser {
color=darkkhaki;
style=filled;
label="bl0";
b2 [style=filled,width=5,shape=record,label="{ {Hash\ set\ 1\n(512n\ bits)}\
                        |{T0[0x0]|T0[0x1]|T0[...]|T0[0xf]}|{T1[0x0]|T1[0x1]|T1[...]|T1[0xf]}|{...|...|...|...}|{Tn[0x0]|Tn[0x1]|Tn[...]|Tn[0xf]}}"];
b3 [style=filled,width=5,shape=record,label="{ {Hash\ set\ b\n(512n\ bits)}\
                        |{T0[0x0]|T0[0x1]|T0[...]|T0[0xf]}|{T1[0x0]|T1[0x1]|T1[...]|T1[0xf]}|{...|...|...|...}|{Tn[0x0]|Tn[0x1]|Tn[...]|Tn[0xf]}}"];
label="Input to block G (512*n*b bits)";
}
}
}
} </pre>
} </pre>