lkml.org 
[lkml]   [2019]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 4/7] perf diff: Use hists to manage basic blocks per symbol
On Mon, Jun 24, 2019 at 10:49:25PM +0800, Jin, Yao wrote:
>
>
> On 6/24/2019 3:57 PM, Jiri Olsa wrote:
> > On Thu, Jun 20, 2019 at 10:36:39PM +0800, Jin Yao wrote:
> >
> > SNIP
> >
> > > +
> > > +static void *block_entry_zalloc(size_t size)
> > > +{
> > > + return zalloc(size + sizeof(struct hist_entry));
> > > +}
> > > +
> > > +static void block_entry_free(void *he)
> > > +{
> > > + struct block_info *bi = ((struct hist_entry *)he)->block_info;
> > > +
> > > + block_info__put(bi);
> > > + free(he);
> > > +}
> > > +
> > > +struct hist_entry_ops block_entry_ops = {
> > > + .new = block_entry_zalloc,
> > > + .free = block_entry_free,
> > > +};
> >
> > hum, so there's already block_hist_ops moving that stuff into 'struct block_hist',
> > which is great, but why don't we have 'struct block_entry' in here? that would
> > keep the 'struct block_info'
> >
> > thanks,
> > jirka
> >
>
> Hi Jiri,
>
> If I define 'struct block_entry' as following and cast 'he' to 'struct
> block_entry' in some places, such as in block_cmp(), we can get the 'struct
> block_entry'.
>
> struct block_entry {
> struct block_info bi;
> struct hist_entry he;
> };
>
> But I don't know when I can set the 'bi' of 'struct block_entry'. Before or
> after calling hists__add_entry_xxx()? Before calling hists__add_entry_xxx(),
> we don't know the hist_entry. After calling hists__add_entry_xxx(), actually
> the hist_entry__cmp doesn't work (no bi ).
>
> That's why I create block_info in hist_entry. Maybe I misunderstand what
> your suggested, correct me if I'm wrong.

ah you need the data already in place when calling hists__add_entry_block,
because of the block_cmp sorting function.. ok, it's the same tyhing we
do in c2c with mem_info.. I guess we can survive one pointer

I'll check the rest

thanks,
jirka

\
 
 \ /
  Last update: 2019-06-25 10:52    [W:0.046 / U:17.308 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site