lkml.org 
[lkml]   [2015]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 33/40] perf session: Separate struct machines from session
Em Tue, May 19, 2015 at 04:28:15PM +0900, Namhyung Kim escreveu:
> On Mon, May 18, 2015 at 09:52:59AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, May 18, 2015 at 09:30:48AM +0900, Namhyung Kim escreveu:
> > > With multi-thread report, separate sessions can be passed to each
> > > thread, in this case we should keep a single machine state for all
> > > struct sessions. Separate machines and have a pointer in sessions.
> >
> > I had to look at all the patch to semi-figure this out, i.e. you said it
> > should be separated from 'perf_session', agreed.
> >
> > But who will create it? How will it be passed to the perf_session
> > instances?
> >
> > Most of the patch is making session->machines be turned into a pointer,
> > but the meat, i.e. who creates it, is unclear, I see a malloc in
> > perf_session__new(), where I was kinda expecting that a higer layer,
> > perhaps in struct tool? Would create the list of all machines (struct
> > machines) and then pass it to multiple perf_session__new() calls.
> >
> > But then perf_session__delete() calls 'free(session->machines)', huh?
>
> OK. So, this is what I have in my head:
>
> perf_tool__create_machines(tool) {
> tool->machines = malloc();
> machines__init(tool->machines);
> }


Probably, but then in this case you would call machines__new(), that
does the malloc and init.

>
> perf_session__new(file, repipe, tool) {
> session->machines = tool->machines;
> ...
> }

That could be ok.

>
> perf_tool__delete_machines(tool) {
> /* call machines-related destructors */
> free(tool->machines);
> }

That would be machines__delete(tool->machines), that calls
machine__exit() and then does the free.

- Arnaldo


\
 
 \ /
  Last update: 2015-05-20 01:01    [W:1.208 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site