perf/core cleanups: (Arnaldo Carvalho de Melo)

. Introduce new header files out of the hodge-podge that util/util.h
   became, trying to disentangle the includes hell that all C projects
   end up growing. This should help in build times, as changes to
   seemingly unrelated files (util.h included tons of headers) won't
   trigger a rebuild of most object files.
 
 . Use equivalent facilities found in the kernel source code base
   originated tools/include/ header files, such as __stringify(),
   ARRAY_SIZE, that has extra checks (__must_be_array()), etc.
 
 . For that get some more files from the kernel sources, like
   include/linux/bug.h, some just with the bits needed at this time.
 
 . Use the headers where facilities declared in them are used, such
   as PRIxu(32,64) macros (inttypes.h), errno defines (errno.h), etc.
 
 . Remove various leftovers from the initial code base we copied from
   git.git: FLEX_ARRAY, etc.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJY94vHAAoJENZQFvNTUqpApsQP/2CFwmLr+5ofbBFZtm3LmZuE
 tp+bVDCeS9+HIBd+hqyIQrvEQvXiGdX1Pv+X21IGzLBxNSKP3miAg4qeDOP14MZR
 uzMREAQlRmIlYAKI8ECb7tV1txT2qOr4hva+D8qzkFjKIu31w+xsJi/LUoos6rg8
 SP67xEP4HX6nOnTKWM+gl55YjyPFa5WI6cWuYSTdgSJ0ts+gB1b9Dgc0L5NX29+H
 BQ+us802TjJo3sMDYE+3Mu701h6fc8EE2w0/iTxNMXFnOb6KfalyIYNI89okxjXf
 GXAZvbp10xnXYSYORDg0uA1RwiMhXXxBOn0+TWh8Vy3B9fmZnhxVVZPZVP/6UEgB
 kCXinKdAIIFO8c+m0K1VfN1F65dozKLaqD3SlOvqZ1yQi973WMG+I0H/Vpnc3mDe
 h8dRIJepKUrTjgtusBLN3T0oR5a1MFNYIf06gsCCfa0A6xYt8mzVr9hk2s0FsIRq
 8h15jKNq/vlQQly2/MGP1/j2G5IQYuPKGXxlmUapoJuu3I6MLsudFpPEQRMlf8dm
 l1oeoXxfqKjXAJl4t0i9QCw8OnZCPu3W9tQ3BPb7e+Q8FsFVXGW/K2BClRHet4hX
 0BbSfZmR+mEGTmzH0JBxT4jDa2F3Dp1w49GYh4yu2H83eGLlmUYoSHTipJ34KVjd
 0sW9brMyxrw+/2KAAvn/
 =W109
 -----END PGP SIGNATURE-----

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

Pull perf/core cleanups from Arnaldo Carvalho de Melo:

 - Introduce new header files out of the hodge-podge that util/util.h
   became, trying to disentangle the includes hell that all C projects
   end up growing. This should help in build times, as changes to
   seemingly unrelated files (util.h included tons of headers) won't
   trigger a rebuild of most object files.

 - Use equivalent facilities found in the kernel source code base
   originated tools/include/ header files, such as __stringify(),
   ARRAY_SIZE, that has extra checks (__must_be_array()), etc.

 - For that get some more files from the kernel sources, like
   include/linux/bug.h, some just with the bits needed at this time.

 - Use the headers where facilities declared in them are used, such
   as PRIxu(32,64) macros (inttypes.h), errno defines (errno.h), etc.

 - Remove various leftovers from the initial code base we copied from
   git.git: FLEX_ARRAY, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ingo Molnar 2017-04-20 10:07:18 +02:00
commit 07590a7d40
180 changed files with 658 additions and 375 deletions

10
tools/include/linux/bug.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _TOOLS_PERF_LINUX_BUG_H
#define _TOOLS_PERF_LINUX_BUG_H
/* Force a compilation error if condition is true, but also produce a
result (of value 0 and type size_t), so the expression can be used
e.g. in a structure initializer (or where-ever else comma expressions
aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
#endif /* _TOOLS_PERF_LINUX_BUG_H */

View File

@ -16,3 +16,6 @@
#if GCC_VERSION >= 40300
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* GCC_VERSION >= 40300 */
/* &a[0] degrades to a pointer: a different type from an array */
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

View File

@ -17,6 +17,11 @@
# define __always_inline inline __attribute__((always_inline))
#endif
/* Are two types/vars the same type (ignoring qualifiers)? */
#ifndef __same_type
# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#endif
#ifdef __ANDROID__
/*
* FIXME: Big hammer to get rid of tons of:

View File

@ -13,10 +13,6 @@
#include <linux/hash.h>
#include <linux/log2.h>
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#define DEFINE_HASHTABLE(name, bits) \
struct hlist_head name[1 << (bits)] = \
{ [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }

View File

@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <assert.h>
#include <linux/compiler.h>
#ifndef UINT_MAX
#define UINT_MAX (~0U)
@ -76,6 +77,8 @@
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
int scnprintf(char * buf, size_t size, const char * fmt, ...);
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
/*
* This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be

View File

@ -12,6 +12,9 @@
#ifndef _TOOLS_LINUX_LOG2_H
#define _TOOLS_LINUX_LOG2_H
#include <linux/bitops.h>
#include <linux/types.h>
/*
* non-constant log of base 2 calculators
* - the arch may override these in asm/bitops.h if they can be implemented

View File

@ -1,3 +1,4 @@
#include <ctype.h>
#include "symbol/kallsyms.h"
#include <stdio.h>
#include <stdlib.h>

View File

@ -36,8 +36,7 @@
#include "warn.h"
#include <linux/hashtable.h>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#include <linux/kernel.h>
#define STATE_FP_SAVED 0x1
#define STATE_FP_SETUP 0x2

View File

@ -31,11 +31,10 @@
#include <stdlib.h>
#include <subcmd/exec-cmd.h>
#include <subcmd/pager.h>
#include <linux/kernel.h>
#include "builtin.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
struct cmd_struct {
const char *name;
int (*fn)(int, const char **);

View File

@ -64,6 +64,7 @@ tools/include/linux/bitops.h
tools/include/linux/compiler.h
tools/include/linux/compiler-gcc.h
tools/include/linux/coresight-pmu.h
tools/include/linux/bug.h
tools/include/linux/filter.h
tools/include/linux/hash.h
tools/include/linux/kernel.h

View File

@ -9,6 +9,7 @@
*/
#include <stddef.h>
#include <linux/stringify.h>
#include <dwarf-regs.h>
struct pt_regs_dwarfnum {
@ -16,10 +17,9 @@ struct pt_regs_dwarfnum {
unsigned int dwarfnum;
};
#define STR(s) #s
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \
{.name = STR(%r##num), .dwarfnum = num}
{.name = __stringify(%r##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
/*

View File

@ -8,9 +8,11 @@
* published by the Free Software Foundation.
*/
#include <errno.h>
#include <stddef.h>
#include <dwarf-regs.h>
#include <linux/ptrace.h> /* for struct user_pt_regs */
#include <linux/stringify.h>
#include "util.h"
struct pt_regs_dwarfnum {
@ -20,7 +22,7 @@ struct pt_regs_dwarfnum {
#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
#define GPR_DWARFNUM_NAME(num) \
{.name = STR(%x##num), .dwarfnum = num}
{.name = __stringify(%x##num), .dwarfnum = num}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
#define DWARFNUM2OFFSET(index) \
(index * sizeof((struct user_pt_regs *)0)->regs[0])

View File

@ -1,6 +1,6 @@
#include <errno.h>
#ifndef REMOTE_UNWIND_LIBUNWIND
#include <errno.h>
#include <libunwind.h>
#include "perf_regs.h"
#include "../../util/unwind.h"

View File

@ -4,6 +4,8 @@
#include "../util/util.h"
#include "../util/debug.h"
#include "sane_ctype.h"
const char *const arm_triplets[] = {
"arm-eabi-",
"arm-linux-androideabi-",

View File

@ -15,6 +15,7 @@
#include <dwarf-regs.h>
#include <linux/ptrace.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include "util.h"
struct pt_regs_dwarfnum {
@ -24,10 +25,10 @@ struct pt_regs_dwarfnum {
};
#define REG_DWARFNUM_NAME(r, num) \
{.name = STR(%)STR(r), .dwarfnum = num, \
{.name = __stringify(%)__stringify(r), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, r)}
#define GPR_DWARFNUM_NAME(num) \
{.name = STR(%gpr##num), .dwarfnum = num, \
{.name = __stringify(%gpr##num), .dwarfnum = num, \
.ptregs_offset = offsetof(struct pt_regs, gpr[num])}
#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include "util/kvm-stat.h"
#include "util/parse-events.h"
#include "util/debug.h"

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include <string.h>
#include <regex.h>

View File

@ -9,6 +9,7 @@
* as published by the Free Software Foundation.
*/
#include <errno.h>
#include "../../util/kvm-stat.h"
#include <asm/sie.h>

View File

@ -7,6 +7,7 @@
#include "arch-tests.h"
#include <sys/mman.h>
#include <errno.h>
#include <string.h>
static pid_t spawn(void)

View File

@ -1,3 +1,5 @@
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <linux/types.h>

View File

@ -13,6 +13,7 @@
*
*/
#include <errno.h>
#include <stdbool.h>
#include "../../util/header.h"

View File

@ -13,6 +13,7 @@
*
*/
#include <errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/bitops.h>

View File

@ -13,6 +13,7 @@
*
*/
#include <errno.h>
#include <stdbool.h>
#include <linux/kernel.h>
#include <linux/types.h>

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include "../../util/kvm-stat.h"
#include <asm/svm.h>
#include <asm/vmx.h>

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include <string.h>
#include <regex.h>

View File

@ -12,6 +12,7 @@
#include <subcmd/parse-options.h>
#include "../util/header.h"
#include "../util/cloexec.h"
#include "../util/string2.h"
#include "bench.h"
#include "mem-memcpy-arch.h"
#include "mem-memset-arch.h"

View File

@ -4,6 +4,7 @@
* numa: Simulate NUMA-sensitive workload and measure their NUMA performance
*/
#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>
@ -30,6 +31,7 @@
#include <sys/wait.h>
#include <sys/prctl.h>
#include <sys/types.h>
#include <linux/kernel.h>
#include <linux/time64.h>
#include <numa.h>

View File

@ -33,6 +33,7 @@
#include "util/block-range.h"
#include <dlfcn.h>
#include <errno.h>
#include <linux/bitmap.h>
struct perf_annotate {

View File

@ -10,6 +10,7 @@
#include <sys/time.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include "builtin.h"
#include "perf.h"

View File

@ -16,6 +16,7 @@
#include "util/session.h"
#include "util/symbol.h"
#include "util/data.h"
#include <errno.h>
static int sysfs__fprintf_build_id(FILE *fp)
{

View File

@ -9,6 +9,8 @@
* Dick Fowles <fowles@inreach.com>
* Joe Mario <jmario@redhat.com>
*/
#include <errno.h>
#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/stringify.h>

View File

@ -19,6 +19,8 @@
#include "util/data.h"
#include "util/config.h"
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <math.h>

View File

@ -9,12 +9,14 @@
#include "builtin.h"
#include "perf.h"
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include "debug.h"
#include <subcmd/parse-options.h>
#include <api/fs/tracing_path.h>
#include "evlist.h"
#include "target.h"
#include "cpumap.h"

View File

@ -12,16 +12,18 @@
#include <subcmd/run-command.h>
#include <subcmd/help.h>
#include "util/debug.h"
#include <linux/kernel.h>
#include <errno.h>
static struct man_viewer_list {
struct man_viewer_list *next;
char name[FLEX_ARRAY];
char name[0];
} *man_viewer_list;
static struct man_viewer_info_list {
struct man_viewer_info_list *next;
const char *info;
char name[FLEX_ARRAY];
char name[0];
} *man_viewer_info_list;
enum help_format {

View File

@ -22,6 +22,7 @@
#include <subcmd/parse-options.h>
#include <linux/list.h>
#include <errno.h>
struct perf_inject {
struct perf_tool tool;

View File

@ -7,6 +7,7 @@
*
* Released under the GPL v2. (and only v2, not any later version)
*/
#include <inttypes.h>
#include "builtin.h"
#include <linux/compiler.h>
#include <subcmd/parse-options.h>

View File

@ -20,11 +20,16 @@
#include "util/debug.h"
#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/string.h>
#include <errno.h>
#include <inttypes.h>
#include <locale.h>
#include <regex.h>
#include "sane_ctype.h"
static int kmem_slab;
static int kmem_page;

View File

@ -3,6 +3,7 @@
#include "util/evsel.h"
#include "util/evlist.h"
#include "util/term.h"
#include "util/util.h"
#include "util/cache.h"
#include "util/symbol.h"
@ -24,7 +25,10 @@
#include <sys/timerfd.h>
#endif
#include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h>
#include <inttypes.h>
#include <termios.h>
#include <semaphore.h>
#include <pthread.h>

View File

@ -1,3 +1,5 @@
#include <errno.h>
#include <inttypes.h>
#include "builtin.h"
#include "perf.h"
@ -26,6 +28,7 @@
#include <linux/list.h>
#include <linux/hash.h>
#include <linux/kernel.h>
static struct perf_session *session;

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include "builtin.h"
#include "perf.h"

View File

@ -40,6 +40,8 @@
#include "util/perf-hooks.h"
#include "asm/bug.h"
#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
#include <sched.h>
#include <sys/mman.h>

View File

@ -16,7 +16,6 @@
#include <linux/rbtree.h>
#include "util/symbol.h"
#include "util/callchain.h"
#include "util/strlist.h"
#include "util/values.h"
#include "perf.h"
@ -40,6 +39,9 @@
#include "util/auxtrace.h"
#include <dlfcn.h>
#include <errno.h>
#include <inttypes.h>
#include <regex.h>
#include <linux/bitmap.h>
#include <linux/stringify.h>

View File

@ -22,16 +22,21 @@
#include "util/debug.h"
#include <linux/kernel.h>
#include <linux/log2.h>
#include <sys/prctl.h>
#include <sys/resource.h>
#include <inttypes.h>
#include <errno.h>
#include <semaphore.h>
#include <pthread.h>
#include <math.h>
#include <api/fs/fs.h>
#include <linux/time64.h>
#include "sane_ctype.h"
#define PR_SET_NAME 15 /* Set process name */
#define MAX_CPUS 4096
#define COMM_LEN 20

View File

@ -21,14 +21,22 @@
#include "util/cpumap.h"
#include "util/thread_map.h"
#include "util/stat.h"
#include "util/string2.h"
#include "util/thread-stack.h"
#include "util/time-utils.h"
#include "print_binary.h"
#include <linux/bitmap.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include "asm/bug.h"
#include "util/mem-events.h"
#include "util/dump-insn.h"
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include "sane_ctype.h"
static char const *script_name;
static char const *generate_script_lang;

View File

@ -64,15 +64,20 @@
#include "util/session.h"
#include "util/tool.h"
#include "util/group.h"
#include "util/string2.h"
#include "asm/bug.h"
#include <linux/time64.h>
#include <api/fs/fs.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/prctl.h>
#include <inttypes.h>
#include <locale.h>
#include <math.h>
#include "sane_ctype.h"
#define DEFAULT_SEPARATOR " "
#define CNTR_NOT_SUPPORTED "<not supported>"
#define CNTR_NOT_COUNTED "<not counted>"

View File

@ -12,6 +12,8 @@
* of the License.
*/
#include <errno.h>
#include <inttypes.h>
#include <traceevent/event-parse.h>
#include "builtin.h"
@ -23,11 +25,11 @@
#include "util/cache.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include <linux/kernel.h>
#include <linux/rbtree.h>
#include <linux/time64.h>
#include "util/symbol.h"
#include "util/callchain.h"
#include "util/strlist.h"
#include "perf.h"
#include "util/header.h"

View File

@ -40,6 +40,7 @@
#include "util/cpumap.h"
#include "util/xyarray.h"
#include "util/sort.h"
#include "util/term.h"
#include "util/intlist.h"
#include "util/parse-branch-options.h"
#include "arch/common.h"
@ -72,6 +73,8 @@
#include <linux/time64.h>
#include <linux/types.h>
#include "sane_ctype.h"
static volatile int done;
#define HEADER_LINE_NR 5

View File

@ -24,6 +24,7 @@
#include "util/evlist.h"
#include <subcmd/exec-cmd.h>
#include "util/machine.h"
#include "util/path.h"
#include "util/session.h"
#include "util/thread.h"
#include <subcmd/parse-options.h>
@ -36,19 +37,26 @@
#include "util/parse-events.h"
#include "util/bpf-loader.h"
#include "callchain.h"
#include "print_binary.h"
#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
#include <errno.h>
#include <inttypes.h>
#include <libaudit.h> /* FIXME: Still needed for audit_errno_to_name */
#include <stdlib.h>
#include <string.h>
#include <linux/err.h>
#include <linux/filter.h>
#include <linux/audit.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include "sane_ctype.h"
#ifndef O_CLOEXEC
# define O_CLOEXEC 02000000
#endif

View File

@ -19,9 +19,11 @@
#include "util/debug.h"
#include <api/fs/fs.h>
#include <api/fs/tracing_path.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
#include <linux/kernel.h>
const char perf_usage_string[] =
"perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
@ -327,16 +329,6 @@ static void handle_internal_command(int argc, const char **argv)
{
const char *cmd = argv[0];
unsigned int i;
static const char ext[] = STRIP_EXTENSION;
if (sizeof(ext) > 1) {
i = strlen(argv[0]) - strlen(ext);
if (i > 0 && !strcmp(argv[0] + i, ext)) {
char *argv0 = strdup(argv[0]);
argv[0] = cmd = argv0;
argv0[i] = '\0';
}
}
/* Turn "perf cmd --help" into "perf help cmd" */
if (argc > 1 && !strcmp(argv[1], "--help")) {

View File

@ -18,6 +18,8 @@
* permissions. All the event text files are stored there.
*/
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/types.h>

View File

@ -8,6 +8,7 @@
#include <sys/prctl.h>
#include "tests.h"
#include "debug.h"
#include <errno.h>
#define NR_ITERS 111

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <util/util.h>
@ -5,6 +6,7 @@
#include <util/evlist.h>
#include <linux/bpf.h>
#include <linux/filter.h>
#include <linux/kernel.h>
#include <api/fs/fs.h>
#include <bpf/bpf.h>
#include "tests.h"

View File

@ -3,6 +3,7 @@
*
* Builtin regression testing command: ever growing number of sanity tests
*/
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include "builtin.h"
@ -13,6 +14,7 @@
#include "color.h"
#include <subcmd/parse-options.h>
#include "symbol.h"
#include <linux/kernel.h>
static bool dont_fork;

View File

@ -2,6 +2,7 @@
#include "debug.h"
#include "util.h"
#include "c++/clang-c.h"
#include <linux/kernel.h>
static struct {
int (*func)(void);

View File

@ -1,8 +1,10 @@
#include <errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "parse-events.h"
@ -16,6 +18,8 @@
#include "tests.h"
#include "sane_ctype.h"
#define BUFSZ 1024
#define READLEN 128

View File

@ -1,4 +1,6 @@
#include <dirent.h>
#include <stdlib.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -1,5 +1,6 @@
#include <linux/compiler.h>
#include <linux/types.h>
#include <inttypes.h>
#include <unistd.h>
#include "tests.h"
#include "debug.h"

View File

@ -1,4 +1,6 @@
#include <linux/compiler.h>
#include <errno.h>
#include <inttypes.h>
#include <string.h>
#include "tests.h"
#include "evlist.h"

View File

@ -3,6 +3,8 @@
#include "parse-events.h"
#include "tests.h"
#include "debug.h"
#include <errno.h>
#include <linux/kernel.h>
static int perf_evsel__roundtrip_cache_name_test(void)
{

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include "perf.h"
#include "util/debug.h"
#include "util/symbol.h"
@ -7,6 +8,7 @@
#include "util/machine.h"
#include "util/thread.h"
#include "tests/hists_common.h"
#include <linux/kernel.h>
static struct {
u32 pid;

View File

@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
#include <linux/kernel.h>
struct sample {
u32 pid;

View File

@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
#include <linux/kernel.h>
struct sample {
u32 pid;

View File

@ -9,6 +9,8 @@
#include "thread.h"
#include "parse-events.h"
#include "hists_common.h"
#include <errno.h>
#include <linux/kernel.h>
struct sample {
u32 pid;

View File

@ -9,6 +9,7 @@
#include "util/parse-events.h"
#include "tests/tests.h"
#include "tests/hists_common.h"
#include <linux/kernel.h>
struct sample {
u32 cpu;

View File

@ -1,7 +1,8 @@
#include <linux/compiler.h>
#include <linux/kernel.h>
#include "tests.h"
#include "debug.h"
#include "util.h"
#include "print_binary.h"
int test__is_printable_array(int subtest __maybe_unused)
{

View File

@ -1,3 +1,5 @@
#include <errno.h>
#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>
@ -7,6 +9,7 @@
#include "cpumap.h"
#include "tests.h"
#include <linux/err.h>
#include <linux/kernel.h>
/*
* This test will generate random numbers of calls to some getpid syscalls,

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
@ -11,6 +12,7 @@
#include "thread_map.h"
#include "symbol.h"
#include "thread.h"
#include "util.h"
#define THREADS 4

View File

@ -1,8 +1,14 @@
#include <errno.h>
#include <inttypes.h>
/* For the CPU_* macros */
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <api/fs/fs.h>
#include <linux/err.h>
#include <api/fs/tracing_path.h>
#include "evsel.h"
#include "tests.h"
#include "thread_map.h"

View File

@ -5,6 +5,7 @@
#include "thread_map.h"
#include "tests.h"
#include "debug.h"
#include <errno.h>
#ifndef O_DIRECTORY
#define O_DIRECTORY 00200000

View File

@ -1,5 +1,10 @@
#include <errno.h>
#include <inttypes.h>
#include <api/fs/tracing_path.h>
#include <linux/err.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "thread_map.h"
#include "evsel.h"
#include "debug.h"

View File

@ -1,4 +1,3 @@
#include "parse-events.h"
#include "evsel.h"
#include "evlist.h"
@ -6,8 +5,12 @@
#include "tests.h"
#include "debug.h"
#include "util.h"
#include <dirent.h>
#include <errno.h>
#include <linux/kernel.h>
#include <linux/hw_breakpoint.h>
#include <api/fs/fs.h>
#include <api/fs/tracing_path.h>
#define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)

View File

@ -1,3 +1,4 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <stddef.h>

View File

@ -1,3 +1,5 @@
#include <errno.h>
#include <inttypes.h>
/* For the CLR_() macros */
#include <pthread.h>

View File

@ -2,6 +2,8 @@
#include "pmu.h"
#include "util.h"
#include "tests.h"
#include <errno.h>
#include <linux/kernel.h>
/* Simulated format definitions. */
static struct test_format {

View File

@ -1,4 +1,6 @@
#include <stdbool.h>
#include <inttypes.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include "util.h"

View File

@ -1,3 +1,4 @@
#include <errno.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <util/util.h>

View File

@ -1,3 +1,5 @@
#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>

View File

@ -1,5 +1,6 @@
#include <sys/time.h>
#include <sys/prctl.h>
#include <errno.h>
#include <time.h>
#include <stdlib.h>

View File

@ -4,6 +4,7 @@
#include "cpumap.h"
#include "tests.h"
#include <errno.h>
#include <signal.h>
static int exited;

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include "tests.h"

View File

@ -1,5 +1,6 @@
#include <linux/compiler.h>
#include <linux/rbtree.h>
#include <inttypes.h>
#include <string.h>
#include "map.h"
#include "symbol.h"

View File

@ -1,4 +1,5 @@
#include "../util.h"
#include "../string2.h"
#include "../config.h"
#include "../../perf.h"
#include "libslang.h"
@ -13,6 +14,7 @@
#include "helpline.h"
#include "keysyms.h"
#include "../color.h"
#include "sane_ctype.h"
static int ui_browser__percent_color(struct ui_browser *browser,
double percent, bool current)

View File

@ -9,7 +9,10 @@
#include "../../util/symbol.h"
#include "../../util/evsel.h"
#include "../../util/config.h"
#include <inttypes.h>
#include <pthread.h>
#include <linux/kernel.h>
#include <sys/ttydefaults.h>
struct disasm_line_samples {
double percent;

View File

@ -8,6 +8,8 @@
#include "util/header.h"
#include "util/session.h"
#include <sys/ttydefaults.h>
static void ui_browser__argv_write(struct ui_browser *browser,
void *entry, int row)
{

View File

@ -1,7 +1,11 @@
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/rbtree.h>
#include <sys/ttydefaults.h>
#include "../../util/evsel.h"
#include "../../util/evlist.h"
@ -18,6 +22,10 @@
#include "../ui.h"
#include "map.h"
#include "annotate.h"
#include "srcline.h"
#include "string2.h"
#include "sane_ctype.h"
extern void hist_browser__init_hpp(void);

View File

@ -11,6 +11,8 @@
#include "../keysyms.h"
#include "map.h"
#include "sane_ctype.h"
struct map_browser {
struct ui_browser b;
struct map *map;

View File

@ -3,7 +3,7 @@
#include "util/annotate.h"
#include "util/evsel.h"
#include "ui/helpline.h"
#include <inttypes.h>
enum {
ANN_COL__PERCENT,

View File

@ -4,6 +4,7 @@
#include "../sort.h"
#include "../hist.h"
#include "../helpline.h"
#include "../string2.h"
#include "gtk.h"
#define MAX_COLUMNS 32

View File

@ -1,3 +1,4 @@
#include <inttypes.h>
#include <math.h>
#include <linux/compiler.h>

View File

@ -4,6 +4,7 @@
#include "../util/cache.h"
#include "../util/debug.h"
#include "../util/hist.h"
#include "../util/util.h"
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
void *perf_gtk_handle;

View File

@ -4,7 +4,9 @@
#include "../../util/hist.h"
#include "../../util/sort.h"
#include "../../util/evsel.h"
#include "../../util/srcline.h"
#include "../../util/string2.h"
#include "../../util/sane_ctype.h"
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
{

View File

@ -1,6 +1,7 @@
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
#include <linux/kernel.h>
#ifdef HAVE_BACKTRACE_SUPPORT
#include <execinfo.h>
#endif

View File

@ -16,6 +16,7 @@ libperf-y += llvm-utils.o
libperf-y += parse-events.o
libperf-y += perf_regs.o
libperf-y += path.o
libperf-y += print_binary.o
libperf-y += rbtree.o
libperf-y += libstring.o
libperf-y += bitmap.o

View File

@ -7,6 +7,8 @@
* Released under the GPL v2. (and only v2, not any later version)
*/
#include <errno.h>
#include <inttypes.h>
#include "util.h"
#include "ui/ui.h"
#include "sort.h"
@ -18,12 +20,16 @@
#include "annotate.h"
#include "evsel.h"
#include "block-range.h"
#include "string2.h"
#include "arch/common.h"
#include <regex.h>
#include <pthread.h>
#include <linux/bitops.h>
#include <linux/kernel.h>
#include <sys/utsname.h>
#include "sane_ctype.h"
const char *disassembler_style;
const char *objdump_path;
static regex_t file_lineno;

View File

@ -13,10 +13,10 @@
*
*/
#include <inttypes.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
@ -46,7 +46,6 @@
#include "cpumap.h"
#include "thread_map.h"
#include "asm/bug.h"
#include "symbol/kallsyms.h"
#include "auxtrace.h"
#include <linux/hash.h>
@ -59,6 +58,9 @@
#include "intel-pt.h"
#include "intel-bts.h"
#include "sane_ctype.h"
#include "symbol/kallsyms.h"
int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
struct auxtrace_mmap_params *mp,
void *userpg, int fd)

View File

@ -17,6 +17,7 @@
#define __PERF_AUXTRACE_H
#include <sys/types.h>
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <linux/list.h>

View File

@ -9,7 +9,9 @@
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <errno.h>
#include "perf.h"
#include "debug.h"
#include "bpf-loader.h"
@ -17,6 +19,7 @@
#include "probe-event.h"
#include "probe-finder.h" // for MAX_PROBES
#include "parse-events.h"
#include "strfilter.h"
#include "llvm-utils.h"
#include "c++/clang-c.h"

View File

@ -85,6 +85,8 @@ int bpf__strerror_setup_stdout(struct perf_evlist *evlist, int err,
char *buf, size_t size);
#else
#include <errno.h>
static inline struct bpf_object *
bpf__prepare_load(const char *filename __maybe_unused,
bool source __maybe_unused)

View File

@ -12,6 +12,7 @@
#include "bpf-loader.h"
#include "bpf-prologue.h"
#include "probe-finder.h"
#include <errno.h>
#include <dwarf-regs.h>
#include <linux/filter.h>

View File

@ -18,6 +18,8 @@ int bpf__gen_prologue(struct probe_trace_arg *args, int nargs,
struct bpf_insn *new_prog, size_t *new_cnt,
size_t cnt_space);
#else
#include <errno.h>
static inline int
bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused,
int nargs __maybe_unused,

Some files were not shown because too many files have changed in this diff Show More