Resources used by driver ?

Michael Ellerman michael at ellerman.id.au
Mon Feb 14 10:38:49 EST 2011


On Thu, 2011-02-10 at 11:08 +0100, Guillaume Dargaud wrote:
> Thanks to the advice I received here, I now have my first 'real' Linux driver 
> up and running and am now at the optimization stage.
> 
> Is it possible to see the resources consumed by a module ? They don't show in 
> 'ps/top' but I'm sure there are ways to see how much memory it uses (to check 
> for memory leaks) and how much CPU it takes. How ?

Hi Guillaume,

It's actually not that easy to measure the resources used by a driver.
In general your driver code only runs on behalf of another process, and
so that process is where the cpu usage will be accounted.

One exception is if your driver spawns a kernel thread for something, in
that case you can see it with top.

For memory usage, you can monitor /proc/slabinfo and see if anything is
growing every time you access your driver. Another option is to enable
CONFIG_DEBUG_KMEMLEAK, which will try and detect real leaks for you.

cheers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20110214/f7f87524/attachment.pgp>


More information about the Linuxppc-dev mailing list