第一次接触graphviz,看起来挺简单方便的,以后画状态图之类的可以考虑一下。
把下面代码保存为HTTPStates.dot
#!graphviz
digraph state {
edge [color=green];
connect -> reqstart -> read -> reqend -> handlereq -> respstart -> write -> respend -> connect;
edge [color=grey];
reqend -> readpost -> handlereq [ label="POST" ];
edge [ color=blue];
respend -> reqstart [ label="keep-alive" ];
edge [ color=lightblue];
handlereq -> handlereq [ label="sub-request" ];
edge [style=dashed, color=red];
error -> close -> connect;
error -> connect;
handlereq -> error;
read -> error;
readpost -> error;
write -> error;
connect [shape=box];
}
$dot -Tpng HTTPStates.dot -o HTTPStats.png
就可以得到Lighttpd的状态转换图了。