Resources used by driver ?

2 messages, 2 authors, 2011-02-13 · open the first message on its own page

Resources used by driver ?

From: Guillaume Dargaud <hidden>
Date: 2011-02-10 10:08:47

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 ?

Thanks
-- 
Guillaume Dargaud
http://www.gdargaud.net/Antarctica/

Re: Resources used by driver ?

From: Michael Ellerman <hidden>
Date: 2011-02-13 23:38:49

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help