浏览代码

[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 */

正在加载...
取消
保存