"Fossies" - the Fresh Open Source Software Archive

Member "procmeter3-3.6+svn387/modules/README" (24 Dec 2010, 2794 Bytes) of package /linux/misc/procmeter3-3.6+svn387.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1                                 ProcMeter - Version 3.1 - Modules
    2                                 =================================
    3 
    4 In version 3.x of ProcMeter the different outputs (graphs or text) are
    5 implemented as loadable modules.
    6 
    7 
    8 Version 3.1 changes
    9 -------------------
   10 
   11 The graph_units field is now a printf string that is filled in at run time with
   12 the value of the graph_scale field.
   13 
   14 
   15 Interface
   16 ---------
   17 
   18 To be used in ProcMeter they must follow a few simple rules that allows the
   19 ProcMeter program load them and interact with them.
   20 
   21 1) The Load() function.
   22 
   23 There must be a function with the following prototype:
   24 
   25 ProcMeterModule *Load(void);
   26 
   27 This function will be the first one in the module that is called.  It will only
   28 be called once, if it does not exist then the module will not be loaded.  The
   29 purpose of the function is to initialise the module and return information to
   30 the main program so that the initialisation can proceed.
   31 
   32 
   33 2) The Initialise() function
   34 
   35 There must be a function with the following prototype:
   36 
   37 ProcMeterOutput **Initialise(char *options);
   38 
   39 This function will be called once only, following the Load() function.  The
   40 purpose of the module is to initialise all of the outputs and return the
   41 information about them to the main program as a NULL terminated array.  The
   42 'options' parameter is a string that is taken from the .procmeterrc file for the
   43 module.
   44 
   45 
   46 3) The Update() function
   47 
   48 There must be a function with the following prototype:
   49 
   50 int Update(time_t now,ProcMeterOutput *output);
   51 
   52 This function is called each time that one of the outputs needs to be updated.
   53 The parameter 'now' is the current time and may be the same on different calls
   54 to the function or it may be higher, it never decreases.  The 'output' parameter
   55 is a pointer to one of the outputs that were returned in the Initialise()
   56 function.  This output is to have its information filled in (both text and graph
   57 if appropriate).  If the Update function is succesful it should return 0, if
   58 there is an error it should set the output values to a suitable value and return
   59 -1.
   60 
   61 
   62 4) The Unload() function
   63 
   64 There can be a function with the following prototype:
   65 
   66 void Unload(void);
   67 
   68 If it exists then it is called after all of the other functions, before the
   69 module is unloaded.  It is only ever called once.
   70 
   71 
   72 Compilation
   73 -----------
   74 
   75 The module must be compiled to be a loadable object.  If the source file name is
   76 template.c then the following commands will do that.
   77 
   78         gcc -c -O template.c -o template.o -I.. -fPIC
   79         ld template.o -o template.so -shared
   80 
   81 
   82 Example
   83 -------
   84 
   85 As an example the file template.c is a very simple example of a module.  It can
   86 be used as the basis for other modules since the basic file structure is
   87 present.
   88 
   89 
   90 
   91 Andrew M. Bishop
   92 12th Feb 1999