lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Oct 2017 16:57:09 +0000
From:   "Liang, Kan" <kan.liang@...el.com>
To:     Jiri Olsa <jolsa@...hat.com>
CC:     "acme@...nel.org" <acme@...nel.org>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "jolsa@...nel.org" <jolsa@...nel.org>,
        "wangnan0@...wei.com" <wangnan0@...wei.com>,
        "hekuang@...wei.com" <hekuang@...wei.com>,
        "namhyung@...nel.org" <namhyung@...nel.org>,
        "alexander.shishkin@...ux.intel.com" 
        <alexander.shishkin@...ux.intel.com>,
        "Hunter, Adrian" <adrian.hunter@...el.com>,
        "ak@...ux.intel.com" <ak@...ux.intel.com>
Subject: RE: [PATCH V2 4/5] perf record: synthesize event multithreading
 support

> On Wed, Oct 18, 2017 at 07:29:32AM -0700, kan.liang@...el.com wrote:
> 
> SNIP
> 
> > +	rec->synthesized_file = calloc(nr_thread, sizeof(struct
> perf_data_file));
> > +	if (rec->synthesized_file == NULL) {
> > +		pr_debug("Could not do multithread synthesize."
> > +			 "Roll back to single thread\n");
> > +		nr_thread = 1;
> > +	} else {
> > +		perf_set_multithreaded();
> > +		for (i = 0; i < nr_thread; i++) {
> > +			snprintf(name, sizeof(name), "%s.%d",
> > +				 SYNTHESIZED_PATH, i);
> 
> hum, I think we want some uniq temp names in here..

Any suggestions for the name?
perf.tmp.X?

> 
> > +			rec->synthesized_file[i].path = name;
> > +			err = perf_data_file__open(&rec->synthesized_file[i]);
> > +			if (err) {
> > +				pr_err("Failed to open file %s\n",
> > +				       rec->synthesized_file[i].path);
> > +				goto free;
> > +			}
> > +		}
> > +	}
> > +
> > +	err = __machine__synthesize_threads(machine, tool, &opts->target,
> > +					    rec->evlist->threads,
> > +					    process_synthesized_event,
> > +					    opts->sample_address,
> > +					    opts->proc_map_timeout,
> nr_thread);
> > +	if (err < 0)
> > +		goto free;
> > +
> > +	if (nr_thread > 1) {
> > +		int fd_from, fd_to;
> > +
> > +		fd_to = rec->session->file->fd;
> > +		for (i = 0; i < nr_thread; i++) {
> > +			fd_from = rec->synthesized_file[i].fd;
> > +
> > +			fstat(fd_from, &st);
> > +			if (st.st_size == 0)
> > +				continue;
> > +			err = copyfile_offset(fd_from, 0, fd_to,
> > +					      lseek(fd_to, 0, SEEK_END),
> > +					      st.st_size);
> > +			update_bytes_written(rec, st.st_size);
> > +		}
> > +	}
> > +
> > +free:
> > +	if (nr_thread > 1) {
> > +		for (i = 0; i < nr_thread; i++) {
> > +			if (rec->synthesized_file[i].fd > 0)
> > +				perf_data_file__close(&rec-
> >synthesized_file[i]);
> 
> also those files should be removed

Sure.
I will modify the perf_data_file__close(file, bool remove) to do it.

Thanks,
Kan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ