Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1191247 > unrolled thread
| Started by | kan.liang@intel.com |
|---|---|
| First post | 2015-07-23 21:10 +0200 |
| Last post | 2015-07-23 21:10 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/5] Freq/CPU%/CORE_BUSY% support kan.liang@intel.com - 2015-07-23 21:10 +0200
[PATCH 3/5] perf,tools: save misc sample read value in struct perf_sample kan.liang@intel.com - 2015-07-23 21:10 +0200
| From | kan.liang@intel.com |
|---|---|
| Date | 2015-07-23 21:10 +0200 |
| Subject | [PATCH 0/5] Freq/CPU%/CORE_BUSY% support |
| Message-ID | <pPu2t-7g6-17@gated-at.bofh.it> |
From: Kan Liang <kan.liang@intel.com>
(Re-send. Missed "From: Kan Liang <kan.liang@intel.com>" in last mail)
This patch set supports per-sample freq/CPU%/CORE_BUSY% print in perf
report -D and --stdio.
For printing these information, the perf.data file must have been obtained
by group read and using special events cycles, ref-cycles, msr/tsc/,
msr/aperf/ or msr/mperf/.
- Freq (MHz): The frequency during the sample interval. Needs cycles
ref-cycles event.
- CPU%: CPU utilization during the sample interval. Needs ref-cycles and
msr/tsc/ events.
- CORE_BUSY%: actual percent performance (APERF/MPERF%) during the
sample interval. Needs msr/aperf/ and msr/mperf/ events.
For printing CPU% and CORE_BUSY%, please also apply the kernel patch.
http://marc.info/?l=linux-kernel&m=143747254926369&w=2
Here is an example:
$ perf record -e
'{cycles,ref-cycles,msr/tsc/,msr/mperf/,msr/aperf/}:S' ~/tchain_edit
$ perf report --stdio --group --show-freq-perf
Overhead FREQ MHz CPU% CORE_BUSY%
Command Shared Object Symbol
........................................ ......... ..... ..........
........... ................ ......................
99.54% 99.54% 99.53% 99.53% 99.53% 2301 96 99
tchain_edit tchain_edit [.] f3
0.20% 0.20% 0.20% 0.20% 0.20% 2301 98 99
tchain_edit tchain_edit [.] f2
0.05% 0.05% 0.05% 0.05% 0.05% 2300 98 99
tchain_edit [kernel.vmlinux] [k] read_tsc
Kan Liang (5):
perf,tools: introduce get_cpu_max_freq
perf,tools: Dump per-sample freq/CPU%/CORE_BUSY% in report -D
perf,tools: save misc sample read value in struct perf_sample
perf,tools: caculate and save freq/CPU%/CORE_BUSY% in he_stat
perf,tools: Show freq/CPU%/CORE_BUSY% in perf report --stdio
tools/perf/Documentation/perf-report.txt | 12 ++++++
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-diff.c | 2 +-
tools/perf/builtin-report.c | 24 +++++++++++
tools/perf/perf.h | 1 +
tools/perf/tests/hists_link.c | 4 +-
tools/perf/ui/hist.c | 71 +++++++++++++++++++++++++++++---
tools/perf/util/cpumap.c | 32 ++++++++++++++
tools/perf/util/cpumap.h | 2 +
tools/perf/util/event.h | 11 +++++
tools/perf/util/hist.c | 51 ++++++++++++++++++++---
tools/perf/util/hist.h | 5 +++
tools/perf/util/pmu.h | 2 +
tools/perf/util/session.c | 50 +++++++++++++++++++---
tools/perf/util/session.h | 28 +++++++++++++
tools/perf/util/sort.c | 3 ++
tools/perf/util/sort.h | 3 ++
tools/perf/util/symbol.h | 9 +++-
tools/perf/util/util.c | 2 +
19 files changed, 293 insertions(+), 21 deletions(-)
--
1.8.3.1
--
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 | kan.liang@intel.com |
|---|---|
| Date | 2015-07-23 21:10 +0200 |
| Subject | [PATCH 3/5] perf,tools: save misc sample read value in struct perf_sample |
| Message-ID | <pPu2v-7g6-57@gated-at.bofh.it> |
| In reply to | #1191247 |
From: Kan Liang <kan.liang@intel.com>
Save group read results from cycles/ref-cycles/TSC/ASTATE/MSTATE in
struct perf_sample. The following sample process function can easily
use them to caculate freq/CPU%/CORE_BUSY% and add them in hists.
Signed-off-by: Kan Liang <kan.liang@intel.com>
---
tools/perf/util/event.h | 11 +++++++++++
tools/perf/util/session.c | 16 ++++++++++++++++
tools/perf/util/session.h | 10 ----------
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index c53f363..f7aabe3 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -176,6 +176,16 @@ enum {
PERF_IP_FLAG_TRACE_BEGIN |\
PERF_IP_FLAG_TRACE_END)
+enum perf_freq_perf_index {
+ FREQ_PERF_TSC = 0,
+ FREQ_PERF_APERF = 1,
+ FREQ_PERF_MPERF = 2,
+ FREQ_PERF_CYCLES = 3,
+ FREQ_PERF_REF_CYCLES = 4,
+
+ FREQ_PERF_MAX
+};
+
struct perf_sample {
u64 ip;
u32 pid, tid;
@@ -191,6 +201,7 @@ struct perf_sample {
u64 data_src;
u32 flags;
u16 insn_len;
+ u64 freq_perf_data[FREQ_PERF_MAX];
void *raw_data;
struct ip_callchain *callchain;
struct branch_stack *branch_stack;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 6dd20b5..939dfed 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -999,6 +999,8 @@ static int deliver_sample_value(struct perf_evlist *evlist,
struct machine *machine)
{
struct perf_sample_id *sid = perf_evlist__id2sid(evlist, v->id);
+ struct perf_evsel *evsel;
+ u64 nr = 0;
if (sid) {
sample->id = v->id;
@@ -1011,6 +1013,20 @@ static int deliver_sample_value(struct perf_evlist *evlist,
return 0;
}
+ if (perf_evsel__is_group_leader(sid->evsel)) {
+ evsel = sid->evsel;
+ SET_FREQ_PERF_VALUE(evsel, sample->freq_perf_data,
+ sample->read.group.values[nr].value);
+ evlist__for_each_continue(evlist, evsel) {
+ if ((evsel->leader != sid->evsel) ||
+ (++nr >= sample->read.group.nr))
+ break;
+
+ SET_FREQ_PERF_VALUE(evsel, sample->freq_perf_data,
+ sample->read.group.values[nr].value);
+ }
+ }
+
return tool->sample(tool, event, sample, sid->evsel, machine);
}
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index df2094d..8c3cae8 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -46,16 +46,6 @@ struct perf_session {
#define PERF_MSR_APERF 1
#define PERF_MSR_MPERF 2
-enum perf_freq_perf_index {
- FREQ_PERF_TSC = 0,
- FREQ_PERF_APERF = 1,
- FREQ_PERF_MPERF = 2,
- FREQ_PERF_CYCLES = 3,
- FREQ_PERF_REF_CYCLES = 4,
-
- FREQ_PERF_MAX
-};
-
#define SET_FREQ_PERF_VALUE(event, array, value) \
{ \
if (event->attr.type == msr_pmu->type) { \
--
1.8.3.1
--
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