Skip to content

Commit

Permalink
Merge branch 'email/acme' into perf/core
Browse files Browse the repository at this point in the history
Merge perf/core improvements and fixes from Arnaldo Carvalho de Melo:

    User visible changes:

 - Allow grouping multiple sort keys per 'perf report/top --hierarchy'
   level (Namhyung Kim)

 - Document 'perf stat --detailed' option (Borislav Petkov)

Infrastructure changes:

 - jitdump prep work for supporting it with Intel PT (Adrian Hunter)

 - Use 64-bit shifts with (TSC) time conversion (Adrian Hunter)

Fixes:

 - Explicitly declare inc_group_count as a void function (Colin Ian King)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Mar 8, 2016
2 parents 0096685 + 58ecd33 commit b9461ba
Show file tree
Hide file tree
Showing 15 changed files with 514 additions and 314 deletions.
8 changes: 8 additions & 0 deletions tools/perf/Documentation/perf-stat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ report::
--scale::
scale/normalize counter values

-d::
--detailed::
print more detailed statistics, can be specified up to 3 times

-d: detailed events, L1 and LLC data cache
-d -d: more detailed events, dTLB and iTLB events
-d -d -d: very detailed events, adding prefetch events

-r::
--repeat=<n>::
repeat command and print average + stddev (max: 100). 0 means forever.
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/tests/rdpmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static u64 mmap_read_self(void *addr)
u64 quot, rem;

quot = (cyc >> time_shift);
rem = cyc & ((1 << time_shift) - 1);
rem = cyc & (((u64)1 << time_shift) - 1);
delta = time_offset + quot * time_mult +
((rem * time_mult) >> time_shift);

Expand Down
52 changes: 20 additions & 32 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,16 @@ static int perf_event__jit_repipe_mmap(struct perf_tool *tool,
{
struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
u64 n = 0;
int ret;

/*
* if jit marker, then inject jit mmaps and generate ELF images
*/
if (!jit_process(inject->session, &inject->output, machine,
event->mmap.filename, sample->pid, &n)) {
ret = jit_process(inject->session, &inject->output, machine,
event->mmap.filename, sample->pid, &n);
if (ret < 0)
return ret;
if (ret) {
inject->bytes_written += n;
return 0;
}
Expand Down Expand Up @@ -287,12 +291,16 @@ static int perf_event__jit_repipe_mmap2(struct perf_tool *tool,
{
struct perf_inject *inject = container_of(tool, struct perf_inject, tool);
u64 n = 0;
int ret;

/*
* if jit marker, then inject jit mmaps and generate ELF images
*/
if (!jit_process(inject->session, &inject->output, machine,
event->mmap2.filename, sample->pid, &n)) {
ret = jit_process(inject->session, &inject->output, machine,
event->mmap2.filename, sample->pid, &n);
if (ret < 0)
return ret;
if (ret) {
inject->bytes_written += n;
return 0;
}
Expand Down Expand Up @@ -679,12 +687,16 @@ static int __cmd_inject(struct perf_inject *inject)
ret = perf_session__process_events(session);

if (!file_out->is_pipe) {
if (inject->build_ids) {
if (inject->build_ids)
perf_header__set_feat(&session->header,
HEADER_BUILD_ID);
if (inject->have_auxtrace)
dsos__hit_all(session);
}
/*
* Keep all buildids when there is unprocessed AUX data because
* it is not known which ones the AUX trace hits.
*/
if (perf_header__has_feat(&session->header, HEADER_BUILD_ID) &&
inject->have_auxtrace && !inject->itrace_synth_opts.set)
dsos__hit_all(session);
/*
* The AUX areas have been removed and replaced with
* synthesized hardware events, so clear the feature flag and
Expand Down Expand Up @@ -717,23 +729,6 @@ static int __cmd_inject(struct perf_inject *inject)
return ret;
}

#ifdef HAVE_LIBELF_SUPPORT
static int
jit_validate_events(struct perf_session *session)
{
struct perf_evsel *evsel;

/*
* check that all events use CLOCK_MONOTONIC
*/
evlist__for_each(session->evlist, evsel) {
if (evsel->attr.use_clockid == 0 || evsel->attr.clockid != CLOCK_MONOTONIC)
return -1;
}
return 0;
}
#endif

int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
{
struct perf_inject inject = {
Expand Down Expand Up @@ -840,13 +835,6 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
}
#ifdef HAVE_LIBELF_SUPPORT
if (inject.jit_mode) {
/*
* validate event is using the correct clockid
*/
if (jit_validate_events(inject.session)) {
fprintf(stderr, "error, jitted code must be sampled with perf record -k 1\n");
return -1;
}
inject.tool.mmap2 = perf_event__jit_repipe_mmap2;
inject.tool.mmap = perf_event__jit_repipe_mmap;
inject.tool.ordered_events = true;
Expand Down
Loading

0 comments on commit b9461ba

Please sign in to comment.