Re: [PATCH 1/2] perf tool: Refactor comm/tgid lookup

2015-03-30 Thread David Ahern
On 3/30/15 2:01 AM, Jiri Olsa wrote: On Sun, Mar 29, 2015 at 04:30:01PM -0600, David Ahern wrote: SNIP + fd = open(filename, O_RDONLY); + if (fd < 0) { pr_debug("couldn't open %s\n", filename); return 0; } - while (!comm[0] || (tgid <

Re: [PATCH 1/2] perf tool: Refactor comm/tgid lookup

2015-03-30 Thread Jiri Olsa
On Sun, Mar 29, 2015 at 04:30:01PM -0600, David Ahern wrote: SNIP > + fd = open(filename, O_RDONLY); > + if (fd < 0) { > pr_debug("couldn't open %s\n", filename); > return 0; > } > > - while (!comm[0] || (tgid < 0)) { > - if (fgets(bf, s

[PATCH 1/2] perf tool: Refactor comm/tgid lookup

2015-03-29 Thread David Ahern
Rather than parsing /proc/pid/status file one line at a time, read it into a buffer in one shot and search for all strings in one pass. Signed-off-by: David Ahern Cc: Don Zickus Cc: Joe Mario Cc: Jiri Olsa --- tools/perf/util/event.c | 80 +++-- 1 f