summaryrefslogtreecommitdiffstats
path: root/src/include/compiler.h
diff options
context:
space:
mode:
authorMichael Brown2010-12-04 03:55:11 +0100
committerMichael Brown2010-12-09 14:11:27 +0100
commitea0fcb9460403a16d4e2a5e1d48ee6279794450c (patch)
treeea6bb728ad797317ad93551eb1678c08cf874e81 /src/include/compiler.h
parent[pxe] Set correct PktType in PXENV_UNDI_ISR (diff)
downloadipxe-ea0fcb9460403a16d4e2a5e1d48ee6279794450c.tar.gz
ipxe-ea0fcb9460403a16d4e2a5e1d48ee6279794450c.tar.xz
ipxe-ea0fcb9460403a16d4e2a5e1d48ee6279794450c.zip
[fnrec] Enhance function recording
Enhance the information collected by the function recorder to include the call site and entry/exit counts. This allows fnrec.pl to produce a call tree such as: step (from core/getkey.c:46 = 0x17e90) { ref_increment (from core/process.c:93 = 0x73ec) { } net_step (from core/process.c:96 = 0x73f1) { net_poll (from net/netdevice.c:741 = 0xbce6) { netdev_poll (from net/netdevice.c:700 = 0xbc58) { } netdev_rx_dequeue (from net/netdevice.c:709 = 0xbc65) { } } } ref_decrement (from core/process.c:96 = 0x73f9) { } } Note that inlined functions are reported, confusingly, as extra calls to the *containing* function. Minimise this confusion by adding the attribute "no_instrument_function" to all functions declared as inline. (Static functions that have been inlined autonomously by gcc will still be problematic, but these are far fewer in number.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/compiler.h')
-rw-r--r--src/include/compiler.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index f3f71300..771e0610 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -537,6 +537,19 @@ int __debug_disable;
/** Declare a function to be always inline */
#define __always_inline __attribute__ (( always_inline ))
+/* Force all inline functions to not be instrumented
+ *
+ * This is required to cope with what seems to be a long-standing gcc
+ * bug, in which -finstrument-functions will cause instances of
+ * inlined functions to be reported as further calls to the
+ * *containing* function. This makes instrumentation very difficult
+ * to use.
+ *
+ * Work around this problem by adding the no_instrument_function
+ * attribute to all inlined functions.
+ */
+#define inline inline __attribute__ (( no_instrument_function ))
+
/**
* Shared data.
*