00001 /* 00002 * gkemu.h 00003 * 00004 * Copyright (c) 2003 The University of Utah and the Flux Group. 00005 * All rights reserved. 00006 * 00007 * This file is licensed under the terms of the GNU Public License. 00008 * See the file "license.terms" for restrictions on redistribution 00009 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 00010 */ 00011 00012 /** 00013 * @file gkemu.h 00014 * 00015 * Header file for GKrellmd (http://www.gkrellm.net) emulation functions. 00016 * GKrellm is a system monitoring utility that displays the current system 00017 * state in a nice GUI. Fortunately, it supports a client/server mode that 00018 * uses a simple network protocol for communicating the system state. So, 00019 * instead of sending the entire state of the system back to the GUI client, we 00020 * send back the state of a TimeSys resource set. The following monitors are 00021 * supported: 00022 * 00023 * @li @e HostName The name of the resource set. 00024 * @li @e SystemName The name of the executable. 00025 * @li @e CPU_0 The CPU usage for all the processes in the set. 00026 * @li @e CPU_1 The CPU reservation for the resource set and the amount of the 00027 * reservation that is currently in use. 00028 * @li @e UpTime The length of time rktimes(1) has been running. 00029 * @li @e Proc The number of processes in the resource set. 00030 */ 00031 00032 #ifndef _gkemu_h 00033 #define _gkemu_h 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #include <sys/types.h> 00040 00041 /** 00042 * Argument tags for the functions. 00043 */ 00044 typedef enum { 00045 GKA_TAG_DONE, /**< () - Terminate the tag list. */ 00046 GKA_HostName, /**< (char *) - Host name. */ 00047 GKA_SystemName, /**< (char *) - System name. */ 00048 GKA_CPUUser, /**< (unsigned long long) - User time CPU usage. */ 00049 GKA_CPUIdle, /**< (unsigned long long) - CPU idle time. */ 00050 GKA_CPUReserveUser, /**< (unsigned long long) - CPU reserve. */ 00051 GKA_CPUReserveNice, /**< (unsigned long long) - CPU reserve consumed. */ 00052 GKA_CPUReserveIdle, /**< (unsigned long long) - CPU not reserved. */ 00053 GKA_UpTime, /**< (struct timeval *) - Process running time. */ 00054 GKA_Processes, /**< (unsigned int) - Number of processes in the 00055 * set. 00056 */ 00057 GKA_ProcessesRunning, /**< (unsigned int) - Number of running processes in 00058 * the set. 00059 */ 00060 } gka_tag_t; 00061 00062 /** 00063 * Tag string used to mark the beginning of the "initial update". 00064 */ 00065 extern const char *gkInitialUpdateOpen; 00066 00067 /** 00068 * Tag string used to mark the end of the "initial update". 00069 */ 00070 extern const char *gkInitialUpdateClose; 00071 00072 /** 00073 * Format the preamble into the given buffer. 00074 * 00075 * @param buf The buffer to fill with the preamble. 00076 * @param buf_len The length, in bytes, of 'buf'. 00077 * @param tag The beginning of the tag arguments. 00078 * @return The length of preamble in the buffer. 00079 */ 00080 int gkFormatPreamble(char *buf, size_t buf_len, gka_tag_t tag, ...); 00081 00082 /** 00083 * Format an update into the given buffer. 00084 * 00085 * @param buf The buffer to fill with the preamble. 00086 * @param buf_len The length, in bytes, of 'buf'. 00087 * @param tag The beginning of the tag arguments. 00088 * @return The length of the update in the buffer. 00089 */ 00090 int gkFormatUpdate(char *buf, size_t buf_len, gka_tag_t tag, ...); 00091 00092 #ifdef __cplusplus 00093 } 00094 #endif 00095 00096 #endif