4 echo "EXAMPLE (whole tree) : $0 | neato -T png > ps.png && open ps.png"
5 echo "EXAMPLE (user clusters): $0 | sdp -T png > ps.png && open ps.png"
10 awk -v kernel
="$(uname -v)" -v whoami
="$(whoami)" \
12 function num_scale(src_cur, src_max, dst_min, dst_max) {
13 return dst_min + ((src_cur * (dst_max - dst_min)) / src_max)
16 function vert_print(v, _color) {
19 parent2child_count[v],
24 fontcolor = _color >= 5 ? 1 : 9
29 , fontname=Helvetica \
45 function edge_print(child, _parent, _color) {
46 _parent = child2parent[child]
49 parent2child_count[_parent],
57 , fontname=Helvetica \
71 # Good gradient colorschemes:
79 child2cmd[0] = "swapper/sched"
83 parent2child_count[$2]++
85 parent2child_count[$2] > max_children\
86 ? parent2child_count[$2]\
89 child2user_id[$1] = $3
90 child2user_name[$1] = $4
96 print "strict digraph G {";
100 print "fontname=Helvetica;";
101 print "label=\"" kernel "\";";
102 printf "colorscheme=%s;\n", COLORSCHEME
105 ##### Vertices (clustered by user)
106 for (user_name in user_names) {
107 printf "subgraph \"cluster_%s\" {\n", user_name
108 printf "label=\"%s\"\n", user_name
109 for (c in child2parent)
110 if (child2user_name[c] == user_name)
115 ##### Vertices (without a user)
117 if (!child2user_name[c])
120 ##### Edges (across clusters)
121 for (c in child2parent)
131 if [ "$(uname)" = 'Linux' ]; then
132 ps
-eo pid
,ppid
,euid
,euser
,comm
134 ps
-eco pid
,ppid
,euid
,euser
,comm
143 *) procs |
grep "$1" | compile
This page took 0.061981 seconds and 4 git commands to generate.