Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1241233 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2015-10-07 10:30 +0200 |
| Last post | 2015-10-07 14:20 +0200 |
| Articles | 2 — 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.
Re: [RFC/PATCH 09/38] perf record: Add --index option for building index table Namhyung Kim <namhyung@kernel.org> - 2015-10-07 10:30 +0200
Re: [RFC/PATCH 09/38] perf record: Add --index option for building index table Jiri Olsa <jolsa@redhat.com> - 2015-10-07 14:20 +0200
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2015-10-07 10:30 +0200 |
| Subject | Re: [RFC/PATCH 09/38] perf record: Add --index option for building index table |
| Message-ID | <qgSgO-7JK-21@gated-at.bofh.it> |
Hi Jiri,
On Mon, Oct 5, 2015 at 10:46 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> On Fri, Oct 02, 2015 at 02:18:50PM +0900, Namhyung Kim wrote:
>
> SNIP
>
>> +static int record__merge_index_files(struct record *rec, int nr_index)
>> +{
>> + int i;
>> + int ret = -ENOMEM;
>> + u64 offset;
>> + char path[PATH_MAX];
>> + struct perf_file_section *idx;
>> + struct perf_data_file *file = &rec->file;
>> + struct perf_session *session = rec->session;
>> + int output_fd = perf_data_file__fd(file);
>> +
>> + /* +1 for header file itself */
>> + nr_index++;
>> +
>> + idx = calloc(nr_index, sizeof(*idx));
>> + if (idx == NULL)
>> + goto out_close;
>> +
>> + offset = lseek(output_fd, 0, SEEK_END);
>> +
>> + idx[0].offset = session->header.data_offset;
>> + idx[0].size = offset - idx[0].offset;
>> +
>> + for (i = 1; i < nr_index; i++) {
>> + struct stat stbuf;
>> + int fd = rec->fds[i - 1];
>> +
>> + ret = fstat(fd, &stbuf);
>> + if (ret < 0)
>> + goto out_close;
>> +
>> + idx[i].offset = offset;
>> + idx[i].size = stbuf.st_size;
>> +
>> + offset += stbuf.st_size;
>> +
>> + if (idx[i].size == 0)
>> + continue;
>> +
>> + ret = copyfile_offset(fd, 0, output_fd, idx[i].offset,
>> + idx[i].size);
>> + if (ret < 0)
>> + goto out_close;
>> + }
>> +
>> + session->header.index = idx;
>> + session->header.nr_index = nr_index;
>> +
>> + perf_has_index = true;
>
> I might have asked earlier, but why is this global? seems like
> perf_session member to me..
Yes you did. :-)
https://lkml.org/lkml/2015/5/19/110
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] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-10-07 14:20 +0200 |
| Message-ID | <qgVRn-4wo-1@gated-at.bofh.it> |
| In reply to | #1241233 |
On Wed, Oct 07, 2015 at 05:21:46PM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> On Mon, Oct 5, 2015 at 10:46 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> > On Fri, Oct 02, 2015 at 02:18:50PM +0900, Namhyung Kim wrote:
> >
> > SNIP
> >
> >> +static int record__merge_index_files(struct record *rec, int nr_index)
> >> +{
> >> + int i;
> >> + int ret = -ENOMEM;
> >> + u64 offset;
> >> + char path[PATH_MAX];
> >> + struct perf_file_section *idx;
> >> + struct perf_data_file *file = &rec->file;
> >> + struct perf_session *session = rec->session;
> >> + int output_fd = perf_data_file__fd(file);
> >> +
> >> + /* +1 for header file itself */
> >> + nr_index++;
> >> +
> >> + idx = calloc(nr_index, sizeof(*idx));
> >> + if (idx == NULL)
> >> + goto out_close;
> >> +
> >> + offset = lseek(output_fd, 0, SEEK_END);
> >> +
> >> + idx[0].offset = session->header.data_offset;
> >> + idx[0].size = offset - idx[0].offset;
> >> +
> >> + for (i = 1; i < nr_index; i++) {
> >> + struct stat stbuf;
> >> + int fd = rec->fds[i - 1];
> >> +
> >> + ret = fstat(fd, &stbuf);
> >> + if (ret < 0)
> >> + goto out_close;
> >> +
> >> + idx[i].offset = offset;
> >> + idx[i].size = stbuf.st_size;
> >> +
> >> + offset += stbuf.st_size;
> >> +
> >> + if (idx[i].size == 0)
> >> + continue;
> >> +
> >> + ret = copyfile_offset(fd, 0, output_fd, idx[i].offset,
> >> + idx[i].size);
> >> + if (ret < 0)
> >> + goto out_close;
> >> + }
> >> +
> >> + session->header.index = idx;
> >> + session->header.nr_index = nr_index;
> >> +
> >> + perf_has_index = true;
> >
> > I might have asked earlier, but why is this global? seems like
> > perf_session member to me..
>
> Yes you did. :-)
>
> https://lkml.org/lkml/2015/5/19/110
ah right ;-) ok
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] | [standalone]
Back to top | Article view | linux.kernel
csiph-web