Skip to contentSkip to conversation

cover: Coverage support

PATCH Superseded Frediano Ziglio 2 participants 10 messages Feb 7, 2013

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 cover: Coverage support

Updated set of patches for coverage.

Changes:
- remove operation to check if coverage enabled
- add operation to read and reset coverage at same time
- updated utility to refrect changes above

#1 lore raw

PATCH 1/4 cover: Call constructors during initialization

This allow modules to set initializer functions.
This is used by Gcc instrumentation code for profiling arcs and test coverage.

---
 xen/arch/arm/setup.c   |    2 ++
 xen/arch/arm/xen.lds.S |    7 +++++++
 xen/arch/x86/setup.c   |    2 ++
 xen/arch/x86/xen.lds.S |    7 +++++++
 xen/common/lib.c       |   14 ++++++++++++++
 xen/include/xen/lib.h  |    2 ++
 6 files changed, 34 insertions(+)
xen/arch/arm/setup.c +2 -0
index e1ab7f6..4b98dd8 100644
@@ -445,6 +445,8 @@ void __init start_xen(unsigned long boot_phys_offset,
        scrub_heap_pages();
     */
 
+    init_constructors();
+
     console_endboot();
 
     /* Hide UART from DOM0 if we're using it */
xen/arch/arm/xen.lds.S +7 -0
index 410d7db..50e0c4b 100644
@@ -84,6 +84,13 @@ SECTIONS
        *(.init.data)
        *(.init.data.rel)
        *(.init.data.rel.*)
+
+       . = ALIGN(4);
+       __CTOR_LIST__ = .;
+       LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
+       *(.ctors)
+       LONG(0)
+       __CTOR_END__ = .;
   } :text
   . = ALIGN(32);
   .init.setup : {
xen/arch/x86/setup.c +2 -0
index f4d3788..a75066e 100644
@@ -1313,6 +1313,8 @@ void __init __start_xen(unsigned long mbi_p)
 
     init_trace_bufs();
 
+    init_constructors();
+
     console_endboot();
 
     /* Hide UART from DOM0 if we're using it */
xen/arch/x86/xen.lds.S +7 -0
index d324afd..5570389 100644
@@ -108,6 +108,13 @@ SECTIONS
        __trampoline_seg_start = .;
        *(.trampoline_seg)
        __trampoline_seg_stop = .;
+
+       . = ALIGN(8);
+       __CTOR_LIST__ = .;
+       QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
+       *(.ctors)
+       QUAD(0)
+       __CTOR_END__ = .;
   } :text
   . = ALIGN(32);
   .init.setup : {
xen/common/lib.c +14 -0
index 03c8b8b..1344038 100644
@@ -2,6 +2,7 @@
 #include <xen/ctype.h>
 #include <xen/lib.h>
 #include <xen/types.h>
+#include <xen/init.h>
 #include <asm/byteorder.h>
 
 /* for ctype.h */
@@ -478,6 +479,19 @@ unsigned long long parse_size_and_unit(const char *s, const char **ps)
     return ret;
 }
 
+extern const struct
+{
+    unsigned long count;
+    void (*funcs[1])(void);
+} __CTOR_LIST__;
+
+void __init init_constructors(void)
+{
+    unsigned long n;
+    for ( n = 0; n < __CTOR_LIST__.count; ++n )
+        __CTOR_LIST__.funcs[n]();
+}
+
 /*
  * Local variables:
  * mode: C
xen/include/xen/lib.h +2 -0
index f7074cf..d856ab1 100644
@@ -125,4 +125,6 @@ extern void add_taint(unsigned);
 struct cpu_user_regs;
 void dump_execstate(struct cpu_user_regs *);
 
+void init_constructors(void);
+
 #endif /* __LIB_H__ */
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/4 cover: Adding support for coverage information

In reply to Frediano Ziglio

This patch introduce coverage support to Xen.
Currently it allows to compile Xen with coverage support but there is no way to extract them.

The declarations came from Linux source files (as you can see from file headers).

The idea is to have some operations mainly
- get coverage information size
- read coverage information
- reset coverage counters

Linux use a file system to export these information. The information will be a blob to handle with some tools (as usually tools require a bunch of files but Xen does not handle files at all). I'll pack them to make things simpler as possible.

These information cannot be put in a specific section (allowing a safe mapping) as gcc use .rodata, .data, .text and .ctors sections.

I added code to handle constructors used in this case to initialize a linked list of files.

I excluded %.init.o files as they are used before Xen start and should not have section like .text or .data.

I used a "coverage" configuration option to mimic the "debug" one.

---
 .gitignore               |    2 ++
 .hgignore                |    2 ++
 Config.mk                |    3 ++
 xen/Rules.mk             |    2 ++
 xen/common/Makefile      |    2 ++
 xen/common/gcov/Makefile |    2 ++
 xen/common/gcov/gcov.c   |   74 ++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/gcov.h   |   84 ++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 171 insertions(+)
 create mode 100644 xen/common/gcov/Makefile
 create mode 100644 xen/common/gcov/gcov.c
 create mode 100644 xen/include/xen/gcov.h
.gitignore +2 -0
index 462e291..af48492 100644
@@ -13,6 +13,8 @@
 *.tmp
 *.spot
 *.spit
+*.gcno
+*.gcda
 TAGS
 GTAGS
 GRTAGS
.hgignore +2 -0
index 3024ef1..146d8d4 100644
@@ -17,6 +17,8 @@
 .*\.rej$
 .*\.spot$
 .*\.spit$
+.*\.gcno$
+.*\.gcda$
 .*/a\.out$
 .*/Modules\.symvers$
 .*/cscope\..*$
Config.mk +3 -0
index 64541c8..8e60f5e 100644
@@ -13,6 +13,9 @@ realpath = $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) && echo "
 debug ?= y
 debug_symbols ?= $(debug)
 
+# Test coverage support
+coverage ?= n
+
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
                          -e s/i86pc/x86_32/ -e s/amd64/x86_64/ \
                          -e s/armv7.*/arm32/)
xen/Rules.mk +2 -0
index c2db449..3f0b262 100644
@@ -103,6 +103,8 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
+$(obj-$(coverage)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+
 ifeq ($(lto),y)
 # Would like to handle all object files as bitcode, but objects made from
 # pure asm are in a different format and have to be collected separately.
xen/common/Makefile +2 -0
index 1677342..8a0c506 100644
@@ -59,5 +59,7 @@ subdir-$(CONFIG_COMPAT) += compat
 
 subdir-$(x86_64) += hvm
 
+subdir-$(coverage) += gcov
+
 subdir-y += libelf
 subdir-$(HAS_DEVICE_TREE) += libfdt
xen/common/gcov/Makefile new file +2 -0
new file mode 100644
index 0000000..c9efe6c
@@ -0,0 +1,2 @@
+obj-y += gcov.o
+
xen/common/gcov/gcov.c new file +74 -0

74 lines not on this page · raw message

xen/include/xen/gcov.h new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 2/4] cover: Adding support for coverage information

Quoted 20 lines · Frediano Ziglio
xen/common/gcov/gcov.c new file +14 -0
new file mode 100644
index 0000000..733d020
@@ -0,0 +1,74 @@
+/*
+ *  This code maintains a list of active profiling data structures.
+ *
+ *    Copyright IBM Corp. 2009
+ *    Author(s): Peter Oberparleiter <[email protected]>
+ *
+ *    Uses gcc-internal data definitions.
+ *    Based on the gcov-kernel patch by:
+ *       Hubertus Franke <[email protected]>
+ *       Nigel Hinds <[email protected]>
+ *       Rajan Ravindran <[email protected]>
+ *       Peter Oberparleiter <[email protected]>
+ *       Paul Larson
+ */

xen/common/gcov/gcov.c line 24

Quoted 10 lines
xen/common/gcov/gcov.c new file +10 -0
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/hypercall.h>
+#include <xen/gcov.h>
+#include <xen/errno.h>
+
+static struct gcov_info *info_list;
+static unsigned num_info = 0;

This is a bit of a nit, but you seem to remove this variable in the next patch, which is bad form. If it's not necessary, just don't add it in this patch.

Quoted 5 lines
xen/common/gcov/gcov.c new file +5 -0
+
+/*
+ * __gcov_init is called by gcc-generated constructor code for each object
+ * file compiled with -fprofile-arcs.
+ *

xen/common/gcov/gcov.c line 39

Quoted 10 lines
xen/common/gcov/gcov.c new file +10 -0
+ * Although this function is called only during initialization is called from
+ * a .text section which is still present after initialization so not declare
+ * as __init.
+ */
+void __gcov_init(struct gcov_info *info)
+{
+    /* add new profiling data structure to list */
+    info->next = info_list;
+    info_list = info;
+    ++num_info;

Ditto.

-George

#4 lore raw

Re: [PATCH 2/4] cover: Adding support for coverage information

Quoted 54 lines · George Dunlap
Quoted 20 lines · Frediano Ziglio
xen/common/gcov/gcov.c new file +14 -0
new file mode 100644
index 0000000..733d020
@@ -0,0 +1,74 @@
+/*
+ *  This code maintains a list of active profiling data structures.
+ *
+ *    Copyright IBM Corp. 2009
+ *    Author(s): Peter Oberparleiter <[email protected]>
+ *
+ *    Uses gcc-internal data definitions.
+ *    Based on the gcov-kernel patch by:
+ *       Hubertus Franke <[email protected]>
+ *       Nigel Hinds <[email protected]>
+ *       Rajan Ravindran <[email protected]>
+ *       Peter Oberparleiter <[email protected]>
+ *       Paul Larson
+ */

xen/common/gcov/gcov.c line 24

Quoted 10 lines
xen/common/gcov/gcov.c new file +10 -0
+
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/hypercall.h>
+#include <xen/gcov.h>
+#include <xen/errno.h>
+
+static struct gcov_info *info_list;
+static unsigned num_info = 0;

This is a bit of a nit, but you seem to remove this variable in the next patch, which is bad form. If it's not necessary, just don't add it in this patch.

Quoted 5 lines
xen/common/gcov/gcov.c new file +5 -0
+
+/*
+ * __gcov_init is called by gcc-generated constructor code for each object
+ * file compiled with -fprofile-arcs.
+ *

xen/common/gcov/gcov.c line 39

Quoted 10 lines
xen/common/gcov/gcov.c new file +10 -0
+ * Although this function is called only during initialization is called from
+ * a .text section which is still present after initialization so not declare
+ * as __init.
+ */
+void __gcov_init(struct gcov_info *info)
+{
+    /* add new profiling data structure to list */
+    info->next = info_list;
+    info_list = info;
+    ++num_info;

Ditto.

Quoted 2 lines

-George

Done

Frediano

#5 lore raw

PATCH 3/4 cover: Implement code to read coverage informations

In reply to Frediano Ziglio

Operations are handled by a sysctl specific operation.

Implement 4 operations
- check if coverage is compiled in
- read size of coverage information
- read coverage information
- reset coverage counters

Information are stored in a single blob in a format specific to Xen designed to make code that generate coverage as small as possible.

This patch add a public header with the structure of blob exported by Xen. This avoid problems distributing header which is GPL2.

---
 xen/common/gcov/gcov.c      |  161 ++++++++++++++++++++++++++++++++++++++++++-
 xen/common/sysctl.c         |    5 ++
 xen/include/public/gcov.h   |  115 +++++++++++++++++++++++++++++++
 xen/include/public/sysctl.h |   38 ++++++++++
 xen/include/xen/gcov.h      |   14 ++++
 5 files changed, 331 insertions(+), 2 deletions(-)
 create mode 100644 xen/include/public/gcov.h
xen/common/gcov/gcov.c +159 -2
index 733d020..e9c222c 100644
@@ -19,9 +19,11 @@
 #include <xen/hypercall.h>
 #include <xen/gcov.h>
 #include <xen/errno.h>
+#include <xen/guest_access.h>
+#include <public/xen.h>
+#include <public/gcov.h>
 
 static struct gcov_info *info_list;
-static unsigned num_info = 0;
 
 /*
  * __gcov_init is called by gcc-generated constructor code for each object
@@ -36,7 +38,6 @@ void __gcov_init(struct gcov_info *info)
     /* add new profiling data structure to list */
     info->next = info_list;
     info_list = info;
-    ++num_info;
 }
 
 /*
@@ -63,6 +64,162 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
     /* Unused. */
 }
 
+static inline int counter_active(const struct gcov_info *info, unsigned int type)
+{
+    return (1 << type) & info->ctr_mask;
+}
+
+typedef struct write_iter_t
+{
+    XEN_GUEST_HANDLE(uint8) ptr;
+    int real;
+    uint32_t write_offset;
+} write_iter_t;
+
+static int write_raw(struct write_iter_t *iter, const void *data,
+                     size_t data_len)
+{
+    if ( iter->real &&
+        copy_to_guest_offset(iter->ptr, iter->write_offset,
+                             (const unsigned char *) data, data_len) )
+        return -EFAULT;
+
+    iter->write_offset += data_len;
+    return 0;
+}
+
+#define chk(v) do { ret=(v); if ( ret ) return ret; } while(0)
+
+static inline int write32(write_iter_t *iter, uint32_t val)
+{
+    return write_raw(iter, &val, sizeof(val));
+}
+
+static int write_string(write_iter_t *iter, const char *s)
+{
+    int ret;
+    size_t len = strlen(s);
+
+    chk(write32(iter, len));
+    return write_raw(iter, s, len);
+}
+
+static inline int next_type(const struct gcov_info *info, int *type)
+{
+    while ( ++*type < XENCOV_COUNTERS && !counter_active(info, *type) )
+        continue;
+    return *type;
+}
+
+static inline void align_iter(write_iter_t *iter)
+{
+    iter->write_offset =
+        (iter->write_offset + sizeof(uint64_t) - 1) & -sizeof(uint64_t);
+}
+
+static int write_gcov(write_iter_t *iter)
+{
+    struct gcov_info *info;
+    int ret;
+
+    /* reset offset */
+    iter->write_offset = 0;
+
+    /* dump all files */
+    for ( info = info_list ; info; info = info->next )
+    {
+        const struct gcov_ctr_info *ctr;
+        int type;
+        size_t size_fn = sizeof(struct gcov_fn_info);
+
+        align_iter(iter);
+        chk(write32(iter, XENCOV_TAG_FILE));
+        chk(write32(iter, info->version));
+        chk(write32(iter, info->stamp));
+        chk(write_string(iter, info->filename));
+
+        /* dump counters */
+        ctr = info->counts;
+        for ( type = -1; next_type(info, &type) < XENCOV_COUNTERS; ++ctr )
+        {
+            align_iter(iter);
+            chk(write32(iter, XENCOV_TAG_COUNTER(type)));
+            chk(write32(iter, ctr->num));
+            chk(write_raw(iter, ctr->values,
+                          ctr->num * sizeof(ctr->values[0])));
+
+            size_fn += sizeof(unsigned);
+        }
+
+        /* dump all functions together */
+        align_iter(iter);
+        chk(write32(iter, XENCOV_TAG_FUNC));
+        chk(write32(iter, info->n_functions));
+        chk(write_raw(iter, info->functions, info->n_functions * size_fn));
+    }
+
+    /* stop tag */
+    align_iter(iter);
+    chk(write32(iter, XENCOV_TAG_END));
+    return 0;
+}
+
+static int reset_counters(void)
+{
+    struct gcov_info *info;
+
+    for ( info = info_list ; info; info = info->next )
+    {
+        const struct gcov_ctr_info *ctr;
+        int type;
+
+        /* reset counters */
+        ctr = info->counts;
+        for ( type = -1; next_type(info, &type) < XENCOV_COUNTERS; ++ctr )
+            memset(ctr->values, 0, ctr->num * sizeof(ctr->values[0]));
+    }
+
+    return 0;
+}
+
+int sysctl_coverage_op(xen_sysctl_coverage_op_t *op)
+{
+    long ret = 0;
+    int reset = 0;
+    write_iter_t iter;
+
+    switch ( op->cmd )
+    {
+    case XEN_SYSCTL_COVERAGE_get_total_size:
+        iter.real = 0;
+
+        write_gcov(&iter);
+        if ( copy_to_guest(op->u.total_size, &iter.write_offset, 1) )
+            ret = -EFAULT;
+        break;
+
+    case XEN_SYSCTL_COVERAGE_read_and_reset:
+        reset = 1;
+        /* fall through */
+    case XEN_SYSCTL_COVERAGE_read:
+        iter.ptr = op->u.raw_info;
+        iter.real = 1;
+
+        ret = write_gcov(&iter);
+        if (reset && !ret)
+            ret = reset_counters();
+        break;
+
+    case XEN_SYSCTL_COVERAGE_reset:
+        ret = reset_counters();
+        break;
+
+    default:
+        ret = -EINVAL;
+    }
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
xen/common/sysctl.c +5 -0
index d663ed7..fa3ef0a 100644
@@ -26,6 +26,7 @@
 #include <xen/nodemask.h>
 #include <xsm/xsm.h>
 #include <xen/pmstat.h>
+#include <xen/gcov.h>
 
 long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
 {
@@ -249,6 +250,10 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         ret = sched_adjust_global(&op->u.scheduler_op);
         break;
 
+    case XEN_SYSCTL_coverage_op:
+        ret = sysctl_coverage_op(&op->u.coverage_op);
+        break;
+
     default:
         ret = arch_do_sysctl(op, u_sysctl);
         copyback = 0;
xen/include/public/gcov.h new file +115 -0

115 lines not on this page · raw message

xen/include/public/sysctl.h +38 -0
index 3225b2a..425dbbb 100644
@@ -596,6 +596,42 @@ struct xen_sysctl_scheduler_op {
 typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t);
 
+/* XEN_SYSCTL_coverage_op */
+/*
+ * Get total size of information, to help allocate
+ * the buffer. The pointer points to a 32 bit value.
+ */
+#define XEN_SYSCTL_COVERAGE_get_total_size 0
+
+/*
+ * Read coverage information in a single run
+ * You must use a tool to split them.
+ */
+#define XEN_SYSCTL_COVERAGE_read           1
+
+/*
+ * Reset all the coverage counters to 0
+ * No parameters.
+ */
+#define XEN_SYSCTL_COVERAGE_reset          2
+
+/*
+ * Like XEN_SYSCTL_COVERAGE_read but reset also
+ * counters to 0 in a single call.
+ */
+#define XEN_SYSCTL_COVERAGE_read_and_reset 3
+
+struct xen_sysctl_coverage_op {
+    uint32_t cmd;        /* XEN_SYSCTL_COVERAGE_* */
+    union {
+        XEN_GUEST_HANDLE_64(uint32) total_size; /* OUT */
+        XEN_GUEST_HANDLE_64(uint8)  raw_info;   /* OUT */
+    } u;
+};
+typedef struct xen_sysctl_coverage_op xen_sysctl_coverage_op_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_coverage_op_t);
+
+
 struct xen_sysctl {
     uint32_t cmd;
 #define XEN_SYSCTL_readconsole                    1
@@ -616,6 +652,7 @@ struct xen_sysctl {
 #define XEN_SYSCTL_numainfo                      17
 #define XEN_SYSCTL_cpupool_op                    18
 #define XEN_SYSCTL_scheduler_op                  19
+#define XEN_SYSCTL_coverage_op                   20
     uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
     union {
         struct xen_sysctl_readconsole       readconsole;
@@ -636,6 +673,7 @@ struct xen_sysctl {
         struct xen_sysctl_lockprof_op       lockprof_op;
         struct xen_sysctl_cpupool_op        cpupool_op;
         struct xen_sysctl_scheduler_op      scheduler_op;
+        struct xen_sysctl_coverage_op       coverage_op;
         uint8_t                             pad[128];
     } u;
 };
xen/include/xen/gcov.h +14 -0
index d695919..ad5cd9d 100644
@@ -14,6 +14,8 @@
 #ifndef __XEN_GCOV_H__
 #define __XEN_GCOV_H__ __XEN_GCOV_H__
 
+#include <public/sysctl.h>
+
 /*
  * Profiling data types used for gcc 3.4 and above - these are defined by
  * gcc and need to be kept as close to the original definition as possible to
@@ -81,4 +83,16 @@ struct gcov_info
 };
 
 
+/**
+ * Sysctl operations for coverage
+ */
+#ifdef TEST_COVERAGE
+int sysctl_coverage_op(xen_sysctl_coverage_op_t *op);
+#else
+static inline int sysctl_coverage_op(xen_sysctl_coverage_op_t *op)
+{
+    return -ENOSYS;
+}
+#endif
+
 #endif /* __XEN_GCOV_H__ */
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/4 cover: Add small utility to deal with test coverage information from Xen

In reply to Frediano Ziglio

Currently the utility can read and reset coverage informations.

---
 .gitignore          |    1 +
 .hgignore           |    1 +
 tools/misc/Makefile |    8 ++-
 tools/misc/xencov.c |  142 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 150 insertions(+), 2 deletions(-)
 create mode 100644 tools/misc/xencov.c
.gitignore +1 -0
index af48492..9e947ce 100644
@@ -223,6 +223,7 @@ tools/misc/gtraceview
 tools/misc/gtracestat
 tools/misc/xenlockprof
 tools/misc/lowmemd
+tools/misc/xencov
 tools/pygrub/build/*
 tools/python/build/*
 tools/python/xen/util/path.py
.hgignore +1 -0
index 146d8d4..e98c3df 100644
@@ -218,6 +218,7 @@
 ^tools/misc/gtraceview$
 ^tools/misc/gtracestat$
 ^tools/misc/xenlockprof$
+^tools/misc/xencov$
 ^tools/pygrub/build/.*$
 ^tools/python/build/.*$
 ^tools/python/xen/util/path\.py$
tools/misc/Makefile +6 -2
index 22e60fd..eef9411 100644
@@ -9,7 +9,7 @@ CFLAGS += $(CFLAGS_libxenstore)
 
 HDRS     = $(wildcard *.h)
 
-TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd
+TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov
 TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd
 TARGETS-$(CONFIG_MIGRATE) += xen-hptool
 TARGETS := $(TARGETS-y)
@@ -22,7 +22,8 @@ INSTALL_BIN-y := xencons
 INSTALL_BIN-$(CONFIG_X86) += xen-detect
 INSTALL_BIN := $(INSTALL_BIN-y)
 
-INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xen-ringwatch
+INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm xen-tmem-list-parse gtraceview \
+	gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov
 INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd
 INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
 INSTALL_SBIN := $(INSTALL_SBIN-y)
@@ -85,4 +86,7 @@ xen-lowmemd: xen-lowmemd.o
 gtraceview: gtraceview.o
 	$(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS)
 
+xencov: xencov.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+
 -include $(DEPS)
tools/misc/xencov.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#7 lore raw
In reply to Frediano Ziglio
Quoted 7 lines · Frediano Ziglio

Updated set of patches for coverage.

Changes:
- remove operation to check if coverage enabled
- add operation to read and reset coverage at same time
- updated utility to refrect changes above

I've done a once-over and in principle I think this is a good series. Thanks for doing it -- I think Xen has needed this for some time. Just a couple of high-level comments (and I haven't been following the discussion, so please forgive me if I'm contradicting something someone said somewhere else):

First, re the name -- is there any reason not to call it "gcov" (or "xgcov" or something like that) in the patch series and the Xen command-line option? Since we're using the gcov format and the intent (I presume) is to use the gcov tools to do the actual analysis,

Secondly, there doesn't seem to be any documentation. A definition of the Xen command-line term is an absolute minimum, and a brief markdown how-to explaining how to enable the option and use it would be much appreciated.

-George

#8 lore raw
Quoted 15 lines · George Dunlap
Quoted 7 lines · Frediano Ziglio

Updated set of patches for coverage.

Changes:
- remove operation to check if coverage enabled
- add operation to read and reset coverage at same time
- updated utility to refrect changes above

I've done a once-over and in principle I think this is a good series. Thanks for doing it -- I think Xen has needed this for some time. Just a couple of high-level comments (and I haven't been following the discussion, so please forgive me if I'm contradicting something someone said somewhere else):

Quoted 5 lines

First, re the name -- is there any reason not to call it "gcov" (or "xgcov" or something like that) in the patch series and the Xen command-line option? Since we're using the gcov format and the intent (I presume) is to use the gcov tools to do the actual analysis,

Do you mean gcov on first commit line? That's fine.

For the tool I used xencov like xenperf and xentrace. cov instead of gcov allow to change the compiler in the future (I don't know, clang/llvm perhaps?).

Quoted 5 lines

Secondly, there doesn't seem to be any documentation. A definition of the Xen command-line term is an absolute minimum, and a brief markdown how-to explaining how to enable the option and use it would be much appreciated.

You are right. I need some direction however. Which documentation are you referring at? Wiki, internal one (docs directory in xen-unstable.hg)?

Quoted 1 line

-George

Frediano

#9 lore raw
Quoted 20 lines · Frediano Ziglio
Quoted 14 lines · George Dunlap
Quoted 7 lines · Frediano Ziglio

Updated set of patches for coverage.

Changes:
- remove operation to check if coverage enabled
- add operation to read and reset coverage at same time
- updated utility to refrect changes above

I've done a once-over and in principle I think this is a good series. Thanks for doing it -- I think Xen has needed this for some time. Just a couple of high-level comments (and I haven't been following the discussion, so please forgive me if I'm contradicting something someone said somewhere else):

Quoted 5 lines

First, re the name -- is there any reason not to call it "gcov" (or "xgcov" or something like that) in the patch series and the Xen command-line option? Since we're using the gcov format and the intent (I presume) is to use the gcov tools to do the actual analysis,

Quoted 5 lines

Do you mean gcov on first commit line? That's fine.

For the tool I used xencov like xenperf and xentrace. cov instead of gcov allow to change the compiler in the future (I don't know, clang/llvm perhaps?).

You know, for some reason I thought there was also a Xen command-line option as well, but there doesn't seem to be; just the option in Config.mk. Sorry, my mistake.

Quoted 9 lines
Quoted 6 lines

Secondly, there doesn't seem to be any documentation. A definition of the Xen command-line term is an absolute minimum, and a brief markdown how-to explaining how to enable the option and use it would be much appreciated.

You are right. I need some direction however. Which documentation are you referring at? Wiki, internal one (docs directory in xen-unstable.hg)?

Well thinking that there was a Xen command-line option, I meant docs/misc/xen-command-line.markdown; but you can forget that now. :-) Adding a basic HOWTO to docs/misc/ in the markdown format would be appreciated as well. There are some other examples in there to give you an idea what we might be after.

Following suit with small tools like xentrace, xenperf, &c, I think that as long as "xencov -h" gives you something useful, you don't need a man page.

-George