public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: loody <miloody@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: how to find a task through name faster?
Date: Mon, 11 Jul 2011 22:16:30 +0200	[thread overview]
Message-ID: <4E1B5A1E.4060604@gmail.com> (raw)
In-Reply-To: <CANudz+vxY_0NY2veJ9Wvr08x_z3e20m=g7ZL4bZDi=-vaOF7dQ@mail.gmail.com>

On 07/11/2011 06:52 PM, loody wrote:
> hi all:
> I found a way to find a task I need by name, test,  as below:
> for_each_process(task) {
>     if(strcmp(task->comm, "test")
>         printk(“%s[%d]\n”, task->comm, task->pid);
> }
> 
> But it is time-consuming to do so if I periodically want to know
> whether "test" exist or not.
> is there better way to do so?

It depends on what you are trying to achieve. Maybe process accounting
is what you want?

-- 
js

  parent reply	other threads:[~2011-07-11 20:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANudz+sqkachOT7r9=-rc98nCEO_QOCx7KiBi5=NWaj5exmEPA@mail.gmail.com>
2011-07-11 16:52 ` how to find a task through name faster? loody
2011-07-11 17:51   ` Chris Friesen
2011-07-11 17:57     ` loody
2011-07-11 18:23       ` Muthu Kumar
2011-07-11 19:39         ` loody
2011-07-11 19:55       ` Chris Friesen
2011-07-11 20:16   ` Jiri Slaby [this message]
2011-07-13  7:55     ` loody
2011-07-13  9:21       ` Jiri Slaby

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=4E1B5A1E.4060604@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miloody@gmail.com \
    /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