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