Re: Specifying some processes to record using perf

From: David Ahern
Date: Sun Feb 05 2012 - 12:47:38 EST



On 02/05/2012 07:23 AM, Arnaldo Carvalho de Melo wrote:
> Em Sat, Feb 04, 2012 at 04:19:59PM -0700, David Ahern escreveu:
>> On 02/02/2012 09:33 AM, David Ahern wrote:
>>>
>>> On 02/02/2012 08:52 AM, Jean-Michel Hautbois wrote:
>>>> Hi all,
>>>>
>>>> I am using perf and I have several process and threads to record.
>>>> I know that some threads in particular are interesting, and I don't
>>>> find a way to specify multiple threads in perf record.
>>>> The "-t" option takes only one thread IIUC.
>>
>> Found some time on the plane ride home to give this a shot. The attached
>> applies on top of the perf/core branch in:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>
>> You can specify multiple threads or multiple processing using a
>> comma-separated list. e.g., -t tid1,tid2,... or -p pid1,pid2,... (not both).
>>
>> It still needs more testing, but let me know how it works for what you need.
>>
>> Arnaldo: would you mind scanning this and see if there are any major
>> problems/objections with the approach?
>
> It looks ok, but I wouldn't remove the existing specialized thread_map
> constructors, i.e. no need to first transform getpid() into an string to
> then pass to a generic constructor that would then back convert it into
> a pid_t :-)

Only perf-test does that; all the rest take pid/tid from the user.

>
> Just add new constructors for CSV strings, like:
>
> struct thread_map *thread_map__new_by_pids(const char *pid_list);
>
> struct thread_map *thread_map__new_by_tids(const char *pid_list);
>
> with the expected results, i.e. they would just tokenize and call the
> more basic constructors, at least in the by_pids, then concatenating the
> results, etc.

Ok. I can leave the existing ones. I did not want that interface to get
too complicated; with this change it will be easy to remove the 'or' and
allow a user to specify multiple thread ids and multiple process ids.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/