From: Michael Brown Date: Tue, 21 Jul 2015 21:26:48 +0000 (+0100) Subject: [profile] Add profile_custom() for profiling with arbitrary time units X-Git-Tag: v1.20.1~778 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6bc3d994966b00560e07c662b33da0cc9477891f;p=thirdparty%2Fipxe.git [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 --- 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 */