Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1237937
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC/PATCH 07/38] perf tools: Add HEADER_DATA_INDEX feature |
| Date | 2015-10-02 07:40 +0200 |
| Message-ID | <qf1ex-2v1-5@gated-at.bofh.it> (permalink) |
| References | <qf14R-2jW-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The HEADER_DATA_INDEX feature is to record index table for sample data
so that they can be processed by multiple thread concurrently. Each
item is a struct perf_file_section which consists of an offset and size.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-record.c | 2 ++
tools/perf/util/header.c | 64 +++++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/header.h | 3 +++
3 files changed, 69 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 90b1237d2525..623984c81478 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -451,6 +451,8 @@ static void record__init_features(struct record *rec)
if (!rec->opts.full_auxtrace)
perf_header__clear_feat(&session->header, HEADER_AUXTRACE);
+
+ perf_header__clear_feat(&session->header, HEADER_DATA_INDEX);
}
static volatile int workload_exec_errno;
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 43838003c1a1..c357f7f47d32 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -868,6 +868,24 @@ static int write_auxtrace(int fd, struct perf_header *h,
return err;
}
+static int write_data_index(int fd, struct perf_header *h,
+ struct perf_evlist *evlist __maybe_unused)
+{
+ int ret;
+ unsigned i;
+
+ ret = do_write(fd, &h->nr_index, sizeof(h->nr_index));
+ if (ret < 0)
+ return ret;
+
+ for (i = 0; i < h->nr_index; i++) {
+ ret = do_write(fd, &h->index[i], sizeof(*h->index));
+ if (ret < 0)
+ return ret;
+ }
+ return 0;
+}
+
static void print_hostname(struct perf_header *ph, int fd __maybe_unused,
FILE *fp)
{
@@ -1221,6 +1239,12 @@ static void print_group_desc(struct perf_header *ph, int fd __maybe_unused,
}
}
+static void print_data_index(struct perf_header *ph __maybe_unused,
+ int fd __maybe_unused, FILE *fp)
+{
+ fprintf(fp, "# contains data index for parallel processing\n");
+}
+
static int __event_process_build_id(struct build_id_event *bev,
char *filename,
struct perf_session *session)
@@ -1891,6 +1915,7 @@ out_free:
return ret;
}
+
static int process_auxtrace(struct perf_file_section *section,
struct perf_header *ph, int fd,
void *data __maybe_unused)
@@ -1907,6 +1932,44 @@ static int process_auxtrace(struct perf_file_section *section,
return err;
}
+static int process_data_index(struct perf_file_section *section __maybe_unused,
+ struct perf_header *ph, int fd,
+ void *data __maybe_unused)
+{
+ ssize_t ret;
+ u64 nr_idx;
+ unsigned i;
+ struct perf_file_section *idx;
+
+ ret = readn(fd, &nr_idx, sizeof(nr_idx));
+ if (ret != sizeof(nr_idx))
+ return -1;
+
+ if (ph->needs_swap)
+ nr_idx = bswap_64(nr_idx);
+
+ idx = calloc(nr_idx, sizeof(*idx));
+ if (idx == NULL)
+ return -1;
+
+ for (i = 0; i < nr_idx; i++) {
+ ret = readn(fd, &idx[i], sizeof(*idx));
+ if (ret != sizeof(*idx)) {
+ free(idx);
+ return -1;
+ }
+
+ if (ph->needs_swap) {
+ idx[i].offset = bswap_64(idx[i].offset);
+ idx[i].size = bswap_64(idx[i].size);
+ }
+ }
+
+ ph->index = idx;
+ ph->nr_index = nr_idx;
+ return 0;
+}
+
struct feature_ops {
int (*write)(int fd, struct perf_header *h, struct perf_evlist *evlist);
void (*print)(struct perf_header *h, int fd, FILE *fp);
@@ -1948,6 +2011,7 @@ static const struct feature_ops feat_ops[HEADER_LAST_FEATURE] = {
FEAT_OPP(HEADER_PMU_MAPPINGS, pmu_mappings),
FEAT_OPP(HEADER_GROUP_DESC, group_desc),
FEAT_OPP(HEADER_AUXTRACE, auxtrace),
+ FEAT_OPP(HEADER_DATA_INDEX, data_index),
};
struct header_print_data {
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 05f27cb6b7e3..add455a7abff 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -31,6 +31,7 @@ enum {
HEADER_PMU_MAPPINGS,
HEADER_GROUP_DESC,
HEADER_AUXTRACE,
+ HEADER_DATA_INDEX,
HEADER_LAST_FEATURE,
HEADER_FEAT_BITS = 256,
};
@@ -71,6 +72,8 @@ struct perf_header {
bool needs_swap;
u64 data_offset;
u64 data_size;
+ struct perf_file_section *index;
+ u64 nr_index;
u64 feat_offset;
DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
struct perf_env env;
--
2.6.0
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC/PATCH 00/38] perf tools: Speed-up perf report by using multi thread (v5) Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 04/38] perf tools: pass perf_mmap desc directly Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
Re: [RFC/PATCH 04/38] perf tools: pass perf_mmap desc directly Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-02 20:50 +0200
[RFC/PATCH 27/38] perf hists: Pass hists struct to hist_entry_iter struct Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 06/38] perf tools: Extend perf_evlist__mmap_ex() to use track mmap Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 18/38] perf tools: Introduce thread__find_addr_location_by_time() and friends Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 21/38] perf tools: Save timestamp of a map creation Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 15/38] perf tools: Introduce machine__find*_thread_by_time() Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 01/38] perf tools: Use a software dummy event to track task/mmap events Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
Re: [RFC/PATCH 01/38] perf tools: Use a software dummy event to track task/mmap events Jiri Olsa <jolsa@redhat.com> - 2015-10-05 15:00 +0200
[RFC/PATCH 28/38] perf tools: Move BUILD_ID_SIZE definition to perf.h Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 13/38] perf tools: Use thread__comm_by_time() when adding hist entries Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 14/38] perf tools: Convert dead thread list into rbtree Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 22/38] perf tools: Introduce map_groups__{insert,find}_by_time() Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 26/38] perf session: Pass struct events stats to event processing functions Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 09/38] perf record: Add --index option for building index table Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
Re: [RFC/PATCH 09/38] perf record: Add --index option for building index table Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-02 21:00 +0200
Re: [RFC/PATCH 09/38] perf record: Add --index option for building index table Jiri Olsa <jolsa@redhat.com> - 2015-10-05 15:50 +0200
[RFC/PATCH 23/38] perf tools: Use map_groups__find_addr_by_time() Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 28/38] perf tools: Move BUILD_ID_SIZE definition to perf.h Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 24/38] perf tools: Add testcase for managing maps with time Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 11/38] perf tools: Introduce thread__comm(_str)_by_time() helpers Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 17/38] perf tools: Maintain map groups list in a leader thread Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:30 +0200
[RFC/PATCH 08/38] perf tools: Handle indexed data file properly Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
[RFC/PATCH 02/38] perf tools: Save mmap_param.len instead of mask Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
Re: [RFC/PATCH 02/38] perf tools: Save mmap_param.len instead of mask Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-02 20:50 +0200
[RFC/PATCH 07/38] perf tools: Add HEADER_DATA_INDEX feature Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
[RFC/PATCH 10/38] perf report: Skip dummy tracking event Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
[RFC/PATCH 03/38] perf tools: Move auxtrace_mmap field to struct perf_evlist Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
Re: [RFC/PATCH 03/38] perf tools: Move auxtrace_mmap field to struct perf_evlist Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-02 20:50 +0200
Re: [RFC/PATCH 03/38] perf tools: Move auxtrace_mmap field to struct perf_evlist Adrian Hunter <adrian.hunter@intel.com> - 2015-10-05 13:40 +0200
Re: [RFC/PATCH 03/38] perf tools: Move auxtrace_mmap field to struct perf_evlist Jiri Olsa <jolsa@redhat.com> - 2015-10-05 15:20 +0200
[RFC/PATCH 05/38] perf tools: Create separate mmap for dummy tracking event Namhyung Kim <namhyung@kernel.org> - 2015-10-02 07:40 +0200
csiph-web