public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] "pstree" for modules ?
@ 2011-09-27 18:24 meino.cramer
  2011-09-27 19:34 ` Florian Philipp
  0 siblings, 1 reply; 6+ messages in thread
From: meino.cramer @ 2011-09-27 18:24 UTC (permalink / raw
  To: Gentoo

Hi,

ist there a tool, which displays the dependencies of loaded modules as
a tree like pstree does for tasks?

Thank you very much for any help in advance! :)

Best regards
mcc





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] "pstree" for modules ?
  2011-09-27 18:24 [gentoo-user] "pstree" for modules ? meino.cramer
@ 2011-09-27 19:34 ` Florian Philipp
  2011-09-28  3:12   ` meino.cramer
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Philipp @ 2011-09-27 19:34 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Am 27.09.2011 20:24, schrieb meino.cramer@gmx.de:
> Hi,
> 
> ist there a tool, which displays the dependencies of loaded modules as
> a tree like pstree does for tasks?
> 
> Thank you very much for any help in advance! :)
> 
> Best regards
> mcc
> 
> 
> 

Well, it's not a tool and it cannot print to terminal but you might want
to try out the bash skript below. It depends on media-gfx/graphviz to
create a postscript file visualizing the dependencies. The file will be
opened by your default postscript viewer (evince, okular, etc.).

Hope this helps,
Florian Philipp

psFile=$(tempfile --suffix=.ps)
lsmod | tail -n +2 | awk '{print $1,$4}' | tr ' ,' ' ' |
(
  echo 'digraph modules { rankdir=LR; '
    while read line; do
      dependencies=( $line )
      dependingOn="${dependencies[0]}"
      unset dependencies[0]
      for dependant in "${dependencies[@]}"; do
        echo "\"$dependant\" -> \"$dependingOn\";"
      done
    done
    echo '}'
) | dot -Tps > "$psFile"
xdg-open "$psFile"
unlink "$psFile"


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] "pstree" for modules ?
  2011-09-27 19:34 ` Florian Philipp
@ 2011-09-28  3:12   ` meino.cramer
  2011-09-28  7:42     ` Florian Philipp
  0 siblings, 1 reply; 6+ messages in thread
From: meino.cramer @ 2011-09-28  3:12 UTC (permalink / raw
  To: gentoo-user

Florian Philipp <lists@binarywings.net> [11-09-28 04:05]:
> Am 27.09.2011 20:24, schrieb meino.cramer@gmx.de:
> > Hi,
> > 
> > ist there a tool, which displays the dependencies of loaded modules as
> > a tree like pstree does for tasks?
> > 
> > Thank you very much for any help in advance! :)
> > 
> > Best regards
> > mcc
> > 
> > 
> > 
> 
> Well, it's not a tool and it cannot print to terminal but you might want
> to try out the bash skript below. It depends on media-gfx/graphviz to
> create a postscript file visualizing the dependencies. The file will be
> opened by your default postscript viewer (evince, okular, etc.).
> 
> Hope this helps,
> Florian Philipp
> 
> psFile=$(tempfile --suffix=.ps)
> lsmod | tail -n +2 | awk '{print $1,$4}' | tr ' ,' ' ' |
> (
>   echo 'digraph modules { rankdir=LR; '
>     while read line; do
>       dependencies=( $line )
>       dependingOn="${dependencies[0]}"
>       unset dependencies[0]
>       for dependant in "${dependencies[@]}"; do
>         echo "\"$dependant\" -> \"$dependingOn\";"
>       done
>     done
>     echo '}'
> ) | dot -Tps > "$psFile"
> xdg-open "$psFile"
> unlink "$psFile"
> 

Hi Florian,

thank you for your mail and the script.
Unfortunately this is a little of a Lambourghini
solution where a bicycle would completly suffice... ;)

I had searched for a terminal related tool as pstree.

Best regards,
mcc




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] "pstree" for modules ?
  2011-09-28  3:12   ` meino.cramer
@ 2011-09-28  7:42     ` Florian Philipp
  2011-09-28 10:41       ` Willie Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Philipp @ 2011-09-28  7:42 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

Am 28.09.2011 05:12, schrieb meino.cramer@gmx.de:
> Florian Philipp <lists@binarywings.net> [11-09-28 04:05]:
>> Am 27.09.2011 20:24, schrieb meino.cramer@gmx.de:
>>> Hi,
>>>
>>> ist there a tool, which displays the dependencies of loaded modules as
>>> a tree like pstree does for tasks?
>>>
>>> Thank you very much for any help in advance! :)
>>>
>>> Best regards
>>> mcc
>>>
>>>
>>>
>>
>> Well, it's not a tool and it cannot print to terminal but you might want
>> to try out the bash skript below. It depends on media-gfx/graphviz to
>> create a postscript file visualizing the dependencies. The file will be
>> opened by your default postscript viewer (evince, okular, etc.).
>>
[...]
> 
> Hi Florian,
> 
> thank you for your mail and the script.
> Unfortunately this is a little of a Lambourghini
> solution where a bicycle would completly suffice... ;)
> 
> I had searched for a terminal related tool as pstree.
> 
> Best regards,
> mcc
> 
> 

The problem with doing this non-graphically is that module dependencies
do not form a tree. They form a graph (multiple parents per child,
multiple childs per parent). Visualizing this likely exceeds the graphic
capabilities of terminals (you note that even with graphviz' advanced
automatic arrangement, there are still lines that cross half the image).

You could still create a tree, but only by making most modules appear
multiple times.

Regards,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] "pstree" for modules ?
  2011-09-28  7:42     ` Florian Philipp
@ 2011-09-28 10:41       ` Willie Wong
  2011-09-28 14:17         ` Albert W. Hopkins
  0 siblings, 1 reply; 6+ messages in thread
From: Willie Wong @ 2011-09-28 10:41 UTC (permalink / raw
  To: gentoo-user

On Wed, Sep 28, 2011 at 09:42:09AM +0200, Florian Philipp wrote:
> You could still create a tree, but only by making most modules appear
> multiple times.

Just like the '--tree' option for 'emerge'

W

-- 
Willie W. Wong                                     wwong@math.princeton.edu
Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire 
         et vice versa   ~~~  I. Newton



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] "pstree" for modules ?
  2011-09-28 10:41       ` Willie Wong
@ 2011-09-28 14:17         ` Albert W. Hopkins
  0 siblings, 0 replies; 6+ messages in thread
From: Albert W. Hopkins @ 2011-09-28 14:17 UTC (permalink / raw
  To: gentoo-user

On Wed, 2011-09-28 at 06:41 -0400, Willie Wong wrote:
> On Wed, Sep 28, 2011 at 09:42:09AM +0200, Florian Philipp wrote:
> > You could still create a tree, but only by making most modules appear
> > multiple times.
> 
> Just like the '--tree' option for 'emerge'


In that case something like:

        # for m in `lsmod |awk '{print $1}'; do echo $m; modprobe \
          --show-depends $m|sed s'/^insmod \/.*\//  `-/;s/\.ko//'; done





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-28 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-27 18:24 [gentoo-user] "pstree" for modules ? meino.cramer
2011-09-27 19:34 ` Florian Philipp
2011-09-28  3:12   ` meino.cramer
2011-09-28  7:42     ` Florian Philipp
2011-09-28 10:41       ` Willie Wong
2011-09-28 14:17         ` Albert W. Hopkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox