aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-05-19 15:55:08 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-05-19 15:55:08 +0100
commit776efef32439a31cb13a6acfe8aab833687745ad (patch)
tree8bb3579b495d9c5d19145041623dc10f6e2f8d18 /scripts
parent8ec4fe0a4bed4fa27e6f28a746bcf77b27cd05a3 (diff)
parentdf43d49cb8708b9c88a20afe0d1a3089b550a5b8 (diff)
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
NEED_CPU_H cleanups, big enough to deserve their own pull request. # gpg: Signature made Thu 19 May 2016 15:42:37 BST using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (52 commits) hw: clean up hw/hw.h includes hw: remove pio_addr_t cpu: move exec-all.h inclusion out of cpu.h exec: extract exec/tb-context.h hw: explicitly include qemu/log.h mips: move CP0 functions out of cpu.h arm: move arm_log_exception into .c file qemu-common: push cpu.h inclusion out of qemu-common.h acpi: do not use TARGET_PAGE_SIZE s390x: reorganize CSS bits between cpu.h and other headers dma: do not depend on kvm_enabled() gdbstub: remove unnecessary includes from gdbstub-xml.c qemu-common: stop including qemu/host-utils.h from qemu-common.h qemu-common: stop including qemu/bswap.h from qemu-common.h cpu: move endian-dependent load/store functions to cpu-all.h hw: cannot include hw/hw.h from user emulation hw: move CPU state serialization to migration/cpu.h hw: do not use VMSTATE_*TL include: poison symbols in osdep.h apic: move target-dependent definitions to cpu.h ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/analyze-inclusions102
-rwxr-xr-xscripts/create_config2
-rw-r--r--scripts/feature_to_c.sh2
-rw-r--r--scripts/tracetool/format/tcg_helper_c.py1
4 files changed, 104 insertions, 3 deletions
diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
new file mode 100644
index 0000000000..a8108d9b88
--- /dev/null
+++ b/scripts/analyze-inclusions
@@ -0,0 +1,102 @@
+#! /bin/sh
+#
+# Copyright (C) 2016 Red Hat, Inc.
+#
+# Author: Paolo Bonzini <pbonzini@redhat.com>
+#
+# Print statistics about header file inclusions.
+#
+# The script has two modes of execution:
+#
+# 1) if invoked with a path on the command line (possibly
+# preceded by a "--" argument), it will run the analysis on
+# an existing build directory
+#
+# 2) otherwise, it will configure and builds QEMU itself in a
+# "+build" subdirectory which is left around when the script
+# exits. In this case the command line is passed directly to
+# "make" (typically used for a "-j" argument suitable for your
+# system).
+#
+# Inspired by a post by Markus Armbruster.
+
+case "x$1" in
+x--)
+ shift
+ cd "$1" || exit $?
+ ;;
+x-* | x)
+ mkdir -p +build
+ cd +build
+ test -f Makefile && make distclean
+ ../configure
+ make "$@"
+ ;;
+*)
+ cd "$1" || exit $?
+esac
+
+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" -exec 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()+1; 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
diff --git a/scripts/create_config b/scripts/create_config
index 9cb176f1ba..b2d2ebb452 100755
--- a/scripts/create_config
+++ b/scripts/create_config
@@ -52,7 +52,7 @@ case $line in
done
echo " NULL"
;;
- CONFIG_*=y) # configuration
+ CONFIG_*='$(CONFIG_SOFTMMU)'|CONFIG_*=y) # configuration
name=${line%=*}
echo "#define $name 1"
;;
diff --git a/scripts/feature_to_c.sh b/scripts/feature_to_c.sh
index fb1f3363f7..e4387b7fcf 100644
--- a/scripts/feature_to_c.sh
+++ b/scripts/feature_to_c.sh
@@ -37,8 +37,6 @@ for input; do
${AWK:-awk} 'BEGIN { n = 0
printf "#include \"qemu/osdep.h\"\n"
- printf "#include \"qemu-common.h\"\n"
- printf "#include \"exec/gdbstub.h\"\n"
print "static const char '$arrayname'[] = {"
for (i = 0; i < 255; i++)
_ord_[sprintf("%c", i)] = i
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index a089b0bf05..e3485b7f92 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -48,6 +48,7 @@ def generate(events, backend):
'',
'#include "qemu/osdep.h"',
'#include "qemu-common.h"',
+ '#include "cpu.h"',
'#include "trace.h"',
'#include "exec/helper-proto.h"',
'',