mirror of https://github.com/ipxe/ipxe.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 <mcb30@ipxe.org>pull/38/head
parent
89816af2a4
commit
6bc3d99496
|
@ -186,4 +186,18 @@ profile_exclude ( struct profiler *profiler ) {
|
||||||
profile_excluded += profile_elapsed ( 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 */
|
#endif /* _IPXE_PROFILE_H */
|
||||||
|
|
Loading…
Reference in New Issue