diff options
author | Michael Brown | 2017-09-05 23:55:05 +0200 |
---|---|---|
committer | Michael Brown | 2017-09-06 00:23:22 +0200 |
commit | 7e673a6b67be1594e16a8cc5ab4a0d6c17799547 (patch) | |
tree | 863552df11d5bd2800203e7dd94a20e53177b096 /src/include/ipxe | |
parent | [monojob] Display job status message, if present (diff) | |
download | ipxe-7e673a6b67be1594e16a8cc5ab4a0d6c17799547.tar.gz ipxe-7e673a6b67be1594e16a8cc5ab4a0d6c17799547.tar.xz ipxe-7e673a6b67be1594e16a8cc5ab4a0d6c17799547.zip |
[peerdist] Gather and report peer statistics during download
Record and report the number of peers (calculated as the maximum
number of peers discovered for a block's segment at the time that the
block download is complete), and the percentage of blocks retrieved
from peers rather than from the origin server.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r-- | src/include/ipxe/peerdisc.h | 6 | ||||
-rw-r--r-- | src/include/ipxe/peermux.h | 13 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/include/ipxe/peerdisc.h b/src/include/ipxe/peerdisc.h index f08ccaae..45d592e7 100644 --- a/src/include/ipxe/peerdisc.h +++ b/src/include/ipxe/peerdisc.h @@ -109,6 +109,12 @@ peerdisc_init ( struct peerdisc_client *peerdisc, extern unsigned int peerdisc_timeout_secs; +extern void peerdisc_stat ( struct interface *intf, struct peerdisc_peer *peer, + struct list_head *peers ); +#define peerdisc_stat_TYPE( object_type ) \ + typeof ( void ( object_type, struct peerdisc_peer *peer, \ + struct list_head *peers ) ) + extern int peerdisc_open ( struct peerdisc_client *peerdisc, const void *id, size_t len ); extern void peerdisc_close ( struct peerdisc_client *peerdisc ); diff --git a/src/include/ipxe/peermux.h b/src/include/ipxe/peermux.h index 44cbdb9d..54acbfec 100644 --- a/src/include/ipxe/peermux.h +++ b/src/include/ipxe/peermux.h @@ -41,6 +41,16 @@ struct peerdist_multiplexed_block { struct interface xfer; }; +/** PeerDist statistics */ +struct peerdist_statistics { + /** Maximum observed number of peers */ + unsigned int peers; + /** Number of blocks downloaded in total */ + unsigned int total; + /** Number of blocks downloaded from peers */ + unsigned int local; +}; + /** A PeerDist download multiplexer */ struct peerdist_multiplexer { /** Reference count */ @@ -65,6 +75,9 @@ struct peerdist_multiplexer { struct list_head idle; /** Block downloads */ struct peerdist_multiplexed_block block[PEERMUX_MAX_BLOCKS]; + + /** Statistics */ + struct peerdist_statistics stats; }; extern int peermux_filter ( struct interface *xfer, struct interface *info, |