mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +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:
@@ -76,6 +76,36 @@ static struct peerdisc_segment * peerdisc_find ( const char *id );
|
||||
static int peerdisc_discovered ( struct peerdisc_segment *segment,
|
||||
const char *location );
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Statistics reporting
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Report peer discovery statistics
|
||||
*
|
||||
* @v intf Interface
|
||||
* @v peer Selected peer (or NULL)
|
||||
* @v peers List of available peers
|
||||
*/
|
||||
void peerdisc_stat ( struct interface *intf, struct peerdisc_peer *peer,
|
||||
struct list_head *peers ) {
|
||||
struct interface *dest;
|
||||
peerdisc_stat_TYPE ( void * ) *op =
|
||||
intf_get_dest_op ( intf, peerdisc_stat, &dest );
|
||||
void *object = intf_object ( dest );
|
||||
|
||||
if ( op ) {
|
||||
op ( object, peer, peers );
|
||||
} else {
|
||||
/* Default is to do nothing */
|
||||
}
|
||||
|
||||
intf_put ( dest );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Discovery sockets
|
||||
|
||||
Reference in New Issue
Block a user