aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/gcov.h
diff options
context:
space:
mode:
authorFrediano Ziglio <frediano.ziglio@citrix.com>2013-02-14 12:37:14 +0000
committerKeir <keir.xen@gmail.com>2013-02-21 16:15:40 +0000
commit26c9d03dd4a7356ed697bec98fe8108a5eebd562 (patch)
treee86ed6154ac6367e4eda54d2c29303fd920289c3 /xen/include/xen/gcov.h
parent68ca0bc4ba2f70d50b4c5eecbba53ce113bd8ad6 (diff)
downloadxen-26c9d03dd4a7356ed697bec98fe8108a5eebd562.tar.gz
xen-26c9d03dd4a7356ed697bec98fe8108a5eebd562.tar.bz2
xen-26c9d03dd4a7356ed697bec98fe8108a5eebd562.zip
gcov: Adding support for coverage information
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. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Diffstat (limited to 'xen/include/xen/gcov.h')
-rw-r--r--xen/include/xen/gcov.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/xen/include/xen/gcov.h b/xen/include/xen/gcov.h
new file mode 100644
index 0000000000..d695919762
--- /dev/null
+++ b/xen/include/xen/gcov.h
@@ -0,0 +1,84 @@
+/*
+ * Profiling infrastructure declarations.
+ *
+ * This file is based on gcc-internal definitions. Data structures are
+ * defined to be compatible with gcc counterparts. For a better
+ * understanding, refer to gcc source: gcc/gcov-io.h.
+ *
+ * Copyright IBM Corp. 2009
+ * Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
+ *
+ * Uses gcc-internal data definitions.
+ */
+
+#ifndef __XEN_GCOV_H__
+#define __XEN_GCOV_H__ __XEN_GCOV_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
+ * remain compatible.
+ */
+
+typedef uint64_t gcov_type;
+
+/**
+ * struct gcov_fn_info - profiling meta data per function
+ * @ident: object file-unique function identifier
+ * @checksum: function checksum
+ * @n_ctrs: number of values per counter type belonging to this function
+ *
+ * This data is generated by gcc during compilation and doesn't change
+ * at run-time.
+ */
+struct gcov_fn_info
+{
+ unsigned int ident;
+ unsigned int checksum;
+ unsigned int n_ctrs[0];
+};
+
+/**
+ * struct gcov_ctr_info - profiling data per counter type
+ * @num: number of counter values for this type
+ * @values: array of counter values for this type
+ * @merge: merge function for counter values of this type (unused)
+ *
+ * This data is generated by gcc during compilation and doesn't change
+ * at run-time with the exception of the values array.
+ */
+struct gcov_ctr_info
+{
+ unsigned int num;
+ gcov_type *values;
+ void (*merge)(gcov_type *, unsigned int);
+};
+
+/**
+ * struct gcov_info - profiling data per object file
+ * @version: gcov version magic indicating the gcc version used for compilation
+ * @next: list head for a singly-linked list
+ * @stamp: time stamp
+ * @filename: name of the associated gcov data file
+ * @n_functions: number of instrumented functions
+ * @functions: function data
+ * @ctr_mask: mask specifying which counter types are active
+ * @counts: counter data per counter type
+ *
+ * This data is generated by gcc during compilation and doesn't change
+ * at run-time with the exception of the next pointer.
+ */
+struct gcov_info
+{
+ unsigned int version;
+ struct gcov_info *next;
+ unsigned int stamp;
+ const char *filename;
+ unsigned int n_functions;
+ const struct gcov_fn_info *functions;
+ unsigned int ctr_mask;
+ struct gcov_ctr_info counts[0];
+};
+
+
+#endif /* __XEN_GCOV_H__ */