perf/core improvements and fixes:

perf report:
 
   Andi Kleen:
 
   - Make --ns time sort key output column wide enough for nanoseconds.
 
 perf script:
 
   Gustavo A. R. Silva:
 
   - Fix memory leaks in list_scripts()
 
 perf tests:
 
   James Clark:
 
   - Fixes hang in zstd compression test by changing the source of random data.
 
 perf trace:
 
   Arnaldo Carvalho de Melo:
 
   - augmented_raw_syscalls.c BPF helper improvements.
 
   Benjamin Peterson:
 
   - Fix off-by-one error in ioctl cmd->string table.
 
 libperf:
 
   Jiri Olsa:
 
   - Move most PERF_RECORD_ structs to perf/event.h.
 
 headers:
 
   Arnaldo Carvalho de Melo:
 
   - Move cacheline related routines to separate source files.
 
   - Move record_opts and other record declarations to separate files.
 
   - Explicitly add some more needed headers here and there.
 
   Souptick Joarder:
 
   - Remove some duplicate include directives.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXWSIGwAKCRCyPKLppCJ+
 J/KsAQDMtWw2NZ6GYRZrnW3UW9hRyjIxYkLXStEcQdTICRfOXAD+MxMVsY+4OaVE
 hud8gcTmZpZT20EX2eU552UEtMZgzA0=
 =al2Z
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo-5.4-20190826' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

perf report:

  Andi Kleen:

  - Make --ns time sort key output column wide enough for nanoseconds.

perf script:

  Gustavo A. R. Silva:

  - Fix memory leaks in list_scripts()

perf tests:

  James Clark:

  - Fixes hang in zstd compression test by changing the source of random data.

perf trace:

  Arnaldo Carvalho de Melo:

  - augmented_raw_syscalls.c BPF helper improvements.

  Benjamin Peterson:

  - Fix off-by-one error in ioctl cmd->string table.

libperf:

  Jiri Olsa:

  - Move most PERF_RECORD_ structs to perf/event.h.

headers:

  Arnaldo Carvalho de Melo:

  - Move cacheline related routines to separate source files.

  - Move record_opts and other record declarations to separate files.

  - Explicitly add some more needed headers here and there.

  Souptick Joarder:

  - Remove some duplicate include directives.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2019-08-27 10:22:25 +02:00
commit 794b8bedca
69 changed files with 494 additions and 428 deletions

View File

@ -15,7 +15,7 @@
#include <linux/zalloc.h>
#include "cs-etm.h"
#include "../../perf.h"
#include "../../util/record.h"
#include "../../util/auxtrace.h"
#include "../../util/cpumap.h"
#include "../../util/evlist.h"

View File

@ -19,6 +19,7 @@
#include "../../util/pmu.h"
#include "../../util/debug.h"
#include "../../util/auxtrace.h"
#include "../../util/record.h"
#include "../../util/arm-spe.h"
#define KiB(x) ((x) * 1024)

View File

@ -8,6 +8,7 @@
#include "../../util/evlist.h"
#include "../../util/auxtrace.h"
#include "../../util/evsel.h"
#include "../../util/record.h"
#define PERF_EVENT_CPUM_SF 0xB0000 /* Event: Basic-sampling */
#define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <linux/types.h>
@ -13,6 +14,7 @@
#include "evsel.h"
#include "thread_map.h"
#include "cpumap.h"
#include "record.h"
#include "tsc.h"
#include "tests/tests.h"

View File

@ -17,6 +17,7 @@
#include "../../util/session.h"
#include "../../util/pmu.h"
#include "../../util/debug.h"
#include "../../util/record.h"
#include "../../util/tsc.h"
#include "../../util/auxtrace.h"
#include "../../util/intel-bts.h"

View File

@ -13,7 +13,6 @@
#include <linux/zalloc.h>
#include <cpuid.h>
#include "../../perf.h"
#include "../../util/session.h"
#include "../../util/event.h"
#include "../../util/evlist.h"
@ -24,6 +23,8 @@
#include "../../util/pmu.h"
#include "../../util/debug.h"
#include "../../util/auxtrace.h"
#include "../../util/record.h"
#include "../../util/target.h"
#include "../../util/tsc.h"
#include "../../util/intel-pt.h"

View File

@ -26,6 +26,7 @@
#include "hist.h"
#include "sort.h"
#include "tool.h"
#include "cacheline.h"
#include "data.h"
#include "event.h"
#include "evlist.h"

View File

@ -15,6 +15,7 @@
#include "util/session.h"
#include "util/tool.h"
#include "util/sort.h"
#include "util/srcline.h"
#include "util/symbol.h"
#include "util/data.h"
#include "util/config.h"
@ -22,6 +23,7 @@
#include "util/annotate.h"
#include "util/map.h"
#include <linux/zalloc.h>
#include <subcmd/parse-options.h>
#include <errno.h>
#include <inttypes.h>

View File

@ -8,8 +8,6 @@
*/
#include "builtin.h"
#include "perf.h"
#include "util/build-id.h"
#include <subcmd/parse-options.h>
#include "util/parse-events.h"
@ -22,9 +20,11 @@
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/debug.h"
#include "util/target.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/symbol.h"
#include "util/record.h"
#include "util/cpumap.h"
#include "util/thread_map.h"
#include "util/data.h"

View File

@ -28,6 +28,7 @@
#include "util/evswitch.h"
#include "util/header.h"
#include "util/session.h"
#include "util/srcline.h"
#include "util/tool.h"
#include <subcmd/parse-options.h>

View File

@ -2643,7 +2643,7 @@ static int process_lost(struct perf_tool *tool __maybe_unused,
timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr));
printf("%15s ", tstr);
printf("lost %" PRIu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
return 0;
}

View File

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "builtin.h"
#include "perf.h"
#include "util/cache.h"
#include "util/counts.h"
#include "util/debug.h"
@ -12,6 +11,7 @@
#include "util/session.h"
#include "util/tool.h"
#include "util/map.h"
#include "util/srcline.h"
#include "util/symbol.h"
#include "util/thread.h"
#include "util/trace-event.h"
@ -51,6 +51,7 @@
#include <unistd.h>
#include <subcmd/pager.h>
#include <perf/evlist.h>
#include "util/record.h"
#include <linux/ctype.h>
@ -2491,8 +2492,8 @@ static int __cmd_script(struct perf_script *script)
script->tool.finished_round = process_finished_round_event;
}
if (script->show_bpf_events) {
script->tool.ksymbol = process_bpf_events;
script->tool.bpf_event = process_bpf_events;
script->tool.ksymbol = process_bpf_events;
script->tool.bpf = process_bpf_events;
}
if (perf_script__setup_per_event_dump(script)) {

View File

@ -40,7 +40,6 @@
* Jaswinder Singh Rajput <jaswinder@kernel.org>
*/
#include "perf.h"
#include "builtin.h"
#include "util/cgroup.h"
#include <subcmd/parse-options.h>
@ -62,6 +61,7 @@
#include "util/tool.h"
#include "util/string2.h"
#include "util/metricgroup.h"
#include "util/target.h"
#include "util/top.h"
#include "asm/bug.h"

View File

@ -14,6 +14,7 @@
* http://lwn.net/Articles/415728/ ("Announcing a new utility: 'trace'")
*/
#include "util/record.h"
#include <traceevent/event-parse.h>
#include <api/fs/tracing_path.h>
#include <bpf/bpf.h>

View File

@ -60,7 +60,7 @@ struct syscall_exit_args {
long ret;
};
struct augmented_filename {
struct augmented_arg {
unsigned int size;
int err;
char value[PATH_MAX];
@ -72,41 +72,52 @@ struct augmented_args_payload {
struct syscall_enter_args args;
union {
struct {
struct augmented_filename filename,
filename2;
struct augmented_arg arg, arg2;
};
struct sockaddr_storage saddr;
};
};
// We need more tmp space than the BPF stack can give us
bpf_map(augmented_args_tmp, PERCPU_ARRAY, int, struct augmented_args_payload, 1);
static inline
unsigned int augmented_filename__read(struct augmented_filename *augmented_filename,
const void *filename_arg, unsigned int filename_len)
static inline struct augmented_args_payload *augmented_args_payload(void)
{
unsigned int len = sizeof(*augmented_filename);
int size = probe_read_str(&augmented_filename->value, filename_len, filename_arg);
int key = 0;
return bpf_map_lookup_elem(&augmented_args_tmp, &key);
}
augmented_filename->size = augmented_filename->err = 0;
static inline int augmented__output(void *ctx, struct augmented_args_payload *args, int len)
{
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(ctx, &__augmented_syscalls__, BPF_F_CURRENT_CPU, args, len);
}
static inline
unsigned int augmented_arg__read_str(struct augmented_arg *augmented_arg, const void *arg, unsigned int arg_len)
{
unsigned int augmented_len = sizeof(*augmented_arg);
int string_len = probe_read_str(&augmented_arg->value, arg_len, arg);
augmented_arg->size = augmented_arg->err = 0;
/*
* probe_read_str may return < 0, e.g. -EFAULT
* So we leave that in the augmented_filename->size that userspace will
* So we leave that in the augmented_arg->size that userspace will
*/
if (size > 0) {
len -= sizeof(augmented_filename->value) - size;
len &= sizeof(augmented_filename->value) - 1;
augmented_filename->size = size;
if (string_len > 0) {
augmented_len -= sizeof(augmented_arg->value) - string_len;
augmented_len &= sizeof(augmented_arg->value) - 1;
augmented_arg->size = string_len;
} else {
/*
* So that username notice the error while still being able
* to skip this augmented arg record
*/
augmented_filename->err = size;
len = offsetof(struct augmented_filename, value);
augmented_arg->err = string_len;
augmented_len = offsetof(struct augmented_arg, value);
}
return len;
return augmented_len;
}
SEC("!raw_syscalls:unaugmented")
@ -124,8 +135,7 @@ int syscall_unaugmented(struct syscall_enter_args *args)
SEC("!syscalls:sys_enter_connect")
int sys_enter_connect(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *sockaddr_arg = (const void *)args->args[1];
unsigned int socklen = args->args[2];
unsigned int len = sizeof(augmented_args->args);
@ -138,15 +148,13 @@ int sys_enter_connect(struct syscall_enter_args *args)
probe_read(&augmented_args->saddr, socklen, sockaddr_arg);
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len + socklen);
return augmented__output(args, augmented_args, len + socklen);
}
SEC("!syscalls:sys_enter_sendto")
int sys_enter_sendto(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *sockaddr_arg = (const void *)args->args[4];
unsigned int socklen = args->args[5];
unsigned int len = sizeof(augmented_args->args);
@ -159,49 +167,43 @@ int sys_enter_sendto(struct syscall_enter_args *args)
probe_read(&augmented_args->saddr, socklen, sockaddr_arg);
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len + socklen);
return augmented__output(args, augmented_args, len + socklen);
}
SEC("!syscalls:sys_enter_open")
int sys_enter_open(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *filename_arg = (const void *)args->args[0];
unsigned int len = sizeof(augmented_args->args);
if (augmented_args == NULL)
return 1; /* Failure: don't filter */
len += augmented_filename__read(&augmented_args->filename, filename_arg, sizeof(augmented_args->filename.value));
len += augmented_arg__read_str(&augmented_args->arg, filename_arg, sizeof(augmented_args->arg.value));
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len);
return augmented__output(args, augmented_args, len);
}
SEC("!syscalls:sys_enter_openat")
int sys_enter_openat(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *filename_arg = (const void *)args->args[1];
unsigned int len = sizeof(augmented_args->args);
if (augmented_args == NULL)
return 1; /* Failure: don't filter */
len += augmented_filename__read(&augmented_args->filename, filename_arg, sizeof(augmented_args->filename.value));
len += augmented_arg__read_str(&augmented_args->arg, filename_arg, sizeof(augmented_args->arg.value));
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len);
return augmented__output(args, augmented_args, len);
}
SEC("!syscalls:sys_enter_rename")
int sys_enter_rename(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *oldpath_arg = (const void *)args->args[0],
*newpath_arg = (const void *)args->args[1];
unsigned int len = sizeof(augmented_args->args), oldpath_len;
@ -209,18 +211,16 @@ int sys_enter_rename(struct syscall_enter_args *args)
if (augmented_args == NULL)
return 1; /* Failure: don't filter */
oldpath_len = augmented_filename__read(&augmented_args->filename, oldpath_arg, sizeof(augmented_args->filename.value));
len += oldpath_len + augmented_filename__read((void *)(&augmented_args->filename) + oldpath_len, newpath_arg, sizeof(augmented_args->filename.value));
oldpath_len = augmented_arg__read_str(&augmented_args->arg, oldpath_arg, sizeof(augmented_args->arg.value));
len += oldpath_len + augmented_arg__read_str((void *)(&augmented_args->arg) + oldpath_len, newpath_arg, sizeof(augmented_args->arg.value));
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len);
return augmented__output(args, augmented_args, len);
}
SEC("!syscalls:sys_enter_renameat")
int sys_enter_renameat(struct syscall_enter_args *args)
{
int key = 0;
struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
struct augmented_args_payload *augmented_args = augmented_args_payload();
const void *oldpath_arg = (const void *)args->args[1],
*newpath_arg = (const void *)args->args[3];
unsigned int len = sizeof(augmented_args->args), oldpath_len;
@ -228,11 +228,10 @@ int sys_enter_renameat(struct syscall_enter_args *args)
if (augmented_args == NULL)
return 1; /* Failure: don't filter */
oldpath_len = augmented_filename__read(&augmented_args->filename, oldpath_arg, sizeof(augmented_args->filename.value));
len += oldpath_len + augmented_filename__read((void *)(&augmented_args->filename) + oldpath_len, newpath_arg, sizeof(augmented_args->filename.value));
oldpath_len = augmented_arg__read_str(&augmented_args->arg, oldpath_arg, sizeof(augmented_args->arg.value));
len += oldpath_len + augmented_arg__read_str((void *)(&augmented_args->arg) + oldpath_len, newpath_arg, sizeof(augmented_args->arg.value));
/* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */
return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len);
return augmented__output(args, augmented_args, len);
}
SEC("raw_syscalls:sys_enter")
@ -250,15 +249,14 @@ int sys_enter(struct syscall_enter_args *args)
*/
unsigned int len = sizeof(augmented_args->args);
struct syscall *syscall;
int key = 0;
augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key);
if (augmented_args == NULL)
return 1;
if (pid_filter__has(&pids_filtered, getpid()))
return 0;
augmented_args = augmented_args_payload();
if (augmented_args == NULL)
return 1;
probe_read(&augmented_args->args, sizeof(augmented_args->args), args);
/*

View File

@ -0,0 +1,112 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LIBPERF_EVENT_H
#define __LIBPERF_EVENT_H
#include <linux/perf_event.h>
#include <linux/types.h>
#include <linux/limits.h>
#include <linux/bpf.h>
struct perf_record_mmap {
struct perf_event_header header;
__u32 pid, tid;
__u64 start;
__u64 len;
__u64 pgoff;
char filename[PATH_MAX];
};
struct perf_record_mmap2 {
struct perf_event_header header;
__u32 pid, tid;
__u64 start;
__u64 len;
__u64 pgoff;
__u32 maj;
__u32 min;
__u64 ino;
__u64 ino_generation;
__u32 prot;
__u32 flags;
char filename[PATH_MAX];
};
struct perf_record_comm {
struct perf_event_header header;
__u32 pid, tid;
char comm[16];
};
struct perf_record_namespaces {
struct perf_event_header header;
__u32 pid, tid;
__u64 nr_namespaces;
struct perf_ns_link_info link_info[];
};
struct perf_record_fork {
struct perf_event_header header;
__u32 pid, ppid;
__u32 tid, ptid;
__u64 time;
};
struct perf_record_lost {
struct perf_event_header header;
__u64 id;
__u64 lost;
};
struct perf_record_lost_samples {
struct perf_event_header header;
__u64 lost;
};
/*
* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
*/
struct perf_record_read {
struct perf_event_header header;
__u32 pid, tid;
__u64 value;
__u64 time_enabled;
__u64 time_running;
__u64 id;
};
struct perf_record_throttle {
struct perf_event_header header;
__u64 time;
__u64 id;
__u64 stream_id;
};
#ifndef KSYM_NAME_LEN
#define KSYM_NAME_LEN 256
#endif
struct perf_record_ksymbol {
struct perf_event_header header;
__u64 addr;
__u32 len;
__u16 ksym_type;
__u16 flags;
char name[KSYM_NAME_LEN];
};
struct perf_record_bpf_event {
struct perf_event_header header;
__u16 type;
__u16 flags;
__u32 id;
/* for bpf_prog types */
__u8 tag[BPF_TAG_SIZE]; // prog tag
};
struct perf_record_sample {
struct perf_event_header header;
__u64 array[];
};
#endif /* __LIBPERF_EVENT_H */

View File

@ -35,63 +35,6 @@ extern const char perf_version_string[];
void pthread__unblock_sigwinch(void);
#include "util/target.h"
struct record_opts {
struct target target;
bool group;
bool inherit_stat;
bool no_buffering;
bool no_inherit;
bool no_inherit_set;
bool no_samples;
bool raw_samples;
bool sample_address;
bool sample_phys_addr;
bool sample_weight;
bool sample_time;
bool sample_time_set;
bool sample_cpu;
bool period;
bool period_set;
bool running_time;
bool full_auxtrace;
bool auxtrace_snapshot_mode;
bool auxtrace_snapshot_on_exit;
bool record_namespaces;
bool record_switch_events;
bool all_kernel;
bool all_user;
bool kernel_callchains;
bool user_callchains;
bool tail_synthesize;
bool overwrite;
bool ignore_missing_thread;
bool strict_freq;
bool sample_id;
bool no_bpf_event;
unsigned int freq;
unsigned int mmap_pages;
unsigned int auxtrace_mmap_pages;
unsigned int user_freq;
u64 branch_stack;
u64 sample_intr_regs;
u64 sample_user_regs;
u64 default_interval;
u64 user_interval;
size_t auxtrace_snapshot_size;
const char *auxtrace_snapshot_opts;
bool sample_transaction;
unsigned initial_delay;
bool use_clockid;
clockid_t clockid;
u64 clockid_res_ns;
int nr_cblocks;
int affinity;
int mmap_flush;
unsigned int comp_level;
};
enum perf_affinity {
PERF_AFFINITY_SYS = 0,
PERF_AFFINITY_NODE,
@ -99,10 +42,5 @@ enum perf_affinity {
PERF_AFFINITY_MAX
};
struct option;
extern const char * const *record_usage;
extern struct option *record_options;
extern int version_verbose;
int record__parse_freq(const struct option *opt, const char *str, int unset);
#endif

View File

@ -4,9 +4,9 @@
* beginning
*/
#include <perf.h>
#include <evlist.h>
#include <sys/prctl.h>
#include "record.h"
#include "tests.h"
#include "debug.h"
#include <errno.h>

View File

@ -5,6 +5,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <util/record.h>
#include <util/util.h>
#include <util/bpf-loader.h>
#include <util/evlist.h>

View File

@ -20,6 +20,7 @@
#include "map.h"
#include "symbol.h"
#include "event.h"
#include "record.h"
#include "thread.h"
#include "tests.h"

View File

@ -8,6 +8,7 @@
#include "parse-events.h"
#include "evlist.h"
#include "evsel.h"
#include "record.h"
#include "thread_map.h"
#include "cpumap.h"
#include "tests.h"

View File

@ -1,12 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include <stdbool.h>
#include <linux/err.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "perf.h"
#include "evlist.h"
#include "evsel.h"
#include "thread_map.h"
#include "record.h"
#include "tests.h"
#include "debug.h"
#include <errno.h>

View File

@ -87,10 +87,10 @@ int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest _
},
.id = 2,
};
struct mmap_event event3 = {
struct perf_record_mmap event3 = {
.header = {
.type = PERF_RECORD_MMAP,
.size = sizeof(struct mmap_event),
.size = sizeof(struct perf_record_mmap),
},
};
union perf_event *events[] = {

View File

@ -7,8 +7,8 @@
#include <sched.h>
#include "evlist.h"
#include "evsel.h"
#include "perf.h"
#include "debug.h"
#include "record.h"
#include "tests.h"
static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)

View File

@ -13,7 +13,7 @@ skip_if_no_z_record() {
collect_z_record() {
echo "Collecting compressed record file:"
$perf_tool record -o $trace_file -g -z -F 5000 -- \
dd count=500 if=/dev/random of=/dev/null
dd count=500 if=/dev/urandom of=/dev/null
}
check_compressed_stats() {

View File

@ -13,6 +13,7 @@
#include "evsel.h"
#include "thread_map.h"
#include "cpumap.h"
#include "record.h"
#include "tests.h"
static int spin_sleep(void)

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "evlist.h"
#include "evsel.h"
#include "target.h"
#include "thread_map.h"
#include "cpumap.h"
#include "tests.h"

View File

@ -21,7 +21,7 @@
static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size)
{
static const char *ioctl_tty_cmd[] = {
"TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
[_IOC_NR(TCGETS)] = "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
"TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY",
"TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ",
"TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR",

View File

@ -6,6 +6,8 @@
#include "sort.h"
#include "config.h"
#include "time-utils.h"
#include "../util.h"
#include "../../util/util.h"
#include <linux/time64.h>
#include <linux/zalloc.h>

View File

@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "../../builtin.h"
#include "../../util/sort.h"
#include "../../util/util.h"
#include "../../util/hist.h"
#include "../../util/debug.h"
#include "../../util/symbol.h"
@ -131,8 +133,10 @@ static int list_scripts(char *script_name, bool *custom,
int key = ui_browser__input_window("perf script command",
"Enter perf script command line (without perf script prefix)",
script_args, "", 0);
if (key != K_ENTER)
return -1;
if (key != K_ENTER) {
ret = -1;
goto out;
}
sprintf(script_name, "%s script %s", perf, script_args);
} else if (choice < num + max_std) {
strcpy(script_name, paths[choice]);

View File

@ -3,6 +3,7 @@
#include <linux/string.h>
#include "../../util/callchain.h"
#include "../../util/debug.h"
#include "../../util/hist.h"
#include "../../util/map.h"
#include "../../util/map_groups.h"

View File

@ -1,6 +1,7 @@
perf-y += annotate.o
perf-y += block-range.o
perf-y += build-id.o
perf-y += cacheline.o
perf-y += config.o
perf-y += ctype.o
perf-y += db-export.o

View File

@ -22,6 +22,7 @@
#include "cache.h"
#include "map.h"
#include "symbol.h"
#include "srcline.h"
#include "units.h"
#include "debug.h"
#include "annotate.h"
@ -37,6 +38,7 @@
#include <linux/kernel.h>
#include <linux/string.h>
#include <bpf/libbpf.h>
#include <subcmd/parse-options.h>
/* FIXME: For the HE_COLORSET */
#include "ui/browser.h"

View File

@ -26,7 +26,6 @@
#include <linux/list.h>
#include <linux/zalloc.h>
#include "../perf.h"
#include "evlist.h"
#include "dso.h"
#include "map.h"
@ -41,6 +40,7 @@
#include <linux/hash.h>
#include "event.h"
#include "record.h"
#include "session.h"
#include "debug.h"
#include <subcmd/parse-options.h>

View File

@ -14,6 +14,7 @@
#include "session.h"
#include "map.h"
#include "evlist.h"
#include "record.h"
#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
@ -34,7 +35,7 @@ static int machine__process_bpf_event_load(struct machine *machine,
struct bpf_prog_info_linear *info_linear;
struct bpf_prog_info_node *info_node;
struct perf_env *env = machine->env;
int id = event->bpf_event.id;
int id = event->bpf.id;
unsigned int i;
/* perf-record, no need to handle bpf-event */
@ -63,14 +64,13 @@ static int machine__process_bpf_event_load(struct machine *machine,
return 0;
}
int machine__process_bpf_event(struct machine *machine __maybe_unused,
union perf_event *event,
struct perf_sample *sample __maybe_unused)
int machine__process_bpf(struct machine *machine, union perf_event *event,
struct perf_sample *sample)
{
if (dump_trace)
perf_event__fprintf_bpf_event(event, stdout);
perf_event__fprintf_bpf(event, stdout);
switch (event->bpf_event.type) {
switch (event->bpf.type) {
case PERF_BPF_EVENT_PROG_LOAD:
return machine__process_bpf_event_load(machine, event, sample);
@ -82,8 +82,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused,
*/
break;
default:
pr_debug("unexpected bpf_event type of %d\n",
event->bpf_event.type);
pr_debug("unexpected bpf event type of %d\n", event->bpf.type);
break;
}
return 0;
@ -160,8 +159,8 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
union perf_event *event,
struct record_opts *opts)
{
struct ksymbol_event *ksymbol_event = &event->ksymbol_event;
struct bpf_event *bpf_event = &event->bpf_event;
struct perf_record_ksymbol *ksymbol_event = &event->ksymbol;
struct perf_record_bpf_event *bpf_event = &event->bpf;
struct bpf_prog_info_linear *info_linear;
struct perf_tool *tool = session->tool;
struct bpf_prog_info_node *info_node;
@ -229,10 +228,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
__u64 *prog_addrs = (__u64 *)(uintptr_t)(info->jited_ksyms);
int name_len;
*ksymbol_event = (struct ksymbol_event){
*ksymbol_event = (struct perf_record_ksymbol) {
.header = {
.type = PERF_RECORD_KSYMBOL,
.size = offsetof(struct ksymbol_event, name),
.size = offsetof(struct perf_record_ksymbol, name),
},
.addr = prog_addrs[i],
.len = prog_lens[i],
@ -253,10 +252,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
if (!opts->no_bpf_event) {
/* Synthesize PERF_RECORD_BPF_EVENT */
*bpf_event = (struct bpf_event){
*bpf_event = (struct perf_record_bpf_event) {
.header = {
.type = PERF_RECORD_BPF_EVENT,
.size = sizeof(struct bpf_event),
.size = sizeof(struct perf_record_bpf_event),
},
.type = PERF_BPF_EVENT_PROG_LOAD,
.flags = 0,
@ -301,7 +300,7 @@ int perf_event__synthesize_bpf_events(struct perf_session *session,
int err;
int fd;
event = malloc(sizeof(event->bpf_event) + KSYM_NAME_LEN + machine->id_hdr_size);
event = malloc(sizeof(event->bpf) + KSYM_NAME_LEN + machine->id_hdr_size);
if (!event)
return -1;
while (true) {
@ -398,9 +397,9 @@ static int bpf_event__sb_cb(union perf_event *event, void *data)
if (event->header.type != PERF_RECORD_BPF_EVENT)
return -1;
switch (event->bpf_event.type) {
switch (event->bpf.type) {
case PERF_BPF_EVENT_PROG_LOAD:
perf_env__add_bpf_info(env, event->bpf_event.id);
perf_env__add_bpf_info(env, event->bpf.id);
case PERF_BPF_EVENT_PROG_UNLOAD:
/*
@ -410,8 +409,7 @@ static int bpf_event__sb_cb(union perf_event *event, void *data)
*/
break;
default:
pr_debug("unexpected bpf_event type of %d\n",
event->bpf_event.type);
pr_debug("unexpected bpf event type of %d\n", event->bpf.type);
break;
}

View File

@ -30,8 +30,8 @@ struct btf_node {
};
#ifdef HAVE_LIBBPF_SUPPORT
int machine__process_bpf_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_bpf(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int perf_event__synthesize_bpf_events(struct perf_session *session,
perf_event__handler_t process,
@ -43,9 +43,9 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
struct perf_env *env,
FILE *fp);
#else
static inline int machine__process_bpf_event(struct machine *machine __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused)
static inline int machine__process_bpf(struct machine *machine __maybe_unused,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused)
{
return 0;
}

View File

@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0
#include "cacheline.h"
#include "../perf.h"
#include <unistd.h>
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
#define cache_line_size(cacheline_sizep) *cacheline_sizep = sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
#else
#include <api/fs/fs.h>
#include "debug.h"
static void cache_line_size(int *cacheline_sizep)
{
if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep))
pr_debug("cannot determine cache line size");
}
#endif
int cacheline_size(void)
{
static int size;
if (!size)
cache_line_size(&size);
return size;
}

View File

@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef PERF_CACHELINE_H
#define PERF_CACHELINE_H
#include <linux/compiler.h>
int __pure cacheline_size(void);
static inline u64 cl_address(u64 address)
{
/* return the cacheline of the address */
return (address & ~(cacheline_size() - 1));
}
static inline u64 cl_offset(u64 address)
{
/* return the cacheline of the address */
return (address & (cacheline_size() - 1));
}
#endif // PERF_CACHELINE_H

View File

@ -20,6 +20,7 @@
#include "asm/bug.h"
#include "debug.h"
#include "hist.h"
#include "sort.h"
#include "machine.h"

View File

@ -7,8 +7,6 @@
#include <internal/cpumap.h>
#include <perf/cpumap.h>
#include "perf.h"
struct cpu_map_data;
struct perf_cpu_map *perf_cpu_map__empty_new(int nr);

View File

@ -9,7 +9,6 @@
#include <unistd.h>
#include <string.h>
#include <asm/bug.h>
#include <sys/types.h>
#include <dirent.h>
#include "data.h"

View File

@ -387,7 +387,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
strcpy(execname, "");
/* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */
n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %[^\n]\n",
n = sscanf(bf, "%"PRI_lx64"-%"PRI_lx64" %s %"PRI_lx64" %x:%x %u %[^\n]\n",
&event->mmap2.start, &event->mmap2.len, prot,
&event->mmap2.pgoff, &event->mmap2.maj,
&event->mmap2.min,
@ -1343,17 +1343,17 @@ int perf_event__process_ksymbol(struct perf_tool *tool __maybe_unused,
return machine__process_ksymbol(machine, event, sample);
}
int perf_event__process_bpf_event(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
struct machine *machine)
int perf_event__process_bpf(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
struct machine *machine)
{
return machine__process_bpf_event(machine, event, sample);
return machine__process_bpf(machine, event, sample);
}
size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
{
return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %c %s\n",
return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 "]: %c %s\n",
event->mmap.pid, event->mmap.tid, event->mmap.start,
event->mmap.len, event->mmap.pgoff,
(event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x',
@ -1362,8 +1362,8 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)
{
return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64
" %02x:%02x %"PRIu64" %"PRIu64"]: %c%c%c%c %s\n",
return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64
" %02x:%02x %"PRI_lu64" %"PRI_lu64"]: %c%c%c%c %s\n",
event->mmap2.pid, event->mmap2.tid, event->mmap2.start,
event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj,
event->mmap2.min, event->mmap2.ino,
@ -1480,22 +1480,21 @@ size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp)
static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp)
{
return fprintf(fp, " lost %" PRIu64 "\n", event->lost.lost);
return fprintf(fp, " lost %" PRI_lu64 "\n", event->lost.lost);
}
size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp)
{
return fprintf(fp, " addr %" PRIx64 " len %u type %u flags 0x%x name %s\n",
event->ksymbol_event.addr, event->ksymbol_event.len,
event->ksymbol_event.ksym_type,
event->ksymbol_event.flags, event->ksymbol_event.name);
return fprintf(fp, " addr %" PRI_lx64 " len %u type %u flags 0x%x name %s\n",
event->ksymbol.addr, event->ksymbol.len,
event->ksymbol.ksym_type,
event->ksymbol.flags, event->ksymbol.name);
}
size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp)
size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp)
{
return fprintf(fp, " type %u, flags %u, id %u\n",
event->bpf_event.type, event->bpf_event.flags,
event->bpf_event.id);
event->bpf.type, event->bpf.flags, event->bpf.id);
}
size_t perf_event__fprintf(union perf_event *event, FILE *fp)
@ -1537,7 +1536,7 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)
ret += perf_event__fprintf_ksymbol(event, fp);
break;
case PERF_RECORD_BPF_EVENT:
ret += perf_event__fprintf_bpf_event(event, fp);
ret += perf_event__fprintf_bpf(event, fp);
break;
default:
ret += fprintf(fp, "\n");

View File

@ -7,108 +7,26 @@
#include <linux/kernel.h>
#include <linux/bpf.h>
#include <linux/perf_event.h>
#include <perf/event.h>
#include "../perf.h"
#include "build-id.h"
#include "perf_regs.h"
struct mmap_event {
struct perf_event_header header;
u32 pid, tid;
u64 start;
u64 len;
u64 pgoff;
char filename[PATH_MAX];
};
struct mmap2_event {
struct perf_event_header header;
u32 pid, tid;
u64 start;
u64 len;
u64 pgoff;
u32 maj;
u32 min;
u64 ino;
u64 ino_generation;
u32 prot;
u32 flags;
char filename[PATH_MAX];
};
struct comm_event {
struct perf_event_header header;
u32 pid, tid;
char comm[16];
};
struct namespaces_event {
struct perf_event_header header;
u32 pid, tid;
u64 nr_namespaces;
struct perf_ns_link_info link_info[];
};
struct fork_event {
struct perf_event_header header;
u32 pid, ppid;
u32 tid, ptid;
u64 time;
};
struct lost_event {
struct perf_event_header header;
u64 id;
u64 lost;
};
struct lost_samples_event {
struct perf_event_header header;
u64 lost;
};
#ifdef __LP64__
/*
* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
* /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
* __u64 as long long unsigned int, and then -Werror=format= kicks in and
* complains of the mismatched types, so use these two special extra PRI
* macros to overcome that.
*/
struct read_event {
struct perf_event_header header;
u32 pid, tid;
u64 value;
u64 time_enabled;
u64 time_running;
u64 id;
};
struct throttle_event {
struct perf_event_header header;
u64 time;
u64 id;
u64 stream_id;
};
#ifndef KSYM_NAME_LEN
#define KSYM_NAME_LEN 256
#define PRI_lu64 "l" PRIu64
#define PRI_lx64 "l" PRIx64
#else
#define PRI_lu64 PRIu64
#define PRI_lx64 PRIx64
#endif
struct ksymbol_event {
struct perf_event_header header;
u64 addr;
u32 len;
u16 ksym_type;
u16 flags;
char name[KSYM_NAME_LEN];
};
struct bpf_event {
struct perf_event_header header;
u16 type;
u16 flags;
u32 id;
/* for bpf_prog types */
u8 tag[BPF_TAG_SIZE]; // prog tag
};
#define PERF_SAMPLE_MASK \
(PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
@ -119,11 +37,6 @@ struct bpf_event {
/* perf sample has 16 bits size limit */
#define PERF_SAMPLE_MAX_SIZE (1 << 16)
struct sample_event {
struct perf_event_header header;
u64 array[];
};
struct regs_dump {
u64 abi;
u64 mask;
@ -392,18 +305,18 @@ static inline void *perf_synth__raw_data(void *p)
* when possible sends this number in a PERF_RECORD_LOST event. The number of
* such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while
* total_lost tells exactly how many events the kernel in fact lost, i.e. it is
* the sum of all struct lost_event.lost fields reported.
* the sum of all struct perf_record_lost.lost fields reported.
*
* The kernel discards mixed up samples and sends the number in a
* PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored
* in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells
* exactly how many samples the kernel in fact dropped, i.e. it is the sum of
* all struct lost_samples_event.lost fields reported.
* all struct perf_record_lost_samples.lost fields reported.
*
* The total_period is needed because by default auto-freq is used, so
* multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get
* the total number of low level events, it is necessary to to sum all struct
* sample_event.period and stash the result in total_period.
* perf_record_sample.period and stash the result in total_period.
*/
struct events_stats {
u64 total_period;
@ -637,16 +550,18 @@ struct compressed_event {
union perf_event {
struct perf_event_header header;
struct mmap_event mmap;
struct mmap2_event mmap2;
struct comm_event comm;
struct namespaces_event namespaces;
struct fork_event fork;
struct lost_event lost;
struct lost_samples_event lost_samples;
struct read_event read;
struct throttle_event throttle;
struct sample_event sample;
struct perf_record_mmap mmap;
struct perf_record_mmap2 mmap2;
struct perf_record_comm comm;
struct perf_record_namespaces namespaces;
struct perf_record_fork fork;
struct perf_record_lost lost;
struct perf_record_lost_samples lost_samples;
struct perf_record_read read;
struct perf_record_throttle throttle;
struct perf_record_sample sample;
struct perf_record_bpf_event bpf;
struct perf_record_ksymbol ksymbol;
struct attr_event attr;
struct event_update_event event_update;
struct event_type_event event_type;
@ -666,8 +581,6 @@ union perf_event {
struct stat_round_event stat_round;
struct time_conv_event time_conv;
struct feature_event feat;
struct ksymbol_event ksymbol_event;
struct bpf_event bpf_event;
struct compressed_event pack;
};
@ -770,10 +683,10 @@ int perf_event__process_ksymbol(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct machine *machine);
int perf_event__process_bpf_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct machine *machine);
int perf_event__process_bpf(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct machine *machine);
int perf_tool__process_synth_event(struct perf_tool *tool,
union perf_event *event,
struct machine *machine,
@ -838,7 +751,7 @@ size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp);
size_t perf_event__fprintf(union perf_event *event, FILE *fp);
int kallsyms__get_function_start(const char *kallsyms_filename,

View File

@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
static int perf_evlist__event2id(struct evlist *evlist,
union perf_event *event, u64 *id)
{
const u64 *array = event->sample.array;
const __u64 *array = event->sample.array;
ssize_t n;
n = (event->header.size - sizeof(event->header)) >> 3;

View File

@ -34,6 +34,7 @@
#include "thread_map.h"
#include "target.h"
#include "perf_regs.h"
#include "record.h"
#include "debug.h"
#include "trace-event.h"
#include "stat.h"
@ -116,7 +117,7 @@ int __perf_evsel__sample_size(u64 sample_type)
*
* This function returns the position of the event id (PERF_SAMPLE_ID or
* PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of struct
* sample_event.
* perf_record_sample.
*/
static int __perf_evsel__calc_id_pos(u64 sample_type)
{
@ -1071,8 +1072,7 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
attr->mmap2 = track && !perf_missing_features.mmap2;
attr->comm = track;
attr->ksymbol = track && !perf_missing_features.ksymbol;
attr->bpf_event = track && !opts->no_bpf_event &&
!perf_missing_features.bpf_event;
attr->bpf_event = track && !opts->no_bpf_event && !perf_missing_features.bpf;
if (opts->record_namespaces)
attr->namespaces = track;
@ -1802,7 +1802,7 @@ fallback_missing_features:
evsel->core.attr.read_format &= ~(PERF_FORMAT_GROUP|PERF_FORMAT_ID);
if (perf_missing_features.ksymbol)
evsel->core.attr.ksymbol = 0;
if (perf_missing_features.bpf_event)
if (perf_missing_features.bpf)
evsel->core.attr.bpf_event = 0;
retry_sample_id:
if (perf_missing_features.sample_id_all)
@ -1919,8 +1919,8 @@ try_fallback:
perf_missing_features.aux_output = true;
pr_debug2("Kernel has no attr.aux_output support, bailing out\n");
goto out_close;
} else if (!perf_missing_features.bpf_event && evsel->core.attr.bpf_event) {
perf_missing_features.bpf_event = true;
} else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) {
perf_missing_features.bpf = true;
pr_debug2("switching off bpf_event\n");
goto fallback_missing_features;
} else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) {
@ -2008,7 +2008,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel,
struct perf_sample *sample)
{
u64 type = evsel->core.attr.sample_type;
const u64 *array = event->sample.array;
const __u64 *array = event->sample.array;
bool swapped = evsel->needs_swap;
union u64_swap u;
@ -2098,7 +2098,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
{
u64 type = evsel->core.attr.sample_type;
bool swapped = evsel->needs_swap;
const u64 *array;
const __u64 *array;
u16 max_size = event->header.size;
const void *endp = (void *)event + max_size;
u64 sz;
@ -2377,7 +2377,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel,
u64 *timestamp)
{
u64 type = evsel->core.attr.sample_type;
const u64 *array;
const __u64 *array;
if (!(type & PERF_SAMPLE_TIME))
return -1;
@ -2419,7 +2419,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel,
size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
u64 read_format)
{
size_t sz, result = sizeof(struct sample_event);
size_t sz, result = sizeof(struct perf_record_sample);
if (type & PERF_SAMPLE_IDENTIFIER)
result += sizeof(u64);
@ -2528,7 +2528,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
const struct perf_sample *sample)
{
u64 *array;
__u64 *array;
size_t sz;
/*
* used for cross-endian analysis. See git commit 65014ab3

View File

@ -107,7 +107,7 @@ struct xyarray;
* show the name used, not some alias.
* @id_pos: the position of the event id (PERF_SAMPLE_ID or
* PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of
* struct sample_event
* struct perf_record_sample
* @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or
* PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all
* is used there is an id sample appended to non-sample events
@ -194,7 +194,7 @@ struct perf_missing_features {
bool write_backward;
bool group_read;
bool ksymbol;
bool bpf_event;
bool bpf;
bool aux_output;
};

View File

@ -5,7 +5,6 @@
#include "get_current_dir_name.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>
/* Android's 'bionic' library, for one, doesn't have this */

View File

@ -193,7 +193,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3);
hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12);
hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12);
hists__new_col_len(hists, HISTC_TIME, 12);
if (symbol_conf.nanosecs)
hists__new_col_len(hists, HISTC_TIME, 16);
else
hists__new_col_len(hists, HISTC_TIME, 12);
if (h->srcline) {
len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header));

View File

@ -818,7 +818,7 @@ static int intel_bts_synth_events(struct intel_bts *bts,
* We only use sample types from PERF_SAMPLE_MASK so we can use
* __perf_evsel__sample_size() here.
*/
bts->branches_event_size = sizeof(struct sample_event) +
bts->branches_event_size = sizeof(struct perf_record_sample) +
__perf_evsel__sample_size(attr.sample_type);
}

View File

@ -2,9 +2,9 @@
#ifndef __PERF_KVM_STAT_H
#define __PERF_KVM_STAT_H
#include "../perf.h"
#include "tool.h"
#include "stat.h"
#include "record.h"
struct evsel;
struct evlist;

View File

@ -10,10 +10,13 @@
#include "hist.h"
#include "machine.h"
#include "map.h"
#include "srcline.h"
#include "symbol.h"
#include "sort.h"
#include "strlist.h"
#include "target.h"
#include "thread.h"
#include "util.h"
#include "vdso.h"
#include <stdbool.h>
#include <sys/types.h>
@ -642,7 +645,7 @@ int machine__process_namespaces_event(struct machine *machine __maybe_unused,
int machine__process_lost_event(struct machine *machine __maybe_unused,
union perf_event *event, struct perf_sample *sample __maybe_unused)
{
dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n",
dump_printf(": id:%" PRI_lu64 ": lost:%" PRI_lu64 "\n",
event->lost.id, event->lost.lost);
return 0;
}
@ -650,7 +653,7 @@ int machine__process_lost_event(struct machine *machine __maybe_unused,
int machine__process_lost_samples_event(struct machine *machine __maybe_unused,
union perf_event *event, struct perf_sample *sample)
{
dump_printf(": id:%" PRIu64 ": lost samples :%" PRIu64 "\n",
dump_printf(": id:%" PRIu64 ": lost samples :%" PRI_lu64 "\n",
sample->id, event->lost_samples.lost);
return 0;
}
@ -710,20 +713,20 @@ static int machine__process_ksymbol_register(struct machine *machine,
struct symbol *sym;
struct map *map;
map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr);
map = map_groups__find(&machine->kmaps, event->ksymbol.addr);
if (!map) {
map = dso__new_map(event->ksymbol_event.name);
map = dso__new_map(event->ksymbol.name);
if (!map)
return -ENOMEM;
map->start = event->ksymbol_event.addr;
map->end = map->start + event->ksymbol_event.len;
map->start = event->ksymbol.addr;
map->end = map->start + event->ksymbol.len;
map_groups__insert(&machine->kmaps, map);
}
sym = symbol__new(map->map_ip(map, map->start),
event->ksymbol_event.len,
0, 0, event->ksymbol_event.name);
event->ksymbol.len,
0, 0, event->ksymbol.name);
if (!sym)
return -ENOMEM;
dso__insert_symbol(map->dso, sym);
@ -736,7 +739,7 @@ static int machine__process_ksymbol_unregister(struct machine *machine,
{
struct map *map;
map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr);
map = map_groups__find(&machine->kmaps, event->ksymbol.addr);
if (map)
map_groups__remove(&machine->kmaps, map);
@ -750,7 +753,7 @@ int machine__process_ksymbol(struct machine *machine __maybe_unused,
if (dump_trace)
perf_event__fprintf_ksymbol(event, stdout);
if (event->ksymbol_event.flags & PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER)
if (event->ksymbol.flags & PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER)
return machine__process_ksymbol_unregister(machine, event,
sample);
return machine__process_ksymbol_register(machine, event, sample);
@ -1919,7 +1922,7 @@ int machine__process_event(struct machine *machine, union perf_event *event,
case PERF_RECORD_KSYMBOL:
ret = machine__process_ksymbol(machine, event, sample); break;
case PERF_RECORD_BPF_EVENT:
ret = machine__process_bpf_event(machine, event, sample); break;
ret = machine__process_bpf(machine, event, sample); break;
default:
ret = -1;
break;

View File

@ -14,6 +14,7 @@ struct branch_stack;
struct evsel;
struct perf_sample;
struct symbol;
struct target;
struct thread;
union perf_event;

View File

@ -19,7 +19,7 @@
#include <asm/bug.h>
#include <linux/zalloc.h>
struct namespaces *namespaces__new(struct namespaces_event *event)
struct namespaces *namespaces__new(struct perf_record_namespaces *event)
{
struct namespaces *namespaces;
u64 link_info_size = ((event ? event->nr_namespaces : NR_NAMESPACES) *

View File

@ -17,7 +17,7 @@
int setns(int fd, int nstype);
#endif
struct namespaces_event;
struct perf_record_namespaces;
struct namespaces {
struct list_head list;
@ -25,7 +25,7 @@ struct namespaces {
struct perf_ns_link_info link_info[];
};
struct namespaces *namespaces__new(struct namespaces_event *event);
struct namespaces *namespaces__new(struct perf_record_namespaces *event);
void namespaces__free(struct namespaces *namespaces);
struct nsinfo {

View File

@ -116,12 +116,12 @@ static PyMemberDef pyrf_mmap_event__members[] = {
sample_members
member_def(perf_event_header, type, T_UINT, "event type"),
member_def(perf_event_header, misc, T_UINT, "event misc"),
member_def(mmap_event, pid, T_UINT, "event pid"),
member_def(mmap_event, tid, T_UINT, "event tid"),
member_def(mmap_event, start, T_ULONGLONG, "start of the map"),
member_def(mmap_event, len, T_ULONGLONG, "map length"),
member_def(mmap_event, pgoff, T_ULONGLONG, "page offset"),
member_def(mmap_event, filename, T_STRING_INPLACE, "backing store"),
member_def(perf_record_mmap, pid, T_UINT, "event pid"),
member_def(perf_record_mmap, tid, T_UINT, "event tid"),
member_def(perf_record_mmap, start, T_ULONGLONG, "start of the map"),
member_def(perf_record_mmap, len, T_ULONGLONG, "map length"),
member_def(perf_record_mmap, pgoff, T_ULONGLONG, "page offset"),
member_def(perf_record_mmap, filename, T_STRING_INPLACE, "backing store"),
{ .name = NULL, },
};
@ -130,8 +130,8 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent)
PyObject *ret;
char *s;
if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRIx64 ", "
"length: %#" PRIx64 ", offset: %#" PRIx64 ", "
if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRI_lx64 ", "
"length: %#" PRI_lx64 ", offset: %#" PRI_lx64 ", "
"filename: %s }",
pevent->event.mmap.pid, pevent->event.mmap.tid,
pevent->event.mmap.start, pevent->event.mmap.len,
@ -159,18 +159,18 @@ static char pyrf_task_event__doc[] = PyDoc_STR("perf task (fork/exit) event obje
static PyMemberDef pyrf_task_event__members[] = {
sample_members
member_def(perf_event_header, type, T_UINT, "event type"),
member_def(fork_event, pid, T_UINT, "event pid"),
member_def(fork_event, ppid, T_UINT, "event ppid"),
member_def(fork_event, tid, T_UINT, "event tid"),
member_def(fork_event, ptid, T_UINT, "event ptid"),
member_def(fork_event, time, T_ULONGLONG, "timestamp"),
member_def(perf_record_fork, pid, T_UINT, "event pid"),
member_def(perf_record_fork, ppid, T_UINT, "event ppid"),
member_def(perf_record_fork, tid, T_UINT, "event tid"),
member_def(perf_record_fork, ptid, T_UINT, "event ptid"),
member_def(perf_record_fork, time, T_ULONGLONG, "timestamp"),
{ .name = NULL, },
};
static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent)
{
return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, "
"ptid: %u, time: %" PRIu64 "}",
"ptid: %u, time: %" PRI_lu64 "}",
pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit",
pevent->event.fork.pid,
pevent->event.fork.ppid,
@ -194,9 +194,9 @@ static char pyrf_comm_event__doc[] = PyDoc_STR("perf comm event object.");
static PyMemberDef pyrf_comm_event__members[] = {
sample_members
member_def(perf_event_header, type, T_UINT, "event type"),
member_def(comm_event, pid, T_UINT, "event pid"),
member_def(comm_event, tid, T_UINT, "event tid"),
member_def(comm_event, comm, T_STRING_INPLACE, "process name"),
member_def(perf_record_comm, pid, T_UINT, "event pid"),
member_def(perf_record_comm, tid, T_UINT, "event tid"),
member_def(perf_record_comm, comm, T_STRING_INPLACE, "process name"),
{ .name = NULL, },
};
@ -223,18 +223,18 @@ static char pyrf_throttle_event__doc[] = PyDoc_STR("perf throttle event object."
static PyMemberDef pyrf_throttle_event__members[] = {
sample_members
member_def(perf_event_header, type, T_UINT, "event type"),
member_def(throttle_event, time, T_ULONGLONG, "timestamp"),
member_def(throttle_event, id, T_ULONGLONG, "event id"),
member_def(throttle_event, stream_id, T_ULONGLONG, "event stream id"),
member_def(perf_record_throttle, time, T_ULONGLONG, "timestamp"),
member_def(perf_record_throttle, id, T_ULONGLONG, "event id"),
member_def(perf_record_throttle, stream_id, T_ULONGLONG, "event stream id"),
{ .name = NULL, },
};
static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent)
{
struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1);
struct perf_record_throttle *te = (struct perf_record_throttle *)(&pevent->event.header + 1);
return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64
", stream_id: %" PRIu64 " }",
return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRI_lu64 ", id: %" PRI_lu64
", stream_id: %" PRI_lu64 " }",
pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un",
te->time, te->id, te->stream_id);
}
@ -253,8 +253,8 @@ static char pyrf_lost_event__doc[] = PyDoc_STR("perf lost event object.");
static PyMemberDef pyrf_lost_event__members[] = {
sample_members
member_def(lost_event, id, T_ULONGLONG, "event id"),
member_def(lost_event, lost, T_ULONGLONG, "number of lost events"),
member_def(perf_record_lost, id, T_ULONGLONG, "event id"),
member_def(perf_record_lost, lost, T_ULONGLONG, "number of lost events"),
{ .name = NULL, },
};
@ -263,8 +263,8 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent)
PyObject *ret;
char *s;
if (asprintf(&s, "{ type: lost, id: %#" PRIx64 ", "
"lost: %#" PRIx64 " }",
if (asprintf(&s, "{ type: lost, id: %#" PRI_lx64 ", "
"lost: %#" PRI_lx64 " }",
pevent->event.lost.id, pevent->event.lost.lost) < 0) {
ret = PyErr_NoMemory();
} else {
@ -288,8 +288,8 @@ static char pyrf_read_event__doc[] = PyDoc_STR("perf read event object.");
static PyMemberDef pyrf_read_event__members[] = {
sample_members
member_def(read_event, pid, T_UINT, "event pid"),
member_def(read_event, tid, T_UINT, "event tid"),
member_def(perf_record_read, pid, T_UINT, "event pid"),
member_def(perf_record_read, tid, T_UINT, "event tid"),
{ .name = NULL, },
};

View File

@ -9,6 +9,7 @@
#include <perf/cpumap.h>
#include "util.h"
#include "cloexec.h"
#include "record.h"
typedef void (*setup_probe_fn_t)(struct evsel *evsel);

74
tools/perf/util/record.h Normal file
View File

@ -0,0 +1,74 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _PERF_RECORD_H
#define _PERF_RECORD_H
#include <time.h>
#include <stdbool.h>
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/perf_event.h>
#include "util/target.h"
struct option;
struct record_opts {
struct target target;
bool group;
bool inherit_stat;
bool no_buffering;
bool no_inherit;
bool no_inherit_set;
bool no_samples;
bool raw_samples;
bool sample_address;
bool sample_phys_addr;
bool sample_weight;
bool sample_time;
bool sample_time_set;
bool sample_cpu;
bool period;
bool period_set;
bool running_time;
bool full_auxtrace;
bool auxtrace_snapshot_mode;
bool auxtrace_snapshot_on_exit;
bool record_namespaces;
bool record_switch_events;
bool all_kernel;
bool all_user;
bool kernel_callchains;
bool user_callchains;
bool tail_synthesize;
bool overwrite;
bool ignore_missing_thread;
bool strict_freq;
bool sample_id;
bool no_bpf_event;
unsigned int freq;
unsigned int mmap_pages;
unsigned int auxtrace_mmap_pages;
unsigned int user_freq;
u64 branch_stack;
u64 sample_intr_regs;
u64 sample_user_regs;
u64 default_interval;
u64 user_interval;
size_t auxtrace_snapshot_size;
const char *auxtrace_snapshot_opts;
bool sample_transaction;
unsigned initial_delay;
bool use_clockid;
clockid_t clockid;
u64 clockid_res_ns;
int nr_cblocks;
int affinity;
int mmap_flush;
unsigned int comp_level;
};
extern const char * const *record_usage;
extern struct option *record_options;
int record__parse_freq(const struct option *opt, const char *str, int unset);
#endif // _PERF_RECORD_H

View File

@ -473,8 +473,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
tool->context_switch = perf_event__process_switch;
if (tool->ksymbol == NULL)
tool->ksymbol = perf_event__process_ksymbol;
if (tool->bpf_event == NULL)
tool->bpf_event = perf_event__process_bpf_event;
if (tool->bpf == NULL)
tool->bpf = perf_event__process_bpf;
if (tool->read == NULL)
tool->read = process_event_sample_stub;
if (tool->throttle == NULL)
@ -1254,13 +1254,13 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
static void dump_read(struct evsel *evsel, union perf_event *event)
{
struct read_event *read_event = &event->read;
struct perf_record_read *read_event = &event->read;
u64 read_format;
if (!dump_trace)
return;
printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
printf(": %d %d %s %" PRI_lu64 "\n", event->read.pid, event->read.tid,
perf_evsel__name(evsel),
event->read.value);
@ -1270,13 +1270,13 @@ static void dump_read(struct evsel *evsel, union perf_event *event)
read_format = evsel->core.attr.read_format;
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
printf("... time enabled : %" PRIu64 "\n", read_event->time_enabled);
printf("... time enabled : %" PRI_lu64 "\n", read_event->time_enabled);
if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
printf("... time running : %" PRIu64 "\n", read_event->time_running);
printf("... time running : %" PRI_lu64 "\n", read_event->time_running);
if (read_format & PERF_FORMAT_ID)
printf("... id : %" PRIu64 "\n", read_event->id);
printf("... id : %" PRI_lu64 "\n", read_event->id);
}
static struct machine *machines__find_for_cpumode(struct machines *machines,
@ -1452,7 +1452,7 @@ static int machines__deliver_event(struct machines *machines,
case PERF_RECORD_KSYMBOL:
return tool->ksymbol(tool, event, sample, machine);
case PERF_RECORD_BPF_EVENT:
return tool->bpf_event(tool, event, sample, machine);
return tool->bpf(tool, event, sample, machine);
default:
++evlist->stats.nr_unknown_events;
return -1;

View File

@ -6,12 +6,14 @@
#include <linux/time64.h>
#include "sort.h"
#include "hist.h"
#include "cacheline.h"
#include "comm.h"
#include "map.h"
#include "symbol.h"
#include "thread.h"
#include "evsel.h"
#include "evlist.h"
#include "srcline.h"
#include "strlist.h"
#include "strbuf.h"
#include <traceevent/event-parse.h>
@ -668,17 +670,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right)
static int hist_entry__time_snprintf(struct hist_entry *he, char *bf,
size_t size, unsigned int width)
{
unsigned long secs;
unsigned long long nsecs;
char he_time[32];
nsecs = he->time;
secs = nsecs / NSEC_PER_SEC;
nsecs -= secs * NSEC_PER_SEC;
if (symbol_conf.nanosecs)
snprintf(he_time, sizeof he_time, "%5lu.%09llu: ",
secs, nsecs);
timestamp__scnprintf_nsec(he->time, he_time,
sizeof(he_time));
else
timestamp__scnprintf_usec(he->time, he_time,
sizeof(he_time));

View File

@ -1,29 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __PERF_SORT_H
#define __PERF_SORT_H
#include "../builtin.h"
#include <regex.h>
#include "color.h"
#include <stdbool.h>
#include <linux/list.h>
#include "cache.h"
#include <linux/rbtree.h>
#include "map_symbol.h"
#include "symbol_conf.h"
#include "string.h"
#include "callchain.h"
#include "values.h"
#include "../perf.h"
#include "debug.h"
#include "header.h"
#include <subcmd/parse-options.h>
#include "parse-events.h"
#include "hist.h"
#include "srcline.h"
struct option;
struct thread;
extern regex_t parent_regex;
@ -204,18 +193,6 @@ static inline float hist_entry__get_percent_limit(struct hist_entry *he)
return period * 100.0 / total_period;
}
static inline u64 cl_address(u64 address)
{
/* return the cacheline of the address */
return (address & ~(cacheline_size() - 1));
}
static inline u64 cl_offset(u64 address)
{
/* return the cacheline of the address */
return (address & (cacheline_size() - 1));
}
enum sort_mode {
SORT_MODE__NORMAL,
SORT_MODE__BRANCH,

View File

@ -14,7 +14,6 @@
#include "string2.h"
#include <linux/ctype.h>
#include "cgroup.h"
#include <math.h>
#include <api/fs/fs.h>
#define CNTR_NOT_SUPPORTED "<not supported>"

View File

@ -4,6 +4,7 @@
#include <math.h>
#include "counts.h"
#include "stat.h"
#include "target.h"
#include "evlist.h"
#include "evsel.h"
#include "thread_map.h"

View File

@ -5,13 +5,12 @@
#include <linux/types.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include "rblist.h"
#include "perf.h"
#include "event.h"
struct timespec;
struct stats {
double n, mean, M2;
u64 max, min;
@ -199,6 +198,8 @@ int perf_stat_process_counter(struct perf_stat_config *config,
struct perf_tool;
union perf_event;
struct perf_session;
struct target;
int perf_event__process_stat_event(struct perf_session *session,
union perf_event *event);

View File

@ -169,7 +169,7 @@ struct namespaces *thread__namespaces(struct thread *thread)
}
static int __thread__set_namespaces(struct thread *thread, u64 timestamp,
struct namespaces_event *event)
struct perf_record_namespaces *event)
{
struct namespaces *new, *curr = __thread__namespaces(thread);
@ -193,7 +193,7 @@ static int __thread__set_namespaces(struct thread *thread, u64 timestamp,
}
int thread__set_namespaces(struct thread *thread, u64 timestamp,
struct namespaces_event *event)
struct perf_record_namespaces *event)
{
int ret;

View File

@ -16,7 +16,7 @@
struct addr_location;
struct map;
struct namespaces_event;
struct perf_record_namespaces;
struct thread_stack;
struct unwind_libunwind_ops;
@ -74,7 +74,7 @@ static inline void thread__exited(struct thread *thread)
struct namespaces *thread__namespaces(struct thread *thread);
int thread__set_namespaces(struct thread *thread, u64 timestamp,
struct namespaces_event *event);
struct perf_record_namespaces *event);
int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp,
bool exec);

View File

@ -56,7 +56,7 @@ struct perf_tool {
throttle,
unthrottle,
ksymbol,
bpf_event;
bpf;
event_attr_op attr;
event_attr_op event_update;

View File

@ -5,6 +5,7 @@
#include "tool.h"
#include "evswitch.h"
#include "annotate.h"
#include "record.h"
#include <linux/types.h>
#include <stddef.h>
#include <stdbool.h>

View File

@ -43,26 +43,6 @@ void perf_set_multithreaded(void)
unsigned int page_size;
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
#define cache_line_size(cacheline_sizep) *cacheline_sizep = sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
#else
static void cache_line_size(int *cacheline_sizep)
{
if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep))
pr_debug("cannot determine cache line size");
}
#endif
int cacheline_size(void)
{
static int size;
if (!size)
cache_line_size(&size);
return size;
}
int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH;
int sysctl_perf_event_max_contexts_per_stack = PERF_MAX_CONTEXTS_PER_STACK;

View File

@ -34,7 +34,6 @@ int copyfile_offset(int ifd, loff_t off_in, int ofd, loff_t off_out, u64 size);
size_t hex_width(u64 v);
extern unsigned int page_size;
int __pure cacheline_size(void);
int sysctl__max_stack(void);