diff options
author | Michael Brown <mcb30@ipxe.org> | 2015-07-21 22:26:48 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2015-07-22 21:17:47 +0100 |
commit | 6bc3d994966b00560e07c662b33da0cc9477891f (patch) | |
tree | 54b1b1520110f7a4852d0d3bcbbde1deac92a126 /src | |
parent | 89816af2a4b7dfc42aef880912dad8fad28e974b (diff) | |
download | ipxe-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.h | 14 |
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 */ |