linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Resources used by driver ?
@ 2011-02-10 10:08 Guillaume Dargaud
  2011-02-13 23:38 ` Michael Ellerman
       [not found] ` <AANLkTin9zsXJX0QrJ2cAZJjAdbGYnQ-S4QCdpzEbrUF_@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Guillaume Dargaud @ 2011-02-10 10:08 UTC (permalink / raw)
  To: LinuxPPC-dev

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/

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

* Re: Resources used by driver ?
  2011-02-10 10:08 Resources used by driver ? Guillaume Dargaud
@ 2011-02-13 23:38 ` Michael Ellerman
       [not found] ` <AANLkTin9zsXJX0QrJ2cAZJjAdbGYnQ-S4QCdpzEbrUF_@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2011-02-13 23:38 UTC (permalink / raw)
  To: Guillaume Dargaud; +Cc: LinuxPPC-dev

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

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Resources used by driver ?
       [not found] ` <AANLkTin9zsXJX0QrJ2cAZJjAdbGYnQ-S4QCdpzEbrUF_@mail.gmail.com>
@ 2011-02-25 13:01   ` Guillaume Dargaud
  2011-02-25 14:18     ` Guillaume Dargaud
  0 siblings, 1 reply; 4+ messages in thread
From: Guillaume Dargaud @ 2011-02-25 13:01 UTC (permalink / raw)
  To: linuxppc-dev

On Wednesday 16 February 2011 08:01:10 Srivatsan S wrote:
> You can use oprofile to profile the functions of your module. Follow the
> link.
> http://oprofile.sourceforge.net/ <http://oprofile.sourceforge.net/news/>

OK, after some wrestling, I got oprofile installed in my OS (buildroot 2011.02-
rc1) and my kernel (xilinx patches 2.6.35+).

When I start oprofile, I get the following:
# opcontrol --vmlinux=/vmlinux
The specified file /vmlinux does not seem to be valid
Make sure you are using the non-compressed image file (e.g. vmlinux not 
vmlinuz)

# file /vmlinux
/vmlinux: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), 
statically linked, with unknown capability 0x41000000 = 0x11676e75, with 
unknown capability 0x10000 = 0x90402, not stripped

I used the vmlinux generated found in ../linus-2.6-xlnx/vmlinux
What's wrong with it ?
-- 
Guillaume Dargaud
http://www.gdargaud.net/

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

* Re: Resources used by driver ?
  2011-02-25 13:01   ` Guillaume Dargaud
@ 2011-02-25 14:18     ` Guillaume Dargaud
  0 siblings, 0 replies; 4+ messages in thread
From: Guillaume Dargaud @ 2011-02-25 14:18 UTC (permalink / raw)
  To: linuxppc-dev

> When I start oprofile, I get the following:
> # opcontrol --vmlinux=/vmlinux
> The specified file /vmlinux does not seem to be valid
> Make sure you are using the non-compressed image file (e.g. vmlinux not
> vmlinuz)

Sorry, I had an incomplete install of objdump/binutils on my target. I'm now 
trying to understand how to use oprofile.
-- 
Guillaume Dargaud
http://www.gdargaud.net/

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 10:08 Resources used by driver ? Guillaume Dargaud
2011-02-13 23:38 ` Michael Ellerman
     [not found] ` <AANLkTin9zsXJX0QrJ2cAZJjAdbGYnQ-S4QCdpzEbrUF_@mail.gmail.com>
2011-02-25 13:01   ` Guillaume Dargaud
2011-02-25 14:18     ` Guillaume Dargaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).