linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Guillaume Dargaud <dargaud@lpsc.in2p3.fr>
Cc: LinuxPPC-dev <LinuxPPC-dev@ozlabs.org>
Subject: Re: Resources used by driver ?
Date: Mon, 14 Feb 2011 10:38:49 +1100	[thread overview]
Message-ID: <1297640329.9492.15.camel@concordia> (raw)
In-Reply-To: <201102101108.47647.dargaud@lpsc.in2p3.fr>

[-- 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 --]

  reply	other threads:[~2011-02-13 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 10:08 Resources used by driver ? Guillaume Dargaud
2011-02-13 23:38 ` Michael Ellerman [this message]
     [not found] ` <AANLkTin9zsXJX0QrJ2cAZJjAdbGYnQ-S4QCdpzEbrUF_@mail.gmail.com>
2011-02-25 13:01   ` Guillaume Dargaud
2011-02-25 14:18     ` Guillaume Dargaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297640329.9492.15.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=LinuxPPC-dev@ozlabs.org \
    --cc=dargaud@lpsc.in2p3.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).