Explorar el Código

[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 hace 9 años
padre
commit
6bc3d99496
Se han modificado 1 ficheros con 14 adiciones y 0 borrados
  1. 14
    0
      src/include/ipxe/profile.h

+ 14
- 0
src/include/ipxe/profile.h Ver fichero

@@ -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…
Cancelar
Guardar