From patchwork Thu Oct 26 09:19:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 10027893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 819AF6032C for ; Thu, 26 Oct 2017 09:22:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 782BF28D71 for ; Thu, 26 Oct 2017 09:22:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D22E28D73; Thu, 26 Oct 2017 09:22:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 130A228D71 for ; Thu, 26 Oct 2017 09:22:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7eKa-0006Tn-G1; Thu, 26 Oct 2017 09:20:04 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7eKZ-0006Oe-Md for xen-devel@lists.xenproject.org; Thu, 26 Oct 2017 09:20:03 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id AB/90-01775-2C8A1F95; Thu, 26 Oct 2017 09:20:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsXitHSDve7+FR8 jDdZ9kbP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDPmn1EsOCFcsflqH1sD43aBLkYODgkBf4kT 5wq6GDk52AR0JC7O3ckGEhYRUJG4vdegi5GLg1ngOZPE+wkNzCA1wgLeEgfPfmUDsVkEVCW+H NgFZvMKWEl8b/vJBjFST+LHdkOQMCdQeNn7NlYQW0jAUmLh2bWMEOWCEidnPmEBsZkFNCVat/ 9mh7DlJZq3zmaGqFeU6J/3gG0CI98sJC2zkLTMQtKygJF5FaN6cWpRWWqRrqleUlFmekZJbmJ mjq6hgbFebmpxcWJ6ak5iUrFecn7uJkZgkNUzMDDuYLz81ekQoyQHk5IoL8OeD5FCfEn5KZUZ icUZ8UWlOanFhxhlODiUJHjzl3+MFBIsSk1PrUjLzAGGO0xagoNHSYTXHCTNW1yQmFucmQ6RO sVozNFx8+4fJo5nM183MAux5OXnpUqJ87qAlAqAlGaU5sENgsXhJUZZKWFeRgYGBiGegtSi3M wSVPlXjOIcjErCvB0gU3gy80rg9r0COoUJ6JQm1Q8gp5QkIqSkGhhTPl7Zqc852cUmncF1HUf I+z2Ngf9n/37Xf/RDw2wlI885C3n+aNX2b3CfcYz1gUwOV6z56VUv7qeWGFftbC1+V9S4I9tZ bIpbW4h5UTjDBqZtP14tkesLCmfcvWGnyao0+ZK9mdZWzyfy3POe7uGjb3QrgO3bw3NSOnf2T Z46e8ri8LhE0wQlluKMREMt5qLiRAADmKQWvgIAAA== X-Env-Sender: prvs=4659c6258=roger.pau@citrix.com X-Msg-Ref: server-14.tower-31.messagelabs.com!1509009586!111888965!5 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19420 invoked from network); 26 Oct 2017 09:19:59 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Oct 2017 09:19:59 -0000 X-IronPort-AV: E=Sophos;i="5.43,434,1503360000"; d="scan'208";a="456161887" From: Roger Pau Monne To: Date: Thu, 26 Oct 2017 10:19:38 +0100 Message-ID: <20171026091938.59247-10-roger.pau@citrix.com> X-Mailer: git-send-email 2.13.5 (Apple Git-94) In-Reply-To: <20171026091938.59247-1-roger.pau@citrix.com> References: <20171026091938.59247-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Roger Pau Monne Subject: [Xen-devel] [PATCH for-next 9/9] coverage: add documentation for LLVM coverage X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Roger Pau Monné --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- docs/misc/coverage.markdown | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/misc/coverage.markdown b/docs/misc/coverage.markdown index 0a32c48f4b..565644631a 100644 --- a/docs/misc/coverage.markdown +++ b/docs/misc/coverage.markdown @@ -8,6 +8,8 @@ information. Every basic block in the code will be instrumented by the compiler to compute these statistics. It should not be used in production as it slows down your hypervisor. +# GCOV (GCC coverage) + ## Enable coverage Test coverage support can be turned on compiling Xen with the `coverage` option set @@ -87,3 +89,48 @@ blob extracted from xencov!** * See output in a browser firefox cov/index.html + +# LLVM coverage + +## Enable coverage + +Coverage can be enabled using a Kconfig option, from the top-level directory +use the following command to display the Kconfig menu: + + gmake -C xen menuconfig clang=y + +The LLVM coverage option can be found inside of the "Debugging Options" +section. After enabling it just compile Xen as you would normally do: + + gmake xen clang=y + +## Extract coverage data + +LLVM coverage can be extracted from the hypervisor using the `xencov` tool. +The following actions are available: + +* `xencov read` extract data +* `xencov reset` reset all coverage counters +* `xencov read-reset` extract data and reset counters at the same time. + +## Possible use + +**This section is just an example on how to use these tools!** + +This example assumes you compiled Xen and copied the xen-syms file from +xen/xen-syms into your current directory. + +* Extract the coverage data from Xen: + + xencov read xen.profraw + +* Convert the data into a profile. Note that you can merge more than one + profraw file into a single profdata file. + + llvm-profdata merge xen.profraw -o xen.profdata + +* Generate a HTML report of the code coverage: + + llvm-cov show -format=html -output-dir=cov/ xen-syms -instr-profile=xen.profdata + +* Open cov/index.html with your browser in order to display the profile.