Re: [PATCH 09/44] perf session: Add instruction tracing options

From: Adrian Hunter
Date: Wed Apr 22 2015 - 02:25:28 EST


On 21/04/15 17:50, Arnaldo Carvalho de Melo wrote:
> Em Thu, Apr 09, 2015 at 06:53:49PM +0300, Adrian Hunter escreveu:
>
>> It is assumed that AUX area decoding will synthesize events for
>> consumption by other tools. At this time, the main use of AUX area
>> tracing will be to capture instruction trace (aka processor trace)
>> data. The nature of instruction tracing suggests the initial
>> inclusion of options for "instructions" and "branches" events, but
>> more could be added as needed.
>
>> +++ b/tools/perf/util/auxtrace.c
>> @@ -37,6 +37,7 @@
>>
>> #include "event.h"
>> #include "debug.h"
>> +#include "parse-options.h"
>>
>> int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
>> struct auxtrace_mmap_params *mp,
>> @@ -200,6 +201,136 @@ out_free:
>> return err;
>> }
>>
>> +#define PERF_ITRACE_DEFAULT_PERIOD_TYPE PERF_ITRACE_PERIOD_NANOSECS
>> +#define PERF_ITRACE_DEFAULT_PERIOD 100000
>> +#define PERF_ITRACE_DEFAULT_CALLCHAIN_SZ 16
>> +#define PERF_ITRACE_MAX_CALLCHAIN_SZ 1024
>> +
>> +void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts)
>> +{
>> + synth_opts->instructions = true;
>> + synth_opts->branches = true;
>> + synth_opts->errors = true;
>> + synth_opts->period_type = PERF_ITRACE_DEFAULT_PERIOD_TYPE;
>> + synth_opts->period = PERF_ITRACE_DEFAULT_PERIOD;
>> + synth_opts->callchain_sz = PERF_ITRACE_DEFAULT_CALLCHAIN_SZ;
>> +}
>> +
>> +int itrace_parse_synth_opts(const struct option *opt, const char *str,
>> + int unset)
>> +{
>> + struct itrace_synth_opts *synth_opts = opt->value;
>> + const char *p;
>> + char *endptr;
>> +
>> + synth_opts->set = true;
>> +
>> + if (unset) {
>> + synth_opts->dont_decode = true;
>> + return 0;
>> + }
>> +
>> + if (!str) {
>> + itrace_synth_opts__set_default(synth_opts);
>> + return 0;
>> + }
>> +
>> + for (p = str; *p;) {
>> + switch (*p++) {
>> + case 'i':
>> + synth_opts->instructions = true;
>
> Is this documented anywhere? I.e. examples for setting up this synth
> ops?

They are documented for each tool that uses them:
Documentation/perf-script.txt
Documentation/perf-record.txt
and also in:
Documentation/intel-pt.txt


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/