1 (* 'top'-like tool for libvirt domains.
2 (C) Copyright 2007 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.
19 This file contains utility functions.
22 (* Filename concatenation. *)
23 val (//) : string -> string -> string
25 (* Read a configuration file as a list of (lineno, key, value) pairs.
26 * If the config file is missing this returns an empty list.
28 val read_config_file : string -> (int * string * string) list
30 (* Pad or truncate a string to a fixed width. *)
31 val pad : int -> string -> string
33 (* Int64 operators for convenience. *)
34 val (+^) : int64 -> int64 -> int64
35 val (-^) : int64 -> int64 -> int64
36 val ( *^ ) : int64 -> int64 -> int64
37 val (/^) : int64 -> int64 -> int64
39 (* Utility functions for formating numbers as short strings. *)
41 val percent : float -> string
42 val int64_option : int64 option -> string
43 val int64 : int64 -> string
44 val time : int64 -> string
47 (* Helpers for manipulating block_stats & interface_stats. *)
50 val sum_block_stats : block_stats list -> block_stats
51 val diff_block_stats : block_stats -> block_stats -> block_stats
53 val sum_interface_stats : interface_stats list -> interface_stats
54 val diff_interface_stats : interface_stats -> interface_stats -> interface_stats