Browse Source

[ipv4] Profile transmit and receive datapaths

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

+ 15
- 0
src/net/ipv4.c View File

16
 #include <ipxe/settings.h>
16
 #include <ipxe/settings.h>
17
 #include <ipxe/fragment.h>
17
 #include <ipxe/fragment.h>
18
 #include <ipxe/ipstat.h>
18
 #include <ipxe/ipstat.h>
19
+#include <ipxe/profile.h>
19
 
20
 
20
 /** @file
21
 /** @file
21
  *
22
  *
41
 	.stats = &ipv4_stats,
42
 	.stats = &ipv4_stats,
42
 };
43
 };
43
 
44
 
45
+/** Transmit profiler */
46
+static struct profiler ipv4_tx_profiler __profiler = { .name = "ipv4.tx" };
47
+
48
+/** Receive profiler */
49
+static struct profiler ipv4_rx_profiler __profiler = { .name = "ipv4.rx" };
50
+
44
 /**
51
 /**
45
  * Add IPv4 minirouting table entry
52
  * Add IPv4 minirouting table entry
46
  *
53
  *
263
 	const void *ll_dest;
270
 	const void *ll_dest;
264
 	int rc;
271
 	int rc;
265
 
272
 
273
+	/* Start profiling */
274
+	profile_start ( &ipv4_tx_profiler );
275
+
266
 	/* Update statistics */
276
 	/* Update statistics */
267
 	ipv4_stats.out_requests++;
277
 	ipv4_stats.out_requests++;
268
 
278
 
358
 		}
368
 		}
359
 	}
369
 	}
360
 
370
 
371
+	profile_stop ( &ipv4_tx_profiler );
361
 	return 0;
372
 	return 0;
362
 
373
 
363
  err:
374
  err:
430
 	uint16_t pshdr_csum;
441
 	uint16_t pshdr_csum;
431
 	int rc;
442
 	int rc;
432
 
443
 
444
+	/* Start profiling */
445
+	profile_start ( &ipv4_rx_profiler );
446
+
433
 	/* Update statistics */
447
 	/* Update statistics */
434
 	ipv4_stats.in_receives++;
448
 	ipv4_stats.in_receives++;
435
 	ipv4_stats.in_octets += iob_len ( iobuf );
449
 	ipv4_stats.in_octets += iob_len ( iobuf );
528
 		return rc;
542
 		return rc;
529
 	}
543
 	}
530
 
544
 
545
+	profile_stop ( &ipv4_rx_profiler );
531
 	return 0;
546
 	return 0;
532
 
547
 
533
  err_header:
548
  err_header:

Loading…
Cancel
Save