mirror of
https://github.com/ipxe/ipxe
synced 2026-04-16 03:00:10 +03:00
[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>
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user