Browse Source

[downloader] Profile receive datapath

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
4e78733094
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      src/core/downloader.c

+ 15
- 0
src/core/downloader.c View File

29
 #include <ipxe/uaccess.h>
29
 #include <ipxe/uaccess.h>
30
 #include <ipxe/umalloc.h>
30
 #include <ipxe/umalloc.h>
31
 #include <ipxe/image.h>
31
 #include <ipxe/image.h>
32
+#include <ipxe/profile.h>
32
 #include <ipxe/downloader.h>
33
 #include <ipxe/downloader.h>
33
 
34
 
34
 /** @file
35
 /** @file
37
  *
38
  *
38
  */
39
  */
39
 
40
 
41
+/** Receive profiler */
42
+static struct profiler downloader_rx_profiler __profiler =
43
+	{ .name = "downloader.rx" };
44
+
45
+/** Data copy profiler */
46
+static struct profiler downloader_copy_profiler __profiler =
47
+	{ .name = "downloader.copy" };
48
+
40
 /** A downloader */
49
 /** A downloader */
41
 struct downloader {
50
 struct downloader {
42
 	/** Reference count for this object */
51
 	/** Reference count for this object */
166
 	size_t max;
175
 	size_t max;
167
 	int rc;
176
 	int rc;
168
 
177
 
178
+	/* Start profiling */
179
+	profile_start ( &downloader_rx_profiler );
180
+
169
 	/* Calculate new buffer position */
181
 	/* Calculate new buffer position */
170
 	if ( meta->flags & XFER_FL_ABS_OFFSET )
182
 	if ( meta->flags & XFER_FL_ABS_OFFSET )
171
 		downloader->pos = 0;
183
 		downloader->pos = 0;
178
 		goto done;
190
 		goto done;
179
 
191
 
180
 	/* Copy data to buffer */
192
 	/* Copy data to buffer */
193
+	profile_start ( &downloader_copy_profiler );
181
 	copy_to_user ( downloader->image->data, downloader->pos,
194
 	copy_to_user ( downloader->image->data, downloader->pos,
182
 		       iobuf->data, len );
195
 		       iobuf->data, len );
196
+	profile_stop ( &downloader_copy_profiler );
183
 
197
 
184
 	/* Update current buffer position */
198
 	/* Update current buffer position */
185
 	downloader->pos += len;
199
 	downloader->pos += len;
188
 	free_iob ( iobuf );
202
 	free_iob ( iobuf );
189
 	if ( rc != 0 )
203
 	if ( rc != 0 )
190
 		downloader_finished ( downloader, rc );
204
 		downloader_finished ( downloader, rc );
205
+	profile_stop ( &downloader_rx_profiler );
191
 	return rc;
206
 	return rc;
192
 }
207
 }
193
 
208
 

Loading…
Cancel
Save