[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] Proposal: Block device and network stats



On Fri, Aug 10, 2007 at 01:59:34PM +0100, Richard W.M. Jones wrote:
> It was suggested to me that we should provide a way to return bytes read 
> and written on block devices (not just requests).  Xen doesn't support 
> that however, so I have also changed the fields in this structure so 
> that they can be returned set to -1 to indicate "no data / not supported".
> 
> The updated stats structures are shown below.
> 
> Rich.
> 
> /* Block device stats for virDomainBlockStats.
>  *
>  * Hypervisors may return a field set to (int64_t)-1 which indicates
>  * that the hypervisor does not support that statistic.
>  */
> struct _virDomainBlockStats {
>   int64_t rd_req;
>   int64_t rd_bytes;
>   int64_t wr_req;
>   int64_t wr_byes;
>   int64_t errs;   // In Xen this returns the mysterious 'oo_req'.
> };
> typedef struct _virDomainBlockStats *virDomainBlockStatsPtr;
> 
> /* Network interface stats for virDomainInterfaceStats.
>  *
>  * Hypervisors may return a field set to (int64_t)-1 which indicates
>  * that the hypervisor does not support that statistic.
>  */
> struct _virDomainInterfaceStats {
>   int64_t rx_bytes;
>   int64_t rx_packets;
>   int64_t rx_errs;
>   int64_t rx_drop;
>   int64_t tx_bytes;
>   int64_t tx_packets;
>   int64_t tx_errs;
>   int64_t tx_drop;
> };
> typedef struct _virDomainInterfaceStats *virDomainInterfaceStatsPtr;

Seems like a reasonable set of fields. It is probably worthwhile though to
ensure that we design the APIs so that the structs are always allocated by
the internal driver and not the caller. This allows us to add more fields
at a later date if needed.

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]