]>
Commit | Line | Data |
---|---|---|
55b6a56e AD |
1 | From patchwork Thu Mar 26 03:03:12 2015 |
2 | Content-Type: text/plain; charset="utf-8" | |
3 | MIME-Version: 1.0 | |
4 | Content-Transfer-Encoding: 7bit | |
5 | Subject: configure: Add support for tcmalloc | |
6 | From: Fam Zheng <famz@redhat.com> | |
7 | X-Patchwork-Id: 454848 | |
8 | Message-Id: <1427338992-27057-1-git-send-email-famz@redhat.com> | |
9 | To: qemu-devel@nongnu.org | |
10 | Cc: kwolf@redhat.com, Paolo Bonzini <pbonzini@redhat.com>, | |
11 | Stefan Hajnoczi <stefanha@redhat.com>, | |
12 | Peter Maydell <peter.maydell@linaro.org> | |
13 | Date: Thu, 26 Mar 2015 11:03:12 +0800 | |
14 | ||
15 | This adds "--enable-tcmalloc" and "--disable-tcmalloc" to allow linking | |
16 | to libtcmalloc from gperftools. | |
17 | ||
18 | tcmalloc is a malloc implementation that works well with threads and is | |
19 | fast, so it is good for performance. | |
20 | ||
21 | It is disabled by default, because the MALLOC_PERTURB_ flag we use in | |
22 | tests doesn't work with tcmalloc. However we can enable tcmalloc | |
23 | specific heap checker and profilers later. | |
24 | ||
25 | An IOPS gain can be observed with virtio-blk-dataplane, other parts of | |
26 | QEMU will directly benefit from it as well: | |
27 | ||
28 | ========================================================== | |
29 | glibc malloc | |
30 | ---------------------------------------------------------- | |
31 | rw bs iodepth bw iops latency | |
32 | read 4k 1 150 38511 24 | |
33 | ---------------------------------------------------------- | |
34 | ||
35 | ========================================================== | |
36 | tcmalloc | |
37 | ---------------------------------------------------------- | |
38 | rw bs iodepth bw iops latency | |
39 | read 4k 1 156 39969 23 | |
40 | ---------------------------------------------------------- | |
41 | ||
42 | Signed-off-by: Fam Zheng <famz@redhat.com> | |
43 | --- | |
44 | configure | 24 ++++++++++++++++++++++++ | |
45 | 1 file changed, 24 insertions(+) | |
46 | ||
47 | diff --git a/configure b/configure | |
48 | index 589798e..03ba305 100755 | |
49 | --- a/configure | |
50 | +++ b/configure | |
51 | @@ -336,6 +336,7 @@ libssh2="" | |
52 | vhdx="" | |
53 | quorum="" | |
54 | numa="" | |
55 | +tcmalloc="no" | |
56 | ||
57 | # parse CC options first | |
58 | for opt do | |
59 | @@ -1134,6 +1135,10 @@ for opt do | |
60 | ;; | |
61 | --enable-numa) numa="yes" | |
62 | ;; | |
63 | + --disable-tcmalloc) tcmalloc="no" | |
64 | + ;; | |
65 | + --enable-tcmalloc) tcmalloc="yes" | |
66 | + ;; | |
67 | *) | |
68 | echo "ERROR: unknown option $opt" | |
69 | echo "Try '$0 --help' for more information" | |
70 | @@ -1407,6 +1412,8 @@ Advanced options (experts only): | |
71 | --enable-quorum enable quorum block filter support | |
72 | --disable-numa disable libnuma support | |
73 | --enable-numa enable libnuma support | |
74 | + --disable-tcmalloc disable tcmalloc support | |
75 | + --enable-numa enable tcmalloc support | |
76 | ||
77 | NOTE: The object files are built at the place where configure is launched | |
78 | EOF | |
79 | @@ -3325,6 +3332,22 @@ EOF | |
80 | fi | |
81 | ||
82 | ########################################## | |
83 | +# tcmalloc probe | |
84 | + | |
d0b291c6 | 85 | +if test "$tcmalloc" = "yes" ; then |
55b6a56e AD |
86 | + cat > $TMPC << EOF |
87 | +#include <stdlib.h> | |
88 | +int main(void) { malloc(1); return 0; } | |
89 | +EOF | |
90 | + | |
91 | + if compile_prog "" "-ltcmalloc" ; then | |
92 | + LIBS="-ltcmalloc $LIBS" | |
93 | + else | |
94 | + feature_not_found "tcmalloc" "install gperftools devel" | |
95 | + fi | |
96 | +fi | |
97 | + | |
98 | +########################################## | |
99 | # signalfd probe | |
100 | signalfd="no" | |
101 | cat > $TMPC << EOF | |
102 | @@ -4435,6 +4458,7 @@ echo "lzo support $lzo" | |
103 | echo "snappy support $snappy" | |
104 | echo "bzip2 support $bzip2" | |
105 | echo "NUMA host support $numa" | |
106 | +echo "tcmalloc support $tcmalloc" | |
107 | ||
108 | if test "$sdl_too_old" = "yes"; then | |
109 | echo "-> Your SDL version is too old - please upgrade to have SDL support" |