1 (* 'top'-like tool for libvirt domains.
2 (C) Copyright 2007-2017 Richard W.M. Jones, Red Hat Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 (* Intermediate "domain + stats" structure that we use to collect
21 * everything we know about a domain within the collect function.
23 type rd_domain = Inactive | Active of rd_active
25 rd_domid : int; (* Domain ID. *)
26 rd_domuuid : Libvirt.uuid; (* Domain UUID. *)
27 rd_dom : [`R] Libvirt.Domain.t; (* Domain object. *)
28 rd_info : Libvirt.Domain.info; (* Domain CPU info now. *)
29 rd_block_stats : (string * Libvirt.Domain.block_stats) list;
30 (* Domain block stats now. *)
31 rd_interface_stats : (string * Libvirt.Domain.interface_stats) list;
32 (* Domain net stats now. *)
33 rd_prev_info : Libvirt.Domain.info option; (* Domain CPU info previously. *)
34 rd_prev_block_stats : (string * Libvirt.Domain.block_stats) list;
35 (* Domain block stats prev. *)
36 rd_prev_interface_stats : (string * Libvirt.Domain.interface_stats) list;
37 (* Domain interface stats prev. *)
38 (* The following are since the last slice, or 0 if cannot be calculated: *)
39 rd_cpu_time : float; (* CPU time used in nanoseconds. *)
40 rd_percent_cpu : float; (* CPU time as percent of total. *)
41 rd_mem_bytes : int64; (* Memory usage in bytes *)
42 rd_mem_percent: int64; (* Memory usage as percent of total *)
43 (* The following are since the last slice, or None if cannot be calc'd: *)
44 rd_block_rd_reqs : int64 option; (* Number of block device read rqs. *)
45 rd_block_wr_reqs : int64 option; (* Number of block device write rqs. *)
46 rd_block_rd_bytes : int64 option; (* Number of bytes block device read *)
47 rd_block_wr_bytes : int64 option; (* Number of bytes block device write *)
48 rd_net_rx_bytes : int64 option; (* Number of bytes received. *)
49 rd_net_tx_bytes : int64 option; (* Number of bytes transmitted. *)
53 rd_doms : (string * rd_domain) list; (* List of domains. *)
55 rd_printable_time : string;
58 rd_total_cpu_per_pcpu : float;
59 rd_totals : (int * int * int * int * int * int * int * int * int * float *
64 rd_pcpu_doms : (int * string * int *
65 Libvirt.Domain.vcpu_info array * int64 array array *
66 int64 array array * string * int) list;
67 rd_pcpu_pcpus : int64 array array array;
68 rd_pcpu_pcpus_cpu_time : float array
71 val collect : Types.setup -> stats
72 (** Collect statistics. *)
74 val collect_pcpu : stats -> pcpu_stats
75 (** Used in PCPUDisplay mode only, this returns extra per-PCPU stats. *)
77 val clear_pcpu_display_data : unit -> unit
78 (** Clear the cache of pcpu_usages used by PCPUDisplay display_mode
79 when we switch back to TaskDisplay mode. *)