Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1692220 > unrolled thread
| Started by | Taeung Song <treeze.taeung@gmail.com> |
|---|---|
| First post | 2017-07-19 23:40 +0200 |
| Last post | 2017-07-26 19:30 +0200 |
| Articles | 3 on this page of 23 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-19 23:40 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-20 21:20 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-21 11:50 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 13:30 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-24 04:00 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-24 19:40 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-24 23:30 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-25 16:50 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-25 18:00 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-25 18:20 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-26 14:00 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-26 22:20 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Taeung Song <treeze.taeung@gmail.com> - 2017-07-27 17:20 +0200
[tip:perf/core] perf annotate stdio: Fix column header when using --show-total-period tip-bot for Taeung Song <tipbot@zytor.com> - 2017-07-26 19:30 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-21 17:00 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Namhyung Kim <namhyung@kernel.org> - 2017-07-23 00:50 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Andi Kleen <andi@firstfloor.org> - 2017-07-23 17:50 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-24 19:40 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Andi Kleen <andi@firstfloor.org> - 2017-07-24 19:50 +0200
Re: [PATCH v3 3/9] perf annotate: Fix wrong --show-total-period option showing number of samples Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-24 20:10 +0200
[tip:perf/core] perf annotate: Store the sample period in each histogram bucket tip-bot for Taeung Song <tipbot@zytor.com> - 2017-07-26 19:30 +0200
[tip:perf/core] perf annotate: Do not overwrite sample->period tip-bot for Taeung Song <tipbot@zytor.com> - 2017-07-26 19:30 +0200
[tip:perf/core] perf hists: Pass perf_sample to __symbol__inc_addr_samples() tip-bot for Taeung Song <tipbot@zytor.com> - 2017-07-26 19:30 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | tip-bot for Taeung Song <tipbot@zytor.com> |
|---|---|
| Date | 2017-07-26 19:30 +0200 |
| Subject | [tip:perf/core] perf annotate: Store the sample period in each histogram bucket |
| Message-ID | <u7yie-3eE-11@gated-at.bofh.it> |
| In reply to | #1692220 |
Commit-ID: 461c17f00f400f95116880d91d20a7fcd84263a9
Gitweb: http://git.kernel.org/tip/461c17f00f400f95116880d91d20a7fcd84263a9
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Thu, 20 Jul 2017 17:18:05 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 21 Jul 2017 12:02:38 -0300
perf annotate: Store the sample period in each histogram bucket
We'll use it soon, when fixing --show-total-period.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split from a larger patch, do the math in __symbol__inc_addr_samples() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 17 ++++++++++++-----
tools/perf/util/annotate.h | 1 +
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index c2fe16d..00e085f 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -698,7 +698,7 @@ static int __symbol__account_cycles(struct annotation *notes,
static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
struct annotation *notes, int evidx, u64 addr,
- struct perf_sample *sample __maybe_unused)
+ struct perf_sample *sample)
{
unsigned offset;
struct sym_hist *h;
@@ -716,10 +716,13 @@ static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
h = annotation__histogram(notes, evidx);
h->nr_samples++;
h->addr[offset].nr_samples++;
+ h->period += sample->period;
+ h->addr[offset].period += sample->period;
pr_debug3("%#" PRIx64 " %s: period++ [addr: %#" PRIx64 ", %#" PRIx64
- ", evidx=%d] => %" PRIu64 "\n", sym->start, sym->name,
- addr, addr - sym->start, evidx, h->addr[offset].nr_samples);
+ ", evidx=%d] => nr_samples: %" PRIu64 ", period: %" PRIu64 "\n",
+ sym->start, sym->name, addr, addr - sym->start, evidx,
+ h->addr[offset].nr_samples, h->addr[offset].period);
return 0;
}
@@ -937,7 +940,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
struct source_line *src_line = notes->src->lines;
double percent = 0.0;
- sample->nr_samples = 0;
+ sample->nr_samples = sample->period = 0;
if (src_line) {
size_t sizeof_src_line = sizeof(*src_line) +
@@ -957,11 +960,15 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
} else {
struct sym_hist *h = annotation__histogram(notes, evidx);
unsigned int hits = 0;
+ u64 period = 0;
- while (offset < end)
+ while (offset < end) {
hits += h->addr[offset++].nr_samples;
+ period += h->addr[offset++].period;
+ }
if (h->nr_samples) {
+ sample->period = period;
sample->nr_samples = hits;
percent = 100.0 * hits / h->nr_samples;
}
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 720f181..9ce575c 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -88,6 +88,7 @@ double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset,
struct sym_hist {
u64 nr_samples;
+ u64 period;
struct sym_hist_entry addr[0];
};
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Taeung Song <tipbot@zytor.com> |
|---|---|
| Date | 2017-07-26 19:30 +0200 |
| Subject | [tip:perf/core] perf annotate: Do not overwrite sample->period |
| Message-ID | <u7yig-3eE-49@gated-at.bofh.it> |
| In reply to | #1692220 |
Commit-ID: ecd5f9959d2c9540482977ff1208ea67fbfb8cc9
Gitweb: http://git.kernel.org/tip/ecd5f9959d2c9540482977ff1208ea67fbfb8cc9
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Fri, 21 Jul 2017 11:38:48 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 21 Jul 2017 12:02:52 -0300
perf annotate: Do not overwrite sample->period
In fixing the --show-total-period option it was noticed that the value
of sample->period was being overwritten, fix it.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: fd36f3dd7933 ("perf hist: Pass struct sample to __hists__add_entry()")
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split from a larger patch, added the Fixes tag ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-annotate.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 96fe1a8..7e33278 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -177,7 +177,6 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
*/
process_branch_stack(sample->branch_stack, al, sample);
- sample->period = 1;
sample->weight = 1;
he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Taeung Song <tipbot@zytor.com> |
|---|---|
| Date | 2017-07-26 19:30 +0200 |
| Subject | [tip:perf/core] perf hists: Pass perf_sample to __symbol__inc_addr_samples() |
| Message-ID | <u7yig-3eE-71@gated-at.bofh.it> |
| In reply to | #1692220 |
Commit-ID: bab89f6aed7e745893e009014354d0caaf62acf7
Gitweb: http://git.kernel.org/tip/bab89f6aed7e745893e009014354d0caaf62acf7
Author: Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Thu, 20 Jul 2017 16:28:53 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 21 Jul 2017 08:23:50 -0300
perf hists: Pass perf_sample to __symbol__inc_addr_samples()
To pave the way to use perf_sample fields in the annotate code, storing
sample->period in sym_hist->addr->period and its sum in
sym_hist->period.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1500500215-16646-1-git-send-email-treeze.taeung@gmail.com
[ split and adjusted from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-report.c | 15 ++++++++-------
tools/perf/builtin-top.c | 5 +++--
tools/perf/util/annotate.c | 18 +++++++++++-------
tools/perf/util/annotate.h | 6 ++++--
5 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 5205408..96fe1a8 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -184,7 +184,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
if (he == NULL)
return -ENOMEM;
- ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ ret = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
hists__inc_nr_samples(hists, true);
return ret;
}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index cea25d0..983b238 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -115,37 +115,38 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
struct report *rep = arg;
struct hist_entry *he = iter->he;
struct perf_evsel *evsel = iter->evsel;
+ struct perf_sample *sample = iter->sample;
struct mem_info *mi;
struct branch_info *bi;
if (!ui__has_annotation())
return 0;
- hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
+ hist__account_cycles(sample->branch_stack, al, sample,
rep->nonany_branch_mode);
if (sort__mode == SORT_MODE__BRANCH) {
bi = he->branch_info;
- err = addr_map_symbol__inc_samples(&bi->from, evsel->idx);
+ err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx);
if (err)
goto out;
- err = addr_map_symbol__inc_samples(&bi->to, evsel->idx);
+ err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx);
} else if (rep->mem_mode) {
mi = he->mem_info;
- err = addr_map_symbol__inc_samples(&mi->daddr, evsel->idx);
+ err = addr_map_symbol__inc_samples(&mi->daddr, sample, evsel->idx);
if (err)
goto out;
- err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
} else if (symbol_conf.cumulate_callchain) {
if (single)
- err = hist_entry__inc_addr_samples(he, evsel->idx,
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx,
al->addr);
} else {
- err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
+ err = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr);
}
out:
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 022486d..e5a8f24 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -183,6 +183,7 @@ static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip)
static void perf_top__record_precise_ip(struct perf_top *top,
struct hist_entry *he,
+ struct perf_sample *sample,
int counter, u64 ip)
{
struct annotation *notes;
@@ -199,7 +200,7 @@ static void perf_top__record_precise_ip(struct perf_top *top,
if (pthread_mutex_trylock(¬es->lock))
return;
- err = hist_entry__inc_addr_samples(he, counter, ip);
+ err = hist_entry__inc_addr_samples(he, sample, counter, ip);
pthread_mutex_unlock(¬es->lock);
@@ -671,7 +672,7 @@ static int hist_iter__top_callback(struct hist_entry_iter *iter,
struct perf_evsel *evsel = iter->evsel;
if (perf_hpp_list.sym && single)
- perf_top__record_precise_ip(top, he, evsel->idx, al->addr);
+ perf_top__record_precise_ip(top, he, iter->sample, evsel->idx, al->addr);
hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
!(top->record_opts.branch_stack & PERF_SAMPLE_BRANCH_ANY));
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 58c6b63..c2fe16d 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -697,7 +697,8 @@ static int __symbol__account_cycles(struct annotation *notes,
}
static int __symbol__inc_addr_samples(struct symbol *sym, struct map *map,
- struct annotation *notes, int evidx, u64 addr)
+ struct annotation *notes, int evidx, u64 addr,
+ struct perf_sample *sample __maybe_unused)
{
unsigned offset;
struct sym_hist *h;
@@ -738,7 +739,8 @@ static struct annotation *symbol__get_annotation(struct symbol *sym, bool cycles
}
static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
- int evidx, u64 addr)
+ int evidx, u64 addr,
+ struct perf_sample *sample)
{
struct annotation *notes;
@@ -747,7 +749,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
notes = symbol__get_annotation(sym, false);
if (notes == NULL)
return -ENOMEM;
- return __symbol__inc_addr_samples(sym, map, notes, evidx, addr);
+ return __symbol__inc_addr_samples(sym, map, notes, evidx, addr, sample);
}
static int symbol__account_cycles(u64 addr, u64 start,
@@ -811,14 +813,16 @@ int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
return err;
}
-int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx)
+int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
+ int evidx)
{
- return symbol__inc_addr_samples(ams->sym, ams->map, evidx, ams->al_addr);
+ return symbol__inc_addr_samples(ams->sym, ams->map, evidx, ams->al_addr, sample);
}
-int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 ip)
+int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
+ int evidx, u64 ip)
{
- return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
+ return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip, sample);
}
static void disasm_line__init_ins(struct disasm_line *dl, struct arch *arch, struct map *map)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index e8c246e..720f181 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -154,13 +154,15 @@ static inline struct annotation *symbol__annotation(struct symbol *sym)
return (void *)sym - symbol_conf.priv_size;
}
-int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, int evidx);
+int addr_map_symbol__inc_samples(struct addr_map_symbol *ams, struct perf_sample *sample,
+ int evidx);
int addr_map_symbol__account_cycles(struct addr_map_symbol *ams,
struct addr_map_symbol *start,
unsigned cycles);
-int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
+int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
+ int evidx, u64 addr);
int symbol__alloc_hist(struct symbol *sym);
void symbol__annotate_zero_histograms(struct symbol *sym);
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web