Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] "pstree" for modules ?
Date: Wed, 28 Sep 2011 03:13:24
Message-Id: 20110928031212.GA8168@solfire
In Reply to: Re: [gentoo-user] "pstree" for modules ? by Florian Philipp
1 Florian Philipp <lists@×××××××××××.net> [11-09-28 04:05]:
2 > Am 27.09.2011 20:24, schrieb meino.cramer@×××.de:
3 > > Hi,
4 > >
5 > > ist there a tool, which displays the dependencies of loaded modules as
6 > > a tree like pstree does for tasks?
7 > >
8 > > Thank you very much for any help in advance! :)
9 > >
10 > > Best regards
11 > > mcc
12 > >
13 > >
14 > >
15 >
16 > Well, it's not a tool and it cannot print to terminal but you might want
17 > to try out the bash skript below. It depends on media-gfx/graphviz to
18 > create a postscript file visualizing the dependencies. The file will be
19 > opened by your default postscript viewer (evince, okular, etc.).
20 >
21 > Hope this helps,
22 > Florian Philipp
23 >
24 > psFile=$(tempfile --suffix=.ps)
25 > lsmod | tail -n +2 | awk '{print $1,$4}' | tr ' ,' ' ' |
26 > (
27 > echo 'digraph modules { rankdir=LR; '
28 > while read line; do
29 > dependencies=( $line )
30 > dependingOn="${dependencies[0]}"
31 > unset dependencies[0]
32 > for dependant in "${dependencies[@]}"; do
33 > echo "\"$dependant\" -> \"$dependingOn\";"
34 > done
35 > done
36 > echo '}'
37 > ) | dot -Tps > "$psFile"
38 > xdg-open "$psFile"
39 > unlink "$psFile"
40 >
41
42 Hi Florian,
43
44 thank you for your mail and the script.
45 Unfortunately this is a little of a Lambourghini
46 solution where a bicycle would completly suffice... ;)
47
48 I had searched for a terminal related tool as pstree.
49
50 Best regards,
51 mcc

Replies

Subject Author
Re: [gentoo-user] "pstree" for modules ? Florian Philipp <lists@×××××××××××.net>