1 This file contains some tips for hacking on this code.
5 (1) The *.mli file describes the interface of the module. It's a good
6 idea to look at this file first, then at *.ml (the implementation).
8 (2) Emacs users: use tuareg-mode for editing OCaml.
10 (3) http://www.ocaml-tutorial.org/
12 (4) http://camltastic.blogspot.com/2008/08/3-things-that-will-confuse-you-when.html
14 The code is structured into these files:
16 virt_top_utils.mli / virt_top_utils.ml
18 String functions and other small utility functions. This is
19 included directly into virt_top.ml.
23 The version number (automatically generated by configure).
25 virt_top.mli / virt_top.ml
27 This is the virt-top program.
29 The two interesting functions are called 'collect' and 'redraw'.
31 'collect' collects all the information about domains, etc.
33 'redraw' updates the display on each frame.
35 Another interesting function is 'start_up' which handles all
36 start-up stuff, eg. command line arguments, connecting to the
37 hypervisor, enabling curses.
39 The function 'main_loop' runs the main loop and has sub-functions
40 to deal with keypresses, help screens and so on.
44 Any code which needs the optional xml-light library goes
45 in here. Mainly for parsing domain XML descriptions to get
46 the list of block devices and network interfaces.
48 The reason for having it in a separate file is so that we
49 don't depend on xml-light.
53 Any code which needs the optional ocaml-csv library goes
54 in here. This implements the --csv command line option.
59 Any code which needs the optional ocaml-calendar library
60 goes in here. This implements the --end-time command line
61 option. Note there are two incompatible versions of the
62 ocaml-calendar library, which is why we have two
63 implementations. The Makefile works out which one to use.
67 Gettext interaction (this is generated by ./configure).
71 This is just a small bit of code to glue the modules above
74 The man-page is generated from the single file:
78 which generates (using perldoc) the following: