diff options
author | Michael Brown | 2014-04-28 13:30:09 +0200 |
---|---|---|
committer | Michael Brown | 2014-04-28 13:30:30 +0200 |
commit | f65c81b1d079ea36809141f6694976654308651d (patch) | |
tree | 1283cb5c8fcd751cc01f882eabb1c951659e6dd6 /src/net/ipv4.c | |
parent | [librm] Use genuine real mode to accelerate operation in virtual machines (diff) | |
download | ipxe-f65c81b1d079ea36809141f6694976654308651d.tar.gz ipxe-f65c81b1d079ea36809141f6694976654308651d.tar.xz ipxe-f65c81b1d079ea36809141f6694976654308651d.zip |
[ipv4] Profile transmit and receive datapaths
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/ipv4.c')
-rw-r--r-- | src/net/ipv4.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/net/ipv4.c b/src/net/ipv4.c index c5cfd134..9c5cf2eb 100644 --- a/src/net/ipv4.c +++ b/src/net/ipv4.c @@ -16,6 +16,7 @@ #include <ipxe/settings.h> #include <ipxe/fragment.h> #include <ipxe/ipstat.h> +#include <ipxe/profile.h> /** @file * @@ -41,6 +42,12 @@ ipv4_stats_family __ip_statistics_family ( IP_STATISTICS_IPV4 ) = { .stats = &ipv4_stats, }; +/** Transmit profiler */ +static struct profiler ipv4_tx_profiler __profiler = { .name = "ipv4.tx" }; + +/** Receive profiler */ +static struct profiler ipv4_rx_profiler __profiler = { .name = "ipv4.rx" }; + /** * Add IPv4 minirouting table entry * @@ -263,6 +270,9 @@ static int ipv4_tx ( struct io_buffer *iobuf, const void *ll_dest; int rc; + /* Start profiling */ + profile_start ( &ipv4_tx_profiler ); + /* Update statistics */ ipv4_stats.out_requests++; @@ -358,6 +368,7 @@ static int ipv4_tx ( struct io_buffer *iobuf, } } + profile_stop ( &ipv4_tx_profiler ); return 0; err: @@ -430,6 +441,9 @@ static int ipv4_rx ( struct io_buffer *iobuf, uint16_t pshdr_csum; int rc; + /* Start profiling */ + profile_start ( &ipv4_rx_profiler ); + /* Update statistics */ ipv4_stats.in_receives++; ipv4_stats.in_octets += iob_len ( iobuf ); @@ -528,6 +542,7 @@ static int ipv4_rx ( struct io_buffer *iobuf, return rc; } + profile_stop ( &ipv4_rx_profiler ); return 0; err_header: |