Re: [PATCH V2] perf: Speed up thread map generation
From: Namhyung Kim
Date: Sun Mar 16 2014 - 21:46:02 EST
On Fri, 14 Mar 2014 10:43:44 -0400, Don Zickus wrote:
> When trying to capture perf data on a system running spejbb2013,
> perf hung for about 15 minutes. This is because it took that
> long to gather about 10,000 thread maps and process them.
> I don't think a user wants to wait that long.
> Instead, recognize that thread maps are roughly equivalent to
> pid maps and just quickly copy those instead.
> To do this, I synthesize 'fork' events, this eventually calls
> thread__fork() and copies the maps over.
> The overhead goes from 15 minutes down to about a few seconds.
> @@ -416,6 +453,10 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
> if (mmap_event == NULL)
> goto out_free_comm;
> + fork_event = malloc(sizeof(fork_event->fork) + machine->id_hdr_size);
> + if (fork_event == NULL)
> + goto out_free_mmap;
> if (machine__is_default_guest(machine))
> return 0;
Not related to this patch, but this will causes a memory leak..
So I think below patch is needed on top (not sure it's also needed for