1 |
Am 27.09.2011 20:24, schrieb meino.cramer@×××.de: |
2 |
> Hi, |
3 |
> |
4 |
> ist there a tool, which displays the dependencies of loaded modules as |
5 |
> a tree like pstree does for tasks? |
6 |
> |
7 |
> Thank you very much for any help in advance! :) |
8 |
> |
9 |
> Best regards |
10 |
> mcc |
11 |
> |
12 |
> |
13 |
> |
14 |
|
15 |
Well, it's not a tool and it cannot print to terminal but you might want |
16 |
to try out the bash skript below. It depends on media-gfx/graphviz to |
17 |
create a postscript file visualizing the dependencies. The file will be |
18 |
opened by your default postscript viewer (evince, okular, etc.). |
19 |
|
20 |
Hope this helps, |
21 |
Florian Philipp |
22 |
|
23 |
psFile=$(tempfile --suffix=.ps) |
24 |
lsmod | tail -n +2 | awk '{print $1,$4}' | tr ' ,' ' ' | |
25 |
( |
26 |
echo 'digraph modules { rankdir=LR; ' |
27 |
while read line; do |
28 |
dependencies=( $line ) |
29 |
dependingOn="${dependencies[0]}" |
30 |
unset dependencies[0] |
31 |
for dependant in "${dependencies[@]}"; do |
32 |
echo "\"$dependant\" -> \"$dependingOn\";" |
33 |
done |
34 |
done |
35 |
echo '}' |
36 |
) | dot -Tps > "$psFile" |
37 |
xdg-open "$psFile" |
38 |
unlink "$psFile" |