2009-05-01 16:29:57 +00:00
|
|
|
#ifndef _PERF_PERF_H
|
|
|
|
#define _PERF_PERF_H
|
|
|
|
|
2009-05-23 16:28:58 +00:00
|
|
|
#include <time.h>
|
2014-05-05 10:58:31 +00:00
|
|
|
#include <stdbool.h>
|
2014-04-25 19:31:02 +00:00
|
|
|
#include <linux/types.h>
|
2012-11-19 22:21:03 +00:00
|
|
|
#include <linux/perf_event.h>
|
2009-05-23 16:28:58 +00:00
|
|
|
|
2014-05-05 10:58:31 +00:00
|
|
|
extern bool test_attr__enabled;
|
|
|
|
void test_attr__init(void);
|
|
|
|
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
|
|
|
|
int fd, int group_fd, unsigned long flags);
|
|
|
|
|
|
|
|
#define HAVE_ATTR_TEST
|
|
|
|
#include "perf-sys.h"
|
|
|
|
|
2009-05-01 16:39:47 +00:00
|
|
|
#ifndef NSEC_PER_SEC
|
|
|
|
# define NSEC_PER_SEC 1000000000ULL
|
|
|
|
#endif
|
2013-08-08 01:56:38 +00:00
|
|
|
#ifndef NSEC_PER_USEC
|
|
|
|
# define NSEC_PER_USEC 1000ULL
|
|
|
|
#endif
|
2009-05-01 16:39:47 +00:00
|
|
|
|
|
|
|
static inline unsigned long long rdclock(void)
|
|
|
|
{
|
|
|
|
struct timespec ts;
|
|
|
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
|
|
|
}
|
2009-05-01 16:29:57 +00:00
|
|
|
|
2015-03-24 16:10:38 +00:00
|
|
|
#define MAX_NR_CPUS 1024
|
2009-05-01 16:29:57 +00:00
|
|
|
|
2012-10-30 03:56:02 +00:00
|
|
|
extern const char *input_name;
|
2010-05-17 18:51:10 +00:00
|
|
|
extern bool perf_host, perf_guest;
|
perf tools: Make perf.data more self-descriptive (v8)
The goal of this patch is to include more information about the host
environment into the perf.data so it is more self-descriptive. Overtime,
profiles are captured on various machines and it becomes hard to track
what was recorded, on what machine and when.
This patch provides a way to solve this by extending the perf.data file
with basic information about the host machine. To add those extensions,
we leverage the feature bits capabilities of the perf.data format. The
change is backward compatible with existing perf.data files.
We define the following useful new extensions:
- HEADER_HOSTNAME: the hostname
- HEADER_OSRELEASE: the kernel release number
- HEADER_ARCH: the hw architecture
- HEADER_CPUDESC: generic CPU description
- HEADER_NRCPUS: number of online/avail cpus
- HEADER_CMDLINE: perf command line
- HEADER_VERSION: perf version
- HEADER_TOPOLOGY: cpu topology
- HEADER_EVENT_DESC: full event description (attrs)
- HEADER_CPUID: easy-to-parse low level CPU identication
The small granularity for the entries is to make it easier to extend
without breaking backward compatiblity. Many entries are provided as
ASCII strings.
Perf report/script have been modified to print the basic information as
easy-to-parse ASCII strings. Extended information about CPU and NUMA
topology may be requested with the -I option.
Thanks to David Ahern for reviewing and testing the many versions of
this patch.
$ perf report --stdio
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# ========
#
...
$ perf report --stdio -I
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# sibling cores : 0-3
# sibling threads : 0
# sibling threads : 1
# sibling threads : 2
# sibling threads : 3
# node0 meminfo : total = 8320608 kB, free = 7571024 kB
# node0 cpu list : 0-3
# ========
#
...
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110930134040.GA5575@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer notes: Use --show-info in the tools as was in the docs, rename
perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
conflict with f69b64f7 "perf: Support setting the disassembler style" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-30 13:40:40 +00:00
|
|
|
extern const char perf_version_string[];
|
2010-04-19 05:32:50 +00:00
|
|
|
|
2011-10-13 11:52:46 +00:00
|
|
|
void pthread__unblock_sigwinch(void);
|
|
|
|
|
2012-04-26 05:15:22 +00:00
|
|
|
#include "util/target.h"
|
2012-04-26 05:15:15 +00:00
|
|
|
|
2013-12-19 17:43:45 +00:00
|
|
|
struct record_opts {
|
2013-11-12 19:46:16 +00:00
|
|
|
struct target target;
|
2011-11-11 17:12:56 +00:00
|
|
|
bool group;
|
2011-11-08 16:41:57 +00:00
|
|
|
bool inherit_stat;
|
2014-01-14 20:52:14 +00:00
|
|
|
bool no_buffering;
|
2011-11-08 16:41:57 +00:00
|
|
|
bool no_inherit;
|
2013-11-18 09:55:57 +00:00
|
|
|
bool no_inherit_set;
|
2011-11-08 16:41:57 +00:00
|
|
|
bool no_samples;
|
|
|
|
bool raw_samples;
|
|
|
|
bool sample_address;
|
2013-01-24 15:10:29 +00:00
|
|
|
bool sample_weight;
|
2011-11-08 16:41:57 +00:00
|
|
|
bool sample_time;
|
2015-07-06 11:51:01 +00:00
|
|
|
bool sample_time_set;
|
2015-07-29 09:42:12 +00:00
|
|
|
bool callgraph_set;
|
2011-12-20 14:32:45 +00:00
|
|
|
bool period;
|
2015-02-24 23:13:40 +00:00
|
|
|
bool running_time;
|
2015-04-09 15:53:44 +00:00
|
|
|
bool full_auxtrace;
|
2015-04-30 14:37:31 +00:00
|
|
|
bool auxtrace_snapshot_mode;
|
2015-07-21 09:44:04 +00:00
|
|
|
bool record_switch_events;
|
2016-02-15 08:34:31 +00:00
|
|
|
bool all_kernel;
|
|
|
|
bool all_user;
|
2011-11-08 16:41:57 +00:00
|
|
|
unsigned int freq;
|
2011-11-09 11:16:26 +00:00
|
|
|
unsigned int mmap_pages;
|
2015-04-09 15:53:44 +00:00
|
|
|
unsigned int auxtrace_mmap_pages;
|
2011-11-08 16:41:57 +00:00
|
|
|
unsigned int user_freq;
|
2012-05-25 21:13:44 +00:00
|
|
|
u64 branch_stack;
|
perf record: Add ability to name registers to record
This patch modifies the -I/--int-regs option to enablepassing the name
of the registers to sample on interrupt. Registers can be specified by
their symbolic names. For instance on x86, --intr-regs=ax,si.
The motivation is to reduce the size of the perf.data file and the
overhead of sampling by only collecting the registers useful to a
specific analysis. For instance, for value profiling, sampling only the
registers used to passed arguements to functions.
With no parameter, the --intr-regs still records all possible registers
based on the architecture.
To name registers, it is necessary to use the long form of the option,
i.e., --intr-regs:
$ perf record --intr-regs=si,di,r8,r9 .....
To record any possible registers:
$ perf record -I .....
$ perf report --intr-regs ...
To display the register, one can use perf report -D
To list the available registers:
$ perf record --intr-regs=\?
available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15
Signed-off-by: Stephane Eranian <eranian@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1441039273-16260-4-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-08-31 16:41:12 +00:00
|
|
|
u64 sample_intr_regs;
|
2011-11-08 16:41:57 +00:00
|
|
|
u64 default_interval;
|
|
|
|
u64 user_interval;
|
2015-04-30 14:37:31 +00:00
|
|
|
size_t auxtrace_snapshot_size;
|
|
|
|
const char *auxtrace_snapshot_opts;
|
2013-09-20 14:40:43 +00:00
|
|
|
bool sample_transaction;
|
2014-01-11 21:38:27 +00:00
|
|
|
unsigned initial_delay;
|
2015-03-30 22:19:31 +00:00
|
|
|
bool use_clockid;
|
|
|
|
clockid_t clockid;
|
2015-06-17 13:51:11 +00:00
|
|
|
unsigned int proc_map_timeout;
|
2011-11-08 16:41:57 +00:00
|
|
|
};
|
|
|
|
|
2014-10-22 15:15:46 +00:00
|
|
|
struct option;
|
|
|
|
extern const char * const *record_usage;
|
|
|
|
extern struct option *record_options;
|
2009-05-01 16:29:57 +00:00
|
|
|
#endif
|