Преглед на файлове

[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 години
родител
ревизия
6bc3d99496
променени са 1 файла, в които са добавени 14 реда и са изтрити 0 реда
  1. 14
    0
      src/include/ipxe/profile.h

+ 14
- 0
src/include/ipxe/profile.h Целия файл

@@ -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…
Отказ
Запис