[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>
This commit is contained in:
parent
89816af2a4
commit
6bc3d99496
@ -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 */
|
||||
|
Reference in New Issue
Block a user