Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] "pstree" for modules ?
Date: Tue, 27 Sep 2011 19:37:41
Message-Id: 4E82255F.5030700@binarywings.net
In Reply to: [gentoo-user] "pstree" for modules ? by meino.cramer@gmx.de
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"

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] "pstree" for modules ? meino.cramer@×××.de