summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2015-07-21 23:26:48 +0200
committerMichael Brown2015-07-22 22:17:47 +0200
commit6bc3d994966b00560e07c662b33da0cc9477891f (patch)
tree54b1b1520110f7a4852d0d3bcbbde1deac92a126 /src/include
parent[fault] Add inject_corruption() to randomly corrupt data (diff)
downloadipxe-6bc3d994966b00560e07c662b33da0cc9477891f.tar.gz
ipxe-6bc3d994966b00560e07c662b33da0cc9477891f.tar.xz
ipxe-6bc3d994966b00560e07c662b33da0cc9477891f.zip
[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/include')
-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 5d3b66241..b6d2b19e0 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 */