aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-07-21 22:26:48 +0100
committerMichael Brown <mcb30@ipxe.org>2015-07-22 21:17:47 +0100
commit6bc3d994966b00560e07c662b33da0cc9477891f (patch)
tree54b1b1520110f7a4852d0d3bcbbde1deac92a126 /src
parent89816af2a4b7dfc42aef880912dad8fad28e974b (diff)
downloadipxe-6bc3d994966b00560e07c662b33da0cc9477891f.zip
ipxe-6bc3d994966b00560e07c662b33da0cc9477891f.tar.gz
ipxe-6bc3d994966b00560e07c662b33da0cc9477891f.tar.bz2
[profile] Add profile_custom() for profiling with arbitrary time units
Provide profile_custom() as a trivial wrapper around profile_update() to allow for the use of the profiling infrastructure by code using timers other than the default profile_timestamp() provider. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/ipxe/profile.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/ipxe/profile.h b/src/include/ipxe/profile.h
index 5d3b662..b6d2b19 100644
--- a/src/include/ipxe/profile.h
+++ b/src/include/ipxe/profile.h
@@ -186,4 +186,18 @@ profile_exclude ( struct profiler *profiler ) {
profile_excluded += profile_elapsed ( profiler );
}
+/**
+ * Record profiling sample in custom units
+ *
+ * @v profiler Profiler
+ * @v sample Profiling sample
+ */
+static inline __attribute__ (( always_inline )) void
+profile_custom ( struct profiler *profiler, unsigned long sample ) {
+
+ /* If profiling is active then update stats */
+ if ( PROFILING )
+ profile_update ( profiler, sample );
+}
+
#endif /* _IPXE_PROFILE_H */