Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1291000 > unrolled thread

Re: [PATCH/RFC 11/16] perf top: Implement basic parallel processing

Started byJiri Olsa <jolsa@redhat.com>
First post2015-12-14 10:30 +0100
Last post2015-12-15 03:10 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH/RFC 11/16] perf top: Implement basic parallel processing Jiri Olsa <jolsa@redhat.com> - 2015-12-14 10:30 +0100
    Re: [PATCH/RFC 11/16] perf top: Implement basic parallel processing Jiri Olsa <jolsa@redhat.com> - 2015-12-14 10:40 +0100
      Re: [PATCH/RFC 11/16] perf top: Implement basic parallel processing Namhyung Kim <namhyung@kernel.org> - 2015-12-15 03:10 +0100

#1291000 — Re: [PATCH/RFC 11/16] perf top: Implement basic parallel processing

FromJiri Olsa <jolsa@redhat.com>
Date2015-12-14 10:30 +0100
SubjectRe: [PATCH/RFC 11/16] perf top: Implement basic parallel processing
Message-ID<qFxCa-4ar-17@gated-at.bofh.it>
On Thu, Dec 10, 2015 at 04:53:30PM +0900, Namhyung Kim wrote:

SNIP

>  
> -	perf_top__mmap_read(top);
> -
>  	ret = -1;
> -	if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
> -							    display_thread), top)) {
> -		ui__error("Could not create display thread.\n");
> +	readers = calloc(sizeof(pthread_t), top->evlist->nr_mmaps);
> +	if (readers == NULL)
>  		goto out_delete;
> -	}
>  
> -	if (top->realtime_prio) {
> -		struct sched_param param;
> +	rargs = calloc(sizeof(*rargs), top->evlist->nr_mmaps);
> +	if (rargs == NULL)
> +		goto out_free;
>  
> -		param.sched_priority = top->realtime_prio;
> -		if (sched_setscheduler(0, SCHED_FIFO, &param)) {
> -			ui__error("Could not set realtime priority.\n");
> -			goto out_join;
> -		}
> +	hists = calloc(sizeof(*hists), top->evlist->nr_mmaps * top->evlist->nr_entries);
> +	if (hists == NULL)
> +		goto out_free;
> +
> +	for (i = 0; i < top->evlist->nr_mmaps * top->evlist->nr_entries; i++)
> +		__hists__init(&hists[i]);
> +
> +	for (i = 0; i < top->evlist->nr_mmaps; i++) {
> +		struct reader_arg *rarg = &rargs[i];
> +
> +		rarg->idx = i;
> +		rarg->top = top;
> +		rarg->hists = &hists[i * top->evlist->nr_entries];
> +
> +		perf_top__mmap_read(rarg);
>  	}
> +	collect_hists(top, hists);

hum, what's the reason for calling perf_top__mmap_read
and collect_hists in here?

also calling collect_hists on hists array pointer seems wrong

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1291004

FromJiri Olsa <jolsa@redhat.com>
Date2015-12-14 10:40 +0100
Message-ID<qFxLP-4dP-1@gated-at.bofh.it>
In reply to#1291000
On Mon, Dec 14, 2015 at 10:23:43AM +0100, Jiri Olsa wrote:
> On Thu, Dec 10, 2015 at 04:53:30PM +0900, Namhyung Kim wrote:
> 
> SNIP
> 
> >  
> > -	perf_top__mmap_read(top);
> > -
> >  	ret = -1;
> > -	if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
> > -							    display_thread), top)) {
> > -		ui__error("Could not create display thread.\n");
> > +	readers = calloc(sizeof(pthread_t), top->evlist->nr_mmaps);
> > +	if (readers == NULL)
> >  		goto out_delete;
> > -	}
> >  
> > -	if (top->realtime_prio) {
> > -		struct sched_param param;
> > +	rargs = calloc(sizeof(*rargs), top->evlist->nr_mmaps);
> > +	if (rargs == NULL)
> > +		goto out_free;
> >  
> > -		param.sched_priority = top->realtime_prio;
> > -		if (sched_setscheduler(0, SCHED_FIFO, &param)) {
> > -			ui__error("Could not set realtime priority.\n");
> > -			goto out_join;
> > -		}
> > +	hists = calloc(sizeof(*hists), top->evlist->nr_mmaps * top->evlist->nr_entries);
> > +	if (hists == NULL)
> > +		goto out_free;
> > +
> > +	for (i = 0; i < top->evlist->nr_mmaps * top->evlist->nr_entries; i++)
> > +		__hists__init(&hists[i]);
> > +
> > +	for (i = 0; i < top->evlist->nr_mmaps; i++) {
> > +		struct reader_arg *rarg = &rargs[i];
> > +
> > +		rarg->idx = i;
> > +		rarg->top = top;
> > +		rarg->hists = &hists[i * top->evlist->nr_entries];
> > +
> > +		perf_top__mmap_read(rarg);
> >  	}
> > +	collect_hists(top, hists);
> 
> hum, what's the reason for calling perf_top__mmap_read
> and collect_hists in here?

nah it's for initial data so ui thread has something to display right? ;-)

> 
> also calling collect_hists on hists array pointer seems wrong

still 'collect_hists(&hists[0]);' would seem more review friendly

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1291774

FromNamhyung Kim <namhyung@kernel.org>
Date2015-12-15 03:10 +0100
Message-ID<qFNdT-67l-5@gated-at.bofh.it>
In reply to#1291004
On Mon, Dec 14, 2015 at 10:35:19AM +0100, Jiri Olsa wrote:
> On Mon, Dec 14, 2015 at 10:23:43AM +0100, Jiri Olsa wrote:
> > On Thu, Dec 10, 2015 at 04:53:30PM +0900, Namhyung Kim wrote:
> > 
> > SNIP
> > 
> > >  
> > > -	perf_top__mmap_read(top);
> > > -
> > >  	ret = -1;
> > > -	if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
> > > -							    display_thread), top)) {
> > > -		ui__error("Could not create display thread.\n");
> > > +	readers = calloc(sizeof(pthread_t), top->evlist->nr_mmaps);
> > > +	if (readers == NULL)
> > >  		goto out_delete;
> > > -	}
> > >  
> > > -	if (top->realtime_prio) {
> > > -		struct sched_param param;
> > > +	rargs = calloc(sizeof(*rargs), top->evlist->nr_mmaps);
> > > +	if (rargs == NULL)
> > > +		goto out_free;
> > >  
> > > -		param.sched_priority = top->realtime_prio;
> > > -		if (sched_setscheduler(0, SCHED_FIFO, &param)) {
> > > -			ui__error("Could not set realtime priority.\n");
> > > -			goto out_join;
> > > -		}
> > > +	hists = calloc(sizeof(*hists), top->evlist->nr_mmaps * top->evlist->nr_entries);
> > > +	if (hists == NULL)
> > > +		goto out_free;
> > > +
> > > +	for (i = 0; i < top->evlist->nr_mmaps * top->evlist->nr_entries; i++)
> > > +		__hists__init(&hists[i]);
> > > +
> > > +	for (i = 0; i < top->evlist->nr_mmaps; i++) {
> > > +		struct reader_arg *rarg = &rargs[i];
> > > +
> > > +		rarg->idx = i;
> > > +		rarg->top = top;
> > > +		rarg->hists = &hists[i * top->evlist->nr_entries];
> > > +
> > > +		perf_top__mmap_read(rarg);
> > >  	}
> > > +	collect_hists(top, hists);
> > 
> > hum, what's the reason for calling perf_top__mmap_read
> > and collect_hists in here?
> 
> nah it's for initial data so ui thread has something to display right? ;-)

Right, the logic was already there.  Without it, the initial update
(after 2 seconds) looks too long for users.


> 
> > 
> > also calling collect_hists on hists array pointer seems wrong
> 
> still 'collect_hists(&hists[0]);' would seem more review friendly

Will change!

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web