|  | @@ -53,6 +53,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 | 
		
	
		
			
			| 53 | 53 |  #include <ipxe/acpi.h>
 | 
		
	
		
			
			| 54 | 54 |  #include <ipxe/version.h>
 | 
		
	
		
			
			| 55 | 55 |  #include <ipxe/params.h>
 | 
		
	
		
			
			|  | 56 | +#include <ipxe/profile.h>
 | 
		
	
		
			
			| 56 | 57 |  #include <ipxe/http.h>
 | 
		
	
		
			
			| 57 | 58 |  
 | 
		
	
		
			
			| 58 | 59 |  /* Disambiguate the various error causes */
 | 
		
	
	
		
			
			|  | @@ -93,6 +94,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
 | 
		
	
		
			
			| 93 | 94 |  /** Retry delay used when we cannot understand the Retry-After header */
 | 
		
	
		
			
			| 94 | 95 |  #define HTTP_RETRY_SECONDS 5
 | 
		
	
		
			
			| 95 | 96 |  
 | 
		
	
		
			
			|  | 97 | +/** Receive profiler */
 | 
		
	
		
			
			|  | 98 | +static struct profiler http_rx_profiler __profiler = { .name = "http.rx" };
 | 
		
	
		
			
			|  | 99 | +
 | 
		
	
		
			
			|  | 100 | +/** Data transfer profiler */
 | 
		
	
		
			
			|  | 101 | +static struct profiler http_xfer_profiler __profiler = { .name = "http.xfer" };
 | 
		
	
		
			
			|  | 102 | +
 | 
		
	
		
			
			| 96 | 103 |  /** HTTP flags */
 | 
		
	
		
			
			| 97 | 104 |  enum http_flags {
 | 
		
	
		
			
			| 98 | 105 |  	/** Request is waiting to be transmitted */
 | 
		
	
	
		
			
			|  | @@ -892,6 +899,7 @@ static int http_socket_deliver ( struct http_request *http,
 | 
		
	
		
			
			| 892 | 899 |  	ssize_t line_len;
 | 
		
	
		
			
			| 893 | 900 |  	int rc = 0;
 | 
		
	
		
			
			| 894 | 901 |  
 | 
		
	
		
			
			|  | 902 | +	profile_start ( &http_rx_profiler );
 | 
		
	
		
			
			| 895 | 903 |  	while ( iobuf && iob_len ( iobuf ) ) {
 | 
		
	
		
			
			| 896 | 904 |  
 | 
		
	
		
			
			| 897 | 905 |  		switch ( http->rx_state ) {
 | 
		
	
	
		
			
			|  | @@ -927,16 +935,20 @@ static int http_socket_deliver ( struct http_request *http,
 | 
		
	
		
			
			| 927 | 935 |  				iob_pull ( iobuf, data_len );
 | 
		
	
		
			
			| 928 | 936 |  			} else if ( data_len < iob_len ( iobuf ) ) {
 | 
		
	
		
			
			| 929 | 937 |  				/* Deliver partial buffer as raw data */
 | 
		
	
		
			
			|  | 938 | +				profile_start ( &http_xfer_profiler );
 | 
		
	
		
			
			| 930 | 939 |  				rc = xfer_deliver_raw ( &http->xfer,
 | 
		
	
		
			
			| 931 | 940 |  							iobuf->data, data_len );
 | 
		
	
		
			
			| 932 | 941 |  				iob_pull ( iobuf, data_len );
 | 
		
	
		
			
			| 933 | 942 |  				if ( rc != 0 )
 | 
		
	
		
			
			| 934 | 943 |  					goto done;
 | 
		
	
		
			
			|  | 944 | +				profile_stop ( &http_xfer_profiler );
 | 
		
	
		
			
			| 935 | 945 |  			} else {
 | 
		
	
		
			
			| 936 | 946 |  				/* Deliver whole I/O buffer */
 | 
		
	
		
			
			|  | 947 | +				profile_start ( &http_xfer_profiler );
 | 
		
	
		
			
			| 937 | 948 |  				if ( ( rc = xfer_deliver_iob ( &http->xfer,
 | 
		
	
		
			
			| 938 | 949 |  						 iob_disown ( iobuf ) ) ) != 0 )
 | 
		
	
		
			
			| 939 | 950 |  					goto done;
 | 
		
	
		
			
			|  | 951 | +				profile_stop ( &http_xfer_profiler );
 | 
		
	
		
			
			| 940 | 952 |  			}
 | 
		
	
		
			
			| 941 | 953 |  			http->rx_len += data_len;
 | 
		
	
		
			
			| 942 | 954 |  			if ( http->chunk_remaining ) {
 | 
		
	
	
		
			
			|  | @@ -985,6 +997,7 @@ static int http_socket_deliver ( struct http_request *http,
 | 
		
	
		
			
			| 985 | 997 |  	if ( rc )
 | 
		
	
		
			
			| 986 | 998 |  		http_close ( http, rc );
 | 
		
	
		
			
			| 987 | 999 |  	free_iob ( iobuf );
 | 
		
	
		
			
			|  | 1000 | +	profile_stop ( &http_rx_profiler );
 | 
		
	
		
			
			| 988 | 1001 |  	return rc;
 | 
		
	
		
			
			| 989 | 1002 |  }
 | 
		
	
		
			
			| 990 | 1003 |  
 |