lkml.org 
[lkml]   [2012]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf tools: Allow multiple threads or processes in record, stat, top
On 02/08/2012 10:36 PM, Namhyung Kim wrote:
> Oh, I meant this:
>
> static struct thread_map *thread_map__new_by_pid_str(const char *pid_str)
> {
> ...
> while (*str) {
> ...
> tmp = thread_map__new_by_pid(pid);
> ...
> }
> ...
> }
>
> static struct thread_map *thread_map__new_by_tid_str(const char *tid_str)
> {
> ...
> while (*str) {
> ...
> tmp = thread_map__new_by_tid(tid);
> ...
> }
> ...
> }


I'm still not seeing the code simplification here. For example,
new_by_tid(tid) allocates threads, sets the first element (it only
supports one) and returns it. In new_by_tid_str we loop over a CSV,
allocating/re-allocating on additional and then setting the current i-th
tid as opposed to the 0th element.

Similarly, for pid.

Personally, I liked my first patch better which dropped the current
tid/pid functions; they are only used by perf-test and it can be updated
to convert getpid() to a string and use the new API.

David


\
 
 \ /
  Last update: 2012-02-09 07:07    [W:0.086 / U:1.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site