Browse Source

[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>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
6bc3d99496
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      src/include/ipxe/profile.h

+ 14
- 0
src/include/ipxe/profile.h View File

@@ -186,4 +186,18 @@ profile_exclude ( struct profiler *profiler ) {
186 186
 		profile_excluded += profile_elapsed ( profiler );
187 187
 }
188 188
 
189
+/**
190
+ * Record profiling sample in custom units
191
+ *
192
+ * @v profiler		Profiler
193
+ * @v sample		Profiling sample
194
+ */
195
+static inline __attribute__ (( always_inline )) void
196
+profile_custom ( struct profiler *profiler, unsigned long sample ) {
197
+
198
+	/* If profiling is active then update stats */
199
+	if ( PROFILING )
200
+		profile_update ( profiler, sample );
201
+}
202
+
189 203
 #endif /* _IPXE_PROFILE_H */

Loading…
Cancel
Save