From: "Alex Bennée" <alex.bennee@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions
Date: Wed, 20 Apr 2016 20:47:47 +0100 [thread overview]
Message-ID: <87bn54uknw.fsf@linaro.org> (raw)
In-Reply-To: <1460147350-7601-2-git-send-email-pbonzini@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> writes:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scripts/analyze-inclusions | 89 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 89 insertions(+)
> create mode 100644 scripts/analyze-inclusions
>
> diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
.sh extension to make it clear what it is?
> new file mode 100644
OK the script directory is inconsistent but if we want to use it for
automated testing it should be executable in the checkout.
> index 0000000..e241bd4
> --- /dev/null
> +++ b/scripts/analyze-inclusions
> @@ -0,0 +1,89 @@
> +#! /bin/sh
> +#
> +# Copyright (C) 2016 Red Hat, Inc.
> +#
> +# Author: Paolo Bonzini <pbonzini@redhat.com>
> +#
> +# Print statistics about header file inclusions.
> +# The script configures and builds QEMU itself in a "+build"
> +# subdirectory which is left around when the script exits.
> +# To run the statistics on a pre-existing "+build" directory,
> +# pass "--no-build" as the first argument on the command line.
> +# Any other command line is passed directly to "make" (so
> +# you can for example pass a "-j" argument suitable for your
> +# system).
> +#
> +# Inspired by a post by Markus Armbruster.
> +
> +mkdir -p +build
> +cd +build
> +if test "x$1" != "x--no-build"; then
> + test -f Makefile && make distclean
> + ../configure
> + make "$@"
> +fi
> +
> +QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
> +QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
> + sed 's/$(SRC_PATH)/../g' )
> +CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
> +
> +grep_include() {
> + find . -name "*.d" | xargs grep -l "$@" | wc -l
> +}
> +
> +echo Found $(find . -name "*.d" | wc -l) object files
> +echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
> +echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
> +echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
> +echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
> +echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
> +echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
> +echo $(grep_include -F 'qom/object.h') files include qom/object.h
> +echo $(grep_include -F 'block/aio.h') files include block/aio.h
> +echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
> +echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
> +echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
> +echo
> +
> +awk1='
> + /^# / { file = $3;next }
> + NR>1 { bytes[file]+=length; lines[file]++ }
> + END { for(i in lines) print i,lines[i],bytes[i] }'
> +
> +awk2='
> + {tot_l+=$2;tot_b+=$3;tot_f++}
> + /\/usr.*\/glib/ {glib_l+=$2;glib_b+=$3;glib_f++;next}
> + /\/usr/ {sys_l+=$2;sys_b+=$3;sys_f++;next}
> + {qemu_l+=$2;qemu_b+=$3;qemu_f++;next}
> + END {
> + printf "%s\t %s\t %s\t %s\n", "lines", "bytes", "files", "source"
> + printf "%s\t %s\t %s\t %s\n", qemu_l, qemu_b, qemu_f, "QEMU"
> + printf "%s\t %s\t %s\t %s\n", sys_l, sys_b, sys_f, "system"
> + printf "%s\t %s\t %s\t %s\n", glib_l, glib_b, glib_f, "glib"
> + printf "%s\t %s\t %s\t %s\n", tot_l, tot_b, tot_f, "total"
> + }'
> +
> +analyze() {
> + cc $QEMU_CFLAGS $QEMU_INCLUDES $CFLAGS -E -o - "$@" | \
> + awk "$awk1" | awk "$awk2"
> + echo
> +}
> +
> +echo osdep.h:
> +analyze ../include/qemu/osdep.h
> +
> +echo qemu-common.h:
> +analyze -include ../include/qemu/osdep.h ../include/qemu-common.h
> +
> +echo hw/hw.h:
> +analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
> +
> +echo trace/generated-tracers.h:
> +analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
> +
> +echo target-i386/cpu.h:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target-i386/cpu.h
> +
> +echo hw/hw.h + NEED_CPU_H:
> +analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
If we get to be include clean we want this script to have a non-zero
exit for automated testing.
--
Alex Bennée
next prev parent reply other threads:[~2016-04-20 19:47 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 20:28 [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
2016-04-18 13:10 ` Markus Armbruster
2016-05-09 10:07 ` Paolo Bonzini
2016-04-20 19:47 ` Alex Bennée [this message]
2016-05-09 9:39 ` Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 02/50] include: move CPU-related definitions out of qemu-common.h Paolo Bonzini
2016-04-21 7:53 ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 03/50] log: do not use CONFIG_USER_ONLY Paolo Bonzini
2016-04-21 10:20 ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 04/50] cpu: make cpu-qom.h only include-able from cpu.h Paolo Bonzini
2016-04-21 10:26 ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 05/50] target-alpha: make cpu-qom.h not target specific Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 06/50] target-arm: " Paolo Bonzini
2016-04-21 10:29 ` Alex Bennée
2016-04-08 20:28 ` [Qemu-devel] [PATCH 07/50] target-cris: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 08/50] target-i386: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 09/50] target-lm32: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 10/50] target-m68k: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 11/50] target-microblaze: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 12/50] target-mips: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 13/50] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
2016-04-18 13:46 ` Markus Armbruster
2016-04-08 20:28 ` [Qemu-devel] [PATCH 14/50] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 15/50] target-s390x: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 16/50] target-sh4: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 17/50] target-sparc: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 18/50] target-tricore: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 19/50] target-unicore32: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 20/50] target-xtensa: " Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 21/50] arm: include cpu-qom.h in files that require ARMCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 22/50] m68k: include cpu-qom.h in files that require M68KCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 23/50] sh4: include cpu-qom.h in files that require SuperHCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 24/50] alpha: include cpu-qom.h in files that require AlphaCPU Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 25/50] mips: use MIPSCPU instead of CPUMIPSState Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 26/50] ppc: use PowerPCCPU instead of CPUPPCState Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 27/50] arm: remove useless cpu.h inclusion Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 28/50] explicitly include qom/cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 29/50] explicitly include hw/qdev-core.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 30/50] explicitly include linux/kvm.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 31/50] apic: move target-dependent definitions to cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 32/50] include: poison symbols in osdep.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 33/50] hw: do not use VMSTATE_*TL Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 34/50] hw: move CPU state serialization to migration/cpu.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 35/50] hw: cannot include hw/hw.h from user emulation Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 36/50] cpu: move endian-dependent load/store functions to cpu-all.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 37/50] qemu-common: stop including qemu/bswap.h from qemu-common.h Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 38/50] qemu-common: stop including qemu/host-utils.h " Paolo Bonzini
2016-04-21 10:46 ` Alex Bennée
2016-05-09 9:39 ` Paolo Bonzini
2016-04-08 20:28 ` [Qemu-devel] [PATCH 39/50] gdbstub: remove includes from gdbstub-xml.c Paolo Bonzini
2016-04-18 13:54 ` Markus Armbruster
2016-04-18 14:12 ` Peter Maydell
2016-04-08 20:29 ` [Qemu-devel] [PATCH 40/50] dma: do not depend on kvm_enabled() Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 41/50] s390x: move stuff out of cpu.h Paolo Bonzini
2016-04-11 8:24 ` Cornelia Huck
2016-05-09 9:43 ` Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 42/50] acpi: do not use TARGET_PAGE_SIZE Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 43/50] qemu-common: push cpu.h inclusion out of qemu-common.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 44/50] arm: move arm_log_exception into .c file Paolo Bonzini
2016-04-21 10:48 ` Alex Bennée
2016-04-08 20:29 ` [Qemu-devel] [PATCH 45/50] mips: move CP0 functions out of cpu.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 46/50] hw: explicitly include qemu/log.h Paolo Bonzini
2016-04-20 18:30 ` Alex Bennée
2016-04-08 20:29 ` [Qemu-devel] [PATCH 47/50] exec: extract exec/tb-context.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 48/50] cpu: move exec-all.h inclusion out of cpu.h Paolo Bonzini
2016-04-08 20:29 ` [Qemu-devel] [PATCH 49/50] hw: remove pio_addr_t Paolo Bonzini
2016-04-18 14:01 ` Markus Armbruster
2016-04-08 20:29 ` [Qemu-devel] [PATCH 50/50] hw: clean up hw/hw.h includes Paolo Bonzini
2016-04-18 8:42 ` [Qemu-devel] [PATCH for-2.7 00/49] NEED_CPU_H / cpu.h / hw/hw.h cleanups Markus Armbruster
2016-04-18 14:07 ` Markus Armbruster
-- strict thread matches above, loose matches on Subject: below --
2016-05-16 15:35 [Qemu-devel] [PATCH CFT v3 00/50] " Paolo Bonzini
2016-05-16 15:35 ` [Qemu-devel] [PATCH 01/50] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
2016-05-16 16:20 ` Eric Blake
2016-05-16 16:25 ` Paolo Bonzini
2016-05-16 16:30 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bn54uknw.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).