| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# monitor_utils.h

Go to the documentation of this file.

    00001
    00007 /*
    00008  * ApMon - Application Monitoring Tool
    00009  * Version: 2.1.0
    00010  *
    00011  * Copyright (C) 2006 California Institute of Technology
    00012  *
    00013  * Permission is hereby granted, free of charge, to use, copy and modify
    00014  * this software and its documentation (the "Software") for any
    00015  * purpose, provided that existing copyright notices are retained in
    00016  * all copies and that this notice is included verbatim in any distributions
    00017  * or substantial portions of the Software.
    00018  * This software is a part of the MonALISA framework (http://monalisa.cacr.caltech.edu).
    00019  * Users of the Software are asked to feed back problems, benefits,
    00020  * and/or suggestions about the software to the MonALISA Development Team
    00021  * (developers@monalisa.cern.ch). Support for this software - fixing of bugs,
    00022  * incorporation of new features - is done on a best effort basis. All bug
    00023  * fixes and enhancements will be made available under the same terms and
    00024  * conditions as the original software,
    00025
    00026  * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
    00027  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
    00028  * OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
    00029  * EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00030
    00031  * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
    00032  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
    00033  * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS
    00034  * PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
    00035  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
    00036  * MODIFICATIONS.
    00037  */
    00038
    00039 #ifndef monitor_utils_h
    00040 #define monitor_utils_h
    00041
    00042 namespace apmon_mon_utils {
    00043
    00048   typedef struct PsInfo {
    00049     double etime; /* elapsed time since the job started, in seconds */
    00050     double cputime; /* CPU time allocated so far to this job. */
    00051     double pcpu; /* percent of the processor currently used by the job */
    00052     double pmem; /* percent of the system memory currently used by the job */
    00053     double rsz; /* resident image size of the job, in KB */
    00054     double vsz; /* amount of the virtual memory occupied by the job, in KB */
    00055     double open_fd; /* number of opened file descriptors */
    00056   } PsInfo;
    00057
    00061   typedef struct JobDirInfo {
    00062     /* the size of the job's working directory */
    00063     double workdir_size;
    00064     /* size of the partition on which the working directory resides, in MB */
    00065     double disk_total;
    00066     /* the amount of disk used on the working directory's partition */
    00067     double disk_used;
    00068     /* the amount of disk free on the working directory's partition */
    00069     double disk_free;
    00070     /* disk usage in percent on the working directort's partition */
    00071     double disk_usage;
    00072   } JobDirInfo;
    00073
    00075   long *getChildren(long pid, int& nChildren) throw(runtime_error);
    00076
    00080   void readJobInfo(long pid, PsInfo& info) throw(runtime_error);
    00081
    00086   long parsePSTime(char *s);
    00087
    00093   void readJobDiskUsage(MonitoredJob job, JobDirInfo& info)
    00094     throw(runtime_error);
    00095 }
    00096
    00097 #endif