diff options
Diffstat (limited to 'src/libvmon/defs')
-rw-r--r-- | src/libvmon/defs/_begin.def | 549 | ||||
-rw-r--r-- | src/libvmon/defs/_end.def | 43 | ||||
-rw-r--r-- | src/libvmon/defs/proc_files.def | 8 | ||||
-rw-r--r-- | src/libvmon/defs/proc_io.def | 33 | ||||
-rw-r--r-- | src/libvmon/defs/proc_stat.def | 105 | ||||
-rw-r--r-- | src/libvmon/defs/proc_vm.def | 19 | ||||
-rw-r--r-- | src/libvmon/defs/proc_wants.def | 14 | ||||
-rw-r--r-- | src/libvmon/defs/sys_stat.def | 114 | ||||
-rw-r--r-- | src/libvmon/defs/sys_vm.def | 169 | ||||
-rw-r--r-- | src/libvmon/defs/sys_wants.def | 7 |
10 files changed, 1061 insertions, 0 deletions
diff --git a/src/libvmon/defs/_begin.def b/src/libvmon/defs/_begin.def new file mode 100644 index 0000000..047fd4d --- /dev/null +++ b/src/libvmon/defs/_begin.def @@ -0,0 +1,549 @@ +/* the common types are handled in _begin.def and _end.def, individual .def files are free to create special types as well, but should + * provide macros for all the ifdef's supported here for any additions. + */ + +/* for declaring the want-specific sample data structure (used by vmon.h) */ +#ifdef VMON_DECLARE_MEMBERS +#define vmon_datum_str(_name, _sym, _label, _desc) char *_name; +#define vmon_datum_str_array(_name, _sym, _label, _desc) char **_name; +#define vmon_datum_char(_name, _sym, _label, _desc) char _name; +#define vmon_datum_char_array(_name, _sym, _label, _desc) vmon_char_array_t _name; +#define vmon_datum_int(_name, _sym, _label, _desc) int _name; +#define vmon_datum_uint(_name, _sym, _label, _desc) unsigned int _name; +#define vmon_datum_ulong(_name, _sym, _label, _desc) unsigned long _name; +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) unsigned long long _name; +#define vmon_datum_long(_name, _sym, _label, _desc) long _name; +#define vmon_datum_longlong(_name, _sym, _label, _desc) long long _name; + +/* leave omissions undefined, they'll get defined as noops at the end of this file */ +#endif + + + +/* for creating the symbolic constants enumeration (used by vmon.h) */ +#ifdef VMON_ENUM_SYMBOLS +#define vmon_datum_str(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_str_array(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_char(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_char_array(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_int(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_uint(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_ulong(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_long(_name, _sym, _label, _desc) VMON_ ## _sym, +#define vmon_datum_longlong(_name, _sym, _label, _desc) VMON_ ## _sym, + +/* leave omissions undefined, they'll get defined as noops at the end of this file */ +#endif + + + +/* for creating an offset table relating symbols to struct member offsets */ +#ifdef VMON_INITIALIZE_OFFSET_TABLE +/* TODO: error out using #error if VMON_OFFSET_TABLE_STRUCT is not defined */ +/* I use the gcc builtin here because it's convenient, otherwise we either do the double macro expansion dance or put the offsetof definition here */ +#define vmon_datum_str(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_str_array(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_char(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_char_array(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_int(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_uint(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_ulong(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_long(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), +#define vmon_datum_longlong(_name, _sym, _label, _desc) __builtin_offsetof(VMON_OFFSET_TABLE_STRUCT, _name), + +/* no offsets can exist for omitted members, so they're declared as nops */ +/* leave omissions undefined, they'll get defined as noops at the end of this file */ +#endif + + + +/* for creating a lookup table for the member names as strings, indexed by the enumerated symbols */ +#ifdef VMON_INITIALIZE_NAME_TABLE +#define vmon_datum_str(_name, _sym, _label, _desc) #_name , +#define vmon_datum_str_array(_name, _sym, _label, _desc) #_name , +#define vmon_datum_char(_name, _sym, _label, _desc) #_name , +#define vmon_datum_char_array(_name, _sym, _label, _desc) #_name , +#define vmon_datum_int(_name, _sym, _label, _desc) #_name , +#define vmon_datum_uint(_name, _sym, _label, _desc) #_name , +#define vmon_datum_ulong(_name, _sym, _label, _desc) #_name , +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) #_name , +#define vmon_datum_long(_name, _sym, _label, _desc) #_name , +#define vmon_datum_longlong(_name, _sym, _label, _desc) #_name , + +/* leave omissions undefined, they'll get defined as noops at the end of this file */ +#endif + + + +/* for creating a lookup table for the human-readable descriptions, indexed by the enumerated symbols */ +#ifdef VMON_INITIALIZE_DESC_TABLE +#define vmon_datum_str(_name, _sym, _label, _desc) _desc , +#define vmon_datum_str_array(_name, _sym, _label, _desc) _desc , +#define vmon_datum_char(_name, _sym, _label, _desc) _desc , +#define vmon_datum_char_array(_name, _sym, _label, _desc) _desc , +#define vmon_datum_int(_name, _sym, _label, _desc) _desc , +#define vmon_datum_uint(_name, _sym, _label, _desc) _desc , +#define vmon_datum_ulong(_name, _sym, _label, _desc) _desc , +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) _desc , +#define vmon_datum_long(_name, _sym, _label, _desc) _desc , +#define vmon_datum_longlong(_name, _sym, _label, _desc) _desc , + +/* leave omissions undefined, they'll get defined as noops at the end of this file */ +#endif + + + +/* these are different from the symbols, because they ignore the omissions, the definition includes all fields so we can parse the file, + * but the symbols only relate to fields we actually store in memory. */ +#ifdef VMON_ENUM_PARSER_STATES +#define vmon_datum_str(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_str_array(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_char(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_char_array(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_int(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_uint(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_ulong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_long(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_datum_longlong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, + +#define vmon_omit_n(_n, _sym, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_literal(_lit, _sym) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_run(_char, _sym) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_str(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_str_array(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_char(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_char_array(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_int(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_uint(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_ulong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_ulonglong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_long(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#define vmon_omit_longlong(_name, _sym, _label, _desc) VMON_PARSER_STATE_ ## _sym, +#endif + + +/* most the stuff we need in scope for the parser generated via VMON_IMPLEMENT_PARSER before including the appropriate .def */ +#ifdef VMON_PREPARE_PARSER + char input; + int var_isneg = 0; + int var_int = 0; + unsigned int var_uint = 0; + long var_long = 0; + long long var_longlong = 0; + unsigned long var_ulong = 0; + unsigned long long var_ulonglong = 0; + char *var_array = NULL; + int var_array_alloc_len = 0, var_array_len = 0; + +#define vmon_datum_str(_name, _sym, _label, _desc) +#define vmon_datum_str_array(_name, _sym, _label, _desc) +#define vmon_datum_char(_name, _sym, _label, _desc) +#define vmon_datum_char_array(_name, _sym, _label, _desc) +#define vmon_datum_int(_name, _sym, _label, _desc) +#define vmon_datum_uint(_name, _sym, _label, _desc) +#define vmon_datum_ulong(_name, _sym, _label, _desc) +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) +#define vmon_datum_long(_name, _sym, _label, _desc) +#define vmon_datum_longlong(_name, _sym, _label, _desc) + +#define vmon_omit_n(_n, _sym, _desc) +#define vmon_omit_literal(_lit, _sym) +#define vmon_omit_run(_char, _sym) +#define vmon_omit_str(_name, _sym, _label, _desc) +#define vmon_omit_str_array(_name, _sym, _label, _desc) +#define vmon_omit_char(_name, _sym, _label, _desc) +#define vmon_omit_char_array(_name, _sym, _label, _desc) +#define vmon_omit_int(_name, _sym, _label, _desc) +#define vmon_omit_uint(_name, _sym, _label, _desc) +#define vmon_omit_ulong(_name, _sym, _label, _desc) +#define vmon_omit_ulonglong(_name, _sym, _label, _desc) +#define vmon_omit_long(_name, _sym, _label, _desc) +#define vmon_omit_longlong(_name, _sym, _label, _desc) +#endif + + +/* implements the cases for a simple switch()-based bytestream parser */ +#ifdef VMON_IMPLEMENT_PARSER +/* TODO: error out if the following aren't defined, these are utilized by the parser FSM: + * VMON_PARSER_DELIM <-- what value to treat as a delimiter for string/char arrays (sort of like IFS in bash) + * TODO: there are a bunch of variables we assume are available and named a certain way here, + * it would be preferable to be able to define those externally and inform the x-macro of their + * names etc. + */ +#define vmon_datum_str(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case VMON_PARSER_DELIM:\ + /* store accumulated string, reset tmp, and advance */\ + if(*store)->_name) {\ + if( strncmp((*store)->name, _array, var_array_len) ||\ + (*store)->name[var_array_len] != '\0') {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + }\ + free((*store)->name);\ + } else {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + }\ + (*store)->_name = strndup(var_array, var_array_len);\ + var_array_len = 0;\ + state++;\ + break;\ + default:\ + /* accumulate string */\ + var_array[var_array_len++] = input;\ + break;\ + }\ + break; + +#define vmon_datum_str_array(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + /* TODO ? */ \ + break; + +#define vmon_datum_char(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + if((*store)->_name != input) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = input;\ + }\ + state++;\ + break; + +#define vmon_datum_char_array(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + /* TODO */\ + /* TODO */\ + break; + +#define vmon_datum_int(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '-':\ + /* TODO: we don't verify the '-' is leading... */\ + var_isneg = 1;\ + break;\ + case '0' ... '9':\ + var_int *= 10;\ + var_int += input - '0';\ + break;\ + default:\ + if(var_isneg) {\ + var_int = -var_int;\ + var_isneg = 0;\ + }\ + if((*store)->_name != var_int) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_int;\ + }\ + var_int = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_datum_uint(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + var_uint *= 10;\ + var_uint += input - '0';\ + break;\ + default:\ + if((*store)->_name != var_uint) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_uint;\ + }\ + var_uint = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_datum_ulong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + var_ulong *= 10;\ + var_ulong += input - '0';\ + break;\ + default:\ + if((*store)->_name != var_ulong) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_ulong;\ + }\ + var_ulong = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_datum_ulonglong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + var_ulonglong *= 10;\ + var_ulonglong += input - '0';\ + break;\ + default:\ + if((*store)->_name != var_ulonglong) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_ulonglong;\ + }\ + var_ulonglong = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_datum_long(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '-':\ + /* TODO: we dont verify the '-' is leading... */\ + var_isneg = 1;\ + break;\ + case '0' ... '9':\ + var_long *= 10;\ + var_long += input - '0';\ + break;\ + default:\ + if(var_isneg) {\ + var_long = -var_long;\ + var_isneg = 0;\ + }\ + if((*store)->_name != var_long) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_long;\ + }\ + var_long = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_datum_longlong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '-':\ + /* TODO: we dont verify the '-' is leading... */\ + var_isneg = 1;\ + break;\ + case '0' ... '9':\ + var_longlong *= 10;\ + var_longlong += input - '0';\ + break;\ + default:\ + if(var_isneg) {\ + var_longlong = -var_longlong;\ + var_isneg = 0;\ + }\ + if((*store)->_name != var_longlong) {\ + BITSET((*store)->changed, VMON_ ## _sym);\ + changes++;\ + (*store)->_name = var_longlong;\ + }\ + var_longlong = 0;\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +/* parse but simply skip omitted fields, advance on the delimiter */ +#define vmon_omit_n(_n, _sym, _desc) case VMON_PARSER_STATE_ ## _sym:\ + var_int++;\ + if(var_int >= _n) {\ + var_int = 0;\ + state++;\ + }\ + break; + +#define vmon_omit_literal(_lit, _sym) case VMON_PARSER_STATE_ ## _sym:\ + /* TODO make this actually match the literal, for now we skip the length. */ \ + var_int++;\ + if(var_int >= (sizeof(_lit) - 1)) {\ + var_int = 0;\ + state++;\ + }\ + break; + +#define vmon_omit_run(_char, _sym) case VMON_PARSER_STATE_ ## _sym:\ + if(input != _char) {\ + state++;\ + /* XXX: we fall-through to the next case because this byte belongs to the next state */\ + } else {\ + break;\ + } + + +#define vmon_omit_str(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + if(input == VMON_PARSER_DELIM) {\ + state++;\ + } else {\ + break;\ + } + +#define vmon_omit_str_array(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + if(input == VMON_PARSER_DELIM) {\ + state++;\ + } else {\ + break;\ + } + +#define vmon_omit_char(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + state++;\ + break; + +#define vmon_omit_char_array(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + if(input == VMON_PARSER_DELIM) {\ + state++;\ + } else {\ + break;\ + } + +#define vmon_omit_int(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + case '-':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_omit_uint(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_omit_ulong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_omit_ulonglong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_omit_long(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + case '-':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } + +#define vmon_omit_longlong(_name, _sym, _label, _desc) case VMON_PARSER_STATE_ ## _sym:\ + switch(input) {\ + case '0' ... '9':\ + case '-':\ + break;\ + default:\ + state++;\ + break;\ + }\ + if(state == VMON_PARSER_STATE_ ## _sym) {\ + /* we want to fall-through when the state advances */\ + break;\ + } +#endif + + +/* for convenience, if the omit macros are undefind define them as noops, since that's the most common pattern */ +/* XXX TODO: we may need to add some mechanism for informing the VMON_SUPPRESS_UNDEFS clause in _end.def when these + * have been automatically defined vs. explicitly defined. When automatically defined, we should undefine them regarldess + * of undef suppression. But when they are explicitly defined prior to entering here, we should honor the undef suppression. + * I'm going to leave it as-is for now until it bites me in the ass. + */ +#ifndef vmon_omit_n +# define vmon_omit_n(_n, _sym, _desc) +#endif +#ifndef vmon_omit_literal +# define vmon_omit_literal(_lit, _sym) +#endif +#ifndef vmon_omit_run +# define vmon_omit_run(_char, _sym) +#endif +#ifndef vmon_omit_str +# define vmon_omit_str(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_str_array +# define vmon_omit_str_array(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_char +# define vmon_omit_char(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_char_array +# define vmon_omit_char_array(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_int +# define vmon_omit_int(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_uint +# define vmon_omit_uint(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_ulong +# define vmon_omit_ulong(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_ulonglong +# define vmon_omit_ulonglong(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_long +# define vmon_omit_long(_name, _sym, _label, _desc) +#endif +#ifndef vmon_omit_longlong +# define vmon_omit_longlong(_name, _sym, _label, _desc) +#endif diff --git a/src/libvmon/defs/_end.def b/src/libvmon/defs/_end.def new file mode 100644 index 0000000..9243349 --- /dev/null +++ b/src/libvmon/defs/_end.def @@ -0,0 +1,43 @@ +#ifndef VMON_SUPPRESS_UNDEFS + +/* XXX TODO: we may need to detect and manage the automatic definition of the vmon_omit_* definitions */ + +#undef vmon_datum_str +#undef vmon_datum_str_array +#undef vmon_datum_char +#undef vmon_datum_char_array +#undef vmon_datum_int +#undef vmon_datum_uint +#undef vmon_datum_ulong +#undef vmon_datum_ulonglong +#undef vmon_datum_long +#undef vmon_datum_longlong +#undef vmon_omit_n +#undef vmon_omit_literal +#undef vmon_omit_run +#undef vmon_omit_str +#undef vmon_omit_str_array +#undef vmon_omit_char +#undef vmon_omit_char_array +#undef vmon_omit_int +#undef vmon_omit_uint +#undef vmon_omit_ulong +#undef vmon_omit_ulonglong +#undef vmon_omit_long +#undef vmon_omit_longlong +#undef VMON_DECLARE_MEMBERS +#undef VMON_DECLARE_CHANGEBITS +#undef VMON_ENUM_SYMBOLS +#undef VMON_ASSIGN_NAME_TABLE +#undef VMON_ASSIGN_DESC_TABLE +#undef VMON_ENUM_PARSER_STATES +#undef VMON_PREPARE_PARSER +#undef VMON_IMPLEMENT_PARSER +#undef VMON_PARSER_DELIM +#undef vmon_want + +#else + +#undef VMON_SUPPRESS_UNDEFS + +#endif diff --git a/src/libvmon/defs/proc_files.def b/src/libvmon/defs/proc_files.def new file mode 100644 index 0000000..6e3db98 --- /dev/null +++ b/src/libvmon/defs/proc_files.def @@ -0,0 +1,8 @@ +#include "_begin.def" + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/$pid/fd */ +vmon_datum_int( fdnum, FILES_FDNUM, "FdNum", "File descriptor number (historically 0-255)") +vmon_datum_char_array( object_path, FILES_OBJPATH, "ObjPath", "Object path this descriptor represents a handle for") + +#include "_end.def" diff --git a/src/libvmon/defs/proc_io.def b/src/libvmon/defs/proc_io.def new file mode 100644 index 0000000..0e1776d --- /dev/null +++ b/src/libvmon/defs/proc_io.def @@ -0,0 +1,33 @@ +#include "_begin.def" + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/$pid/io */ +vmon_omit_literal("rchar: ", PROC_IO_RCHAR_LABEL) +vmon_datum_ulonglong( rchars, PROC_IO_RCHAR, "CharsRead", "Characters read (all)") +vmon_omit_literal("\n", PROC_IO_RCHAR_NL) + +vmon_omit_literal("wchar: ", PROC_IO_WCHAR_LABEL) +vmon_datum_ulonglong( wchars, PROC_IO_WCHAR, "CharsWritten", "Characters written (all)") +vmon_omit_literal("\n", PROC_IO_WCHAR_NL) + +vmon_omit_literal("syscr: ", PROC_IO_SYSCR_LABEL) +vmon_datum_ulonglong( syscr, PROC_IO_SYSCR, "SysReads", "Read system calls") +vmon_omit_literal("\n", PROC_IO_SYSCR_NL) + +vmon_omit_literal("syscw: ", PROC_IO_SYSCW_LABEL) +vmon_datum_ulonglong( syscw, PROC_IO_SYSCW, "SysWrites", "Write system calls") +vmon_omit_literal("\n", PROC_IO_SYSCW_NL) + +vmon_omit_literal("read_bytes: ", PROC_IO_READBYTES_LABEL) +vmon_datum_ulonglong( read_bytes, PROC_IO_READBYTES, "BytesReadIO", "Bytes read from storage") +vmon_omit_literal("\n", PROC_IO_READBYTES_NL) + +vmon_omit_literal("write_bytes: ", PROC_IO_WRITEBYTES_LABEL) +vmon_datum_ulonglong( write_bytes, PROC_IO_WRITEBYTES, "BytesWrittenIO", "Bytes written to storage") +vmon_omit_literal("\n", PROC_IO_WRITEBYTES_NL) + +vmon_omit_literal("cancelled_write_bytes: ", PROC_IO_CANCELLED_WRITEBYTES_LABEL) +vmon_datum_ulonglong( cancelled_write_bytes, PROC_IO_CANCELLED_WRITEBYTES, "CancelledWriteBytes", "Bytes written but canceled before reaching storage (truncate)") +vmon_omit_literal("\n", PROC_IO_CANCELLED_WRITEBYTES_NL) + +#include "_end.def" diff --git a/src/libvmon/defs/proc_stat.def b/src/libvmon/defs/proc_stat.def new file mode 100644 index 0000000..db704e9 --- /dev/null +++ b/src/libvmon/defs/proc_stat.def @@ -0,0 +1,105 @@ +#include "_begin.def" + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/$pid/comm */ +vmon_datum_char_array( comm, PROC_STAT_COMM, "Cmd", "/proc/$pid/comm raw contents (with the \n substituted with \0)") + + /* /proc/$pid/cmdline */ +vmon_datum_char_array( cmdline, PROC_STAT_CMDLINE, "Cmdline", "/proc/$pid/cmdline raw contents") +vmon_datum_int( argc, PROC_STAT_ARGC, "Argc", "parsed cmdline count as if executed") +vmon_datum_str_array( argv, PROC_STAT_ARGV, "Argv", "parsed cmdline argv contents as if executed, pointers into cmdline") + + /* /proc/$pid/exe */ +vmon_datum_char_array( exe, PROC_STAT_EXE, "ExePath", "/proc/$pid/exe symlink target") + + /* /proc/$pid/wchan */ +vmon_datum_char_array( wchan, PROC_STAT_WCHAN, "WChan", "/proc/$pid/wchan raw contents (address resolved)") + + /* /proc/$pid/stat */ +vmon_datum_int( pid, PROC_STAT_PID, "PID", "the process id") +vmon_omit_n( (*store)->comm.len + 3, PROC_STAT_COMM_, "the filename of the executable, in parentheses, skipped") +vmon_datum_char( state, PROC_STAT_STATE, "State", "process state, one of \"RSDZTW\"") +vmon_omit_run( ' ', PROC_STAT_PPID_SP) +vmon_datum_longlong( ppid, PROC_STAT_PPID, "PPId", "parent pid") +vmon_omit_run( ' ', PROC_STAT_PGID_SP) +vmon_datum_longlong( pgrp, PROC_STAT_PGID, "PGId", "parent process group") +vmon_omit_run( ' ', PROC_STAT_SID_SP) +vmon_datum_longlong( sid, PROC_STAT_SID, "SessionId", "session id") +vmon_omit_run( ' ', PROC_STAT_TTY_NR_SP) +vmon_datum_longlong( tty_nr, PROC_STAT_TTY_NR, "Tty", "controlling terminal of the process") +vmon_omit_run( ' ', PROC_STAT_TPGID_SP) +vmon_datum_longlong( tpgid, PROC_STAT_TPGID, "CtrlPGid", "id of the foreground process group of the controlling terminal of the process") +vmon_omit_run( ' ', PROC_STAT_FLAGS_SP) +vmon_datum_ulonglong( flags, PROC_STAT_FLAGS, "Flags", "the kernel flags of the process (see PF_* in the non-uapi <linux/sched.h>)") +vmon_omit_run( ' ', PROC_STAT_MINFLT_SP) +vmon_datum_ulonglong( minflt, PROC_STAT_MINFLT, "MnrFlts", "the number of minor faults (no hitting disk)") +vmon_omit_run( ' ', PROC_STAT_CMINFLT_SP) +vmon_datum_ulonglong( cminflt, PROC_STAT_CMINFLT, "ChldMnrFlts", "number of minor faults waited-for children have made") +vmon_omit_run( ' ', PROC_STAT_MAJFLT_SP) +vmon_datum_ulonglong( majflt, PROC_STAT_MAJFLT, "MjrFlts", "the number of major faults (hit disk)") +vmon_omit_run( ' ', PROC_STAT_CMAJFLT_SP) +vmon_datum_ulonglong( cmajflt, PROC_STAT_CMAJFLT, "ChldMjrFlts", "the number of major faults waited-for children have made") +vmon_omit_run( ' ', PROC_STAT_UTIME_SP) +vmon_datum_ulonglong( utime, PROC_STAT_UTIME, "UsrCPU", "amount of time this process has spent in user mode (ticks)") +vmon_omit_run( ' ', PROC_STAT_STIME_SP) +vmon_datum_ulonglong( stime, PROC_STAT_STIME, "SysCPU", "amount of time this process has spent in kernel mode (ticks)") +vmon_omit_run( ' ', PROC_STAT_CUTIME_SP) +vmon_datum_longlong( cutime, PROC_STAT_CUTIME, "ChldUsrCPU", "amount of time the waited-for children have spent in user mode (ticks)") +vmon_omit_run( ' ', PROC_STAT_CSTIME_SP) +vmon_datum_longlong( cstime, PROC_STAT_CSTIME, "ChldSysCPU", "amount of time the waited-for children have spent in kernel mode (ticks)") +vmon_omit_run( ' ', PROC_STAT_PRIORITY_SP) +vmon_datum_longlong( priority, PROC_STAT_PRIORITY, "Priority", "priority of the process") +vmon_omit_run( ' ', PROC_STAT_NICE_SP) +vmon_datum_longlong( nice, PROC_STAT_NICE, "Nice", "nice value") +vmon_omit_run( ' ', PROC_STAT_NUM_THREADS_SP) +vmon_datum_longlong( num_threads, PROC_STAT_NUM_THREADS, "NumThreads", "number of threads") +vmon_omit_run( ' ', PROC_STAT_ALARM_SP) +vmon_omit_ulonglong( itrealvalue, PROC_STAT_ALARM, "NextAlarm", "the time in jiffies before the next SIGALRM is sent (not maintained)") +vmon_omit_run( ' ', PROC_STAT_START_SP) +vmon_datum_ulonglong( start, PROC_STAT_START, "StartTime", "start time relative to system boot in jiffies") +vmon_omit_run( ' ', PROC_STAT_VSIZE_SP) +vmon_datum_ulonglong( vsize, PROC_STAT_VSIZE, "VirtSize", "virtual memory size (bytes)") +vmon_omit_run( ' ', PROC_STAT_RSS_SP) +vmon_datum_ulonglong( rss, PROC_STAT_RSS, "ResSize", "resident set size (bytes)") +vmon_omit_run( ' ', PROC_STAT_RSSLIM_SP) +vmon_datum_ulonglong( rsslim, PROC_STAT_RSSLIM, "ResSizeLimit", "resident set size ulimit") +vmon_omit_run( ' ', PROC_STAT_STARTCODE_SP) +vmon_omit_ulonglong( startcode, PROC_STAT_STARTCODE, "CodeStart", "address above which program text can run") +vmon_omit_run( ' ', PROC_STAT_ENDCODE_SP) +vmon_omit_ulonglong( endcode, PROC_STAT_ENDCODE, "CodeEnd", "address below which program text can run") +vmon_omit_run( ' ', PROC_STAT_STARTSTACK_SP) +vmon_omit_ulonglong( startstack, PROC_STAT_STARTSTACK, "StackStart", "address of the stack start") +vmon_omit_run( ' ', PROC_STAT_ESP_SP) +vmon_omit_ulonglong( kstkesp, PROC_STAT_ESP, "StackPtr", "current stack pointer") +vmon_omit_run( ' ', PROC_STAT_EIP_SP) +vmon_omit_ulonglong( kstkeip, PROC_STAT_EIP, "InstructnPtr", "current instruction pointer") +vmon_omit_run( ' ', PROC_STAT_SIGNAL_SP) +vmon_omit_ulonglong( signal, PROC_STAT_SIGNAL, "SigsPending", "bitmap of pending signals") +vmon_omit_run( ' ', PROC_STAT_SIGBLOCKED_SP) +vmon_omit_ulonglong( blocked, PROC_STAT_SIGBLOCKED, "SigsBlocked", "bitmap of blocked signals") +vmon_omit_run( ' ', PROC_STAT_SIGIGNORED_SP) +vmon_omit_ulonglong( ignored, PROC_STAT_SIGIGNORED, "SigsIgnored", "bitmap of ignored signals") +vmon_omit_run( ' ', PROC_STAT_SIGCAUGHT_SP) +vmon_omit_ulonglong( caught, PROC_STAT_SIGCAUGHT, "SigsCaught", "bitmap of caughtsignals") +vmon_omit_run( ' ', PROC_STAT_WCHAN_ADDR_SP) +vmon_datum_ulonglong( wchan_addr, PROC_STAT_WCHAN_ADDR, "WchanAddr", "address of the process' wchan") +vmon_omit_run( ' ', PROC_STAT_SWAPPED_SP) +vmon_omit_ulonglong( nswap, PROC_STAT_SWAPPED, "NumSwapped", "number of pages swapped (not maintained)") +vmon_omit_run( ' ', PROC_STAT_CSWAPPED_SP) +vmon_omit_ulonglong( cnswap, PROC_STAT_CSWAPPED, "ChldNumSwpd", "number of cumulative pages swapped for children (not maintained)") +vmon_omit_run( ' ', PROC_STAT_EXITSIGNAL_SP) +vmon_omit_longlong( exit_signal, PROC_STAT_EXITSIGNAL, "ExitSignal", "signal to be sent to parent when we die") +vmon_omit_run( ' ', PROC_STAT_PROCESSOR_SP) +vmon_datum_longlong( processor, PROC_STAT_PROCESSOR, "LastCPU", "CPU number last executed on") +vmon_omit_run( ' ', PROC_STAT_RT_PRIORITY_SP) +vmon_omit_ulonglong( rt_priority, PROC_STAT_RT_PRIORITY, "RTPriority", "realtime priority of the process") +vmon_omit_run( ' ', PROC_STAT_POLICY_SP) +vmon_omit_ulonglong( policy, PROC_STAT_POLICY, "SchedPolicy", "scheduling policy of the process") +vmon_omit_run( ' ', PROC_STAT_DELAY_BLKIO_SP) +vmon_datum_ulonglong( delay_blkio, PROC_STAT_DELAY_BLKIO, "BlkIODelays", "aggregated block IO delays, in ticks") +vmon_omit_run( ' ', PROC_STAT_GUEST_TIME_SP) +vmon_datum_ulonglong( guest_time, PROC_STAT_GUEST_TIME, "GuestTime", "time spent running a virtual cpu for a guest OS") +vmon_omit_run( ' ', PROC_STAT_CGUEST_TIME_SP) +vmon_datum_longlong( cguest_time, PROC_STAT_CGUEST_TIME, "ChldGuestTim", "time spent running a virtual cpu for a guest OS in (waited for?) children") + +#include "_end.def" diff --git a/src/libvmon/defs/proc_vm.def b/src/libvmon/defs/proc_vm.def new file mode 100644 index 0000000..9028272 --- /dev/null +++ b/src/libvmon/defs/proc_vm.def @@ -0,0 +1,19 @@ +#include "_begin.def" + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/$pid/statm */ +vmon_datum_ulonglong( size_pages, PROC_VM_SIZE_PAGES, "Size", "Size in pages") +vmon_omit_run( ' ', PROC_VM_RESIDENT_PAGES_SP) +vmon_datum_ulonglong( resident_pages, PROC_VM_RESIDENT_PAGES, "Resident", "Resident set size in pages") +vmon_omit_run( ' ', PROC_VM_SHARED_PAGES_SP) +vmon_datum_ulonglong( shared_pages, PROC_VM_SHARED_PAGES, "Shared", "Shared size in pages") +vmon_omit_run( ' ', PROC_VM_TEXT_PAGES_SP) +vmon_datum_ulonglong( text_pages, PROC_VM_TEXT_PAGES, "Text", "Text segment size in pages") +vmon_omit_run( ' ', PROC_VM_LIB_PAGES_SP) +vmon_omit_ulonglong( lib_pages, PROC_VM_LIB_PAGES, "Library", "Library segment size (skipped, unused in 2.6)") +vmon_omit_run( ' ', PROC_VM_DATA_PAGES_SP) +vmon_datum_ulonglong( data_pages, PROC_VM_DATA_PAGES, "Data", "Data segment size in pages") +vmon_omit_run( ' ', PROC_VM_DIRTY_PAGES_SP) +vmon_omit_ulonglong( dirty_pages, PROC_VM_DIRTY_PAGES, "Dirty", "Dirtied (skipped, unused in 2.6)") + +#include "_end.def" diff --git a/src/libvmon/defs/proc_wants.def b/src/libvmon/defs/proc_wants.def new file mode 100644 index 0000000..7f02602 --- /dev/null +++ b/src/libvmon/defs/proc_wants.def @@ -0,0 +1,14 @@ +#include "_begin.def" + +/* the available per-process wants, the order here matters, put wants which affect the sampling heirarchy first */ +/* otherwise they will change the heirarchy after samples have been collected, leaving newly introduced nodes with uninitialized sample stores after return from vmon_sample() */ + +/* sym, name, internal fulfilllment function */ +vmon_want(PROC_FOLLOW_CHILDREN, proc_follow_children, proc_follow_children) +vmon_want(PROC_FOLLOW_THREADS, proc_follow_threads, proc_follow_threads) +vmon_want(PROC_FILES, proc_files, proc_sample_files) +vmon_want(PROC_STAT, proc_stat, proc_sample_stat) +vmon_want(PROC_VM, proc_vm, proc_sample_vm) +vmon_want(PROC_IO, proc_io, proc_sample_io) + +#include "_end.def" diff --git a/src/libvmon/defs/sys_stat.def b/src/libvmon/defs/sys_stat.def new file mode 100644 index 0000000..ef8b9a7 --- /dev/null +++ b/src/libvmon/defs/sys_stat.def @@ -0,0 +1,114 @@ +#include "_begin.def" + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/stat */ + +/* a cpu row, this is shown once for the total prefixed with "cpu ", then again for every cpu prefixed with "cpuN ", newlines terminate rows */ +vmon_omit_n( 5, SYS_STAT_CPU_PREFIX, "cpu line \"cpu \" prefix") +vmon_datum_ulonglong( user, SYS_STAT_CPU_USER, "UserTime", "Time spent in user mode (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_NICE_SP) +vmon_datum_ulonglong( nice, SYS_STAT_CPU_NICE, "NiceTime", "Time spent in user mode with low priority (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_SYS_SP) +vmon_datum_ulonglong( system, SYS_STAT_CPU_SYS, "SysTime", "Time spent in system mode (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_IDLE_SP) +vmon_datum_ulonglong( idle, SYS_STAT_CPU_IDLE, "IdleTime", "Time spent in the idle task (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_IOWAIT_SP) +vmon_datum_ulonglong( iowait, SYS_STAT_CPU_IOWAIT, "IOWaitTime", "Time spent runnable but waiting for IO (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_IRQ_SP) +vmon_datum_ulonglong( irq, SYS_STAT_CPU_IRQ, "IRQTime", "Time spent in IRQ context (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_SIRQ_SP) +vmon_datum_ulonglong( softirq, SYS_STAT_CPU_SIRQ, "SoftIRQTime", "Time spent in the softirq context (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_STEAL_SP) +vmon_datum_ulonglong( steal, SYS_STAT_CPU_STEAL, "StealTime", "Time spent in a virtualized environment (ticks)") +vmon_omit_run( ' ', SYS_STAT_CPU_GUEST_SP) +vmon_datum_ulonglong( guest, SYS_STAT_CPU_GUEST, "GuestTime", "Time spent in a virtual cpu (ticks)") +vmon_omit_literal( "\n", SYS_STAT_CPU_NL) + + + + +#if 0 +/* here we want to embed a list of a cpus, the cpu entries need to be a composite type which needs */ + +/* TODO: the rest of /proc/stat, need to develop the macro language further to cleanly support the variable structures like N cpu rows etc... */ +vmon_heredef_list_begin( cpus, SYS_STAT_CPUS, "CPUs", "CPU time accounts for every cpu in the system") +/* we probably should somehow express which field is to be used as an index for addressing the array elements (and growing as needed) */ +vmon_omit_n( 5, SYS_STAT_PERCPU_PREFIX, "cpu line \"cpu \" prefix") +vmon_datum_ulonglong( user, SYS_STAT_PERCPU_USER, "UserTime", "Time spent in user mode (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_NICE_SP) +vmon_datum_ulonglong( nice, SYS_STAT_PERCPU_NICE, "NiceTime", "Time spent in user mode with low priority (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_SYS_SP) +vmon_datum_ulonglong( system, SYS_STAT_PERCPU_SYS, "SysTime", "Time spent in system mode (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_IDLE_SP) +vmon_datum_ulonglong( idle, SYS_STAT_PERCPU_IDLE, "IdleTime", "Time spent in the idle task (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_IOWAIT_SP) +vmon_datum_ulonglong( iowait, SYS_STAT_PERCPU_IOWAIT, "IOWaitTime", "Time spent runnable but waiting for IO (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_IRQ_SP) +vmon_datum_ulonglong( irq, SYS_STAT_PERCPU_IRQ, "IRQTime", "Time spent in IRQ context (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_SIRQ_SP) +vmon_datum_ulonglong( softirq, SYS_STAT_PERCPU_SIRQ, "SoftIRQTime", "Time spent in the softirq context (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_STEAL_SP) +vmon_datum_ulonglong( steal, SYS_STAT_PERCPU_STEAL, "StealTime", "Time spent in a virtualized environment (ticks)") +vmon_omit_run( ' ', SYS_STAT_PERCPU_GUEST_SP) +vmon_datum_ulonglong( guest, SYS_STAT_PERCPU_GUEST, "GuestTime", "Time spent in a virtual cpu (ticks)") +vmon_omit_literal( "\n", SYS_STAT_PERCPU_NL) +vmon_heredef_list_end( cpus, SYS_STAT_CPUS) + +/* we make the interrupts array dynamic, which is kind of annoying, since in older/simple XT-PIC systems it could be simply an array of 16 elements, + and the calling code could have made assumptions about the layout. Taking this approach to accomodate modern systems also forces calling code to + be more indirect about accessing the members of this array, less assumptions can be made, such is life. I considered using a simple static array with + named directly-accessible members in the CONFIG_GENERIC_HARDIRQS case, but that would encourage creating programs dependent on that case which would + then not work unmodified on the newer (and more common, now) complicated irq routing case. :( + */ +vmon_omit_literal("intr", SYS_STAT_IRQS_PREFIX) +vmon_heredef_array_begin( irqs, SYS_STAT_IRQS, "IRQs", "Counters for all interrupts in the system") +vmon_omit_literal(" ", SYS_STAT_IRQS_SP) +vmon_datum_ulonglong( count, SYS_STAT_PERIRQ_COUNT) +vmon_heredef_array_end( irqs, SYS_STAT_IRQS) +vmon_omit_literal("\n", SYS_STAT_IRQS_NL) + +vmon_omit_literal("ctxt ", SYS_STAT_CTXT_SWITCHES_PREFIX) +vmon_datum_ulonglong( ctxt, SYS_STAT_CTXT_SWITCHES, "CXs", "Count of context switches since boot") +vmon_omit_literal("\n", SYS_STAT_CTXT_SWITCHES_NL) + +vmon_omit_literal("btime ", SYS_STAT_BOOTTIME_PREFIX) +vmon_datum_ulong( boot_time, SYS_STAT_BOOTTIME, "BootTime", "Number of seconds since epoch the system booted at") +vmon_omit_literal("\n", SYS_STAT_BOOTTIME_NL) + +vmon_omit_literal("processes ", SYS_STAT_FORKS_PREFIX) +vmon_datum_ulong( forks, SYS_STAT_FORKS, "Forks", "Number of forks since the system booted") +vmon_omit_literal("\n", SYS_STAT_FORKS_NL) + +vmon_omit_literal("procs_running ", SYS_STAT_NRUNNABLE_PREFIX) +vmon_datum_ulong( n_runnable, SYS_STAT_NRUNNABLE, "NumRunnable", "Number of processes currently runnable (may exceed number of cpus)") +vmon_omit_literal("\n", SYS_STAT_NRUNNABLE_NL) + +vmon_omit_literal("procs_blocked ", SYS_STAT_NBLOCKED_PREFIX) +vmon_datum_ulong( n_blocked, SYS_STAT_NBLOCKED, "NumBlocked", "Number of processes currently blocked") +vmon_omit_literal("\n", SYS_STAT_NBLOCKED_NL) + +vmon_omit_literal("softirq ", SYS_STAT_SIRQS_PREFIX) +vmon_datum_ulonglong( sirq_hi, SYS_STAT_SIRQ_HI, "HiSIRQ", "Number of high priority soft interrupts (HI_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_TIMER_SP) +vmon_datum_ulonglong( sirq_timer, SYS_STAT_SIRQ_TIMER, "TimerSIRQ", "Number of timer software interrupts (TIMER_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_NET_TX_SP) +vmon_datum_ulonglong( sirq_net_tx, SYS_STAT_SIRQ_NET_TX, "NetTxSIRQ", "Number of network transmit software interrupts (NET_TX_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_NET_RX_SP) +vmon_datum_ulonglong( sirq_net_rx, SYS_STAT_SIRQ_NET_RX, "NetRxSIRQ", "Number of network receive software interrupts (NET_RX_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_BLOCK_SP) +vmon_datum_ulonglong( sirq_block, SYS_STAT_SIRQ_BLOCK, "BlockSIRQ", "Number of block software interrupts (BLOCK_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_IOPOLL_SP) +vmon_datum_ulonglong( sirq_iopoll, SYS_STAT_SIRQ_IOPOLL, "IOPollSIRQ", "Number of block IO poll software interrupts (BLOCK_IOPOLL_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_TASKLET_SP) +vmon_datum_ulonglong( sirq_tasklet, SYS_STAT_SIRQ_TASKLET, "TaskletSIRQ", "Number of tasklet software interrupts (TASKLET SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_HRTIMER_SP) +vmon_datum_ulonglong( sirq_hrtimer, SYS_STAT_SIRQ_HRTIMER, "HRTimerSIRQ", "Number of hrtimer software interrupts (HRTIMER_SOFTIRQ)") +vmon_omit_literal(" ", SYS_STAT_SIRQ_RCU_SP) +vmon_datum_ulonglong( sirq_rcu, SYS_STAT_SIRQ_RCU, "RCUSIRQ", "Number of RCU software interrupts (RCU_SOFTIRQ)") +vmon_omit_literal("\n", SYS_STAT_SIRQS_NL) + + +#endif + + +#include "_end.def" diff --git a/src/libvmon/defs/sys_vm.def b/src/libvmon/defs/sys_vm.def new file mode 100644 index 0000000..33b4d3f --- /dev/null +++ b/src/libvmon/defs/sys_vm.def @@ -0,0 +1,169 @@ +#include "_begin.def" + + + /* member name, symbolic constant, human label, human description (think UI/help) */ + /* /proc/meminfo */ +vmon_omit_literal("MemTotal:", SYS_VM_TOTAL_KB_LABEL) +vmon_omit_run(' ', SYS_VM_TOTAL_KB_WHITESPACE) +vmon_datum_ulong( total_kb, SYS_VM_TOTAL_KB, "Total", "Total memory in system") +vmon_omit_literal(" kB\n", SYS_VM_TOTAL_KB_UNIT_NL) +vmon_omit_literal("MemFree:", SYS_VM_FREE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_FREE_KB_WHITESPACE) +vmon_datum_ulong( free_kb, SYS_VM_FREE_KB, "Free", "Free memory in system") +vmon_omit_literal(" kB\n", SYS_VM_FREE_KB_UNIT_NL) +vmon_omit_literal("Buffers:", SYS_VM_BUFFERS_KB_LABEL) +vmon_omit_run(' ', SYS_VM_BUFFERS_KB_WHITESPACE) +vmon_datum_ulong( buffers_kb, SYS_VM_BUFFERS_KB, "Buffers", "Memory allocated to buffers") +vmon_omit_literal(" kB\n", SYS_VM_BUFFERS_KB_UNIT_NL) +vmon_omit_literal("Cached:", SYS_VM_CACHED_KB_LABEL) +vmon_omit_run(' ', SYS_VM_CACHED_KB_WHITESPACE) +vmon_datum_ulong( cached_kb, SYS_VM_CACHED_KB, "Cached", "Memory allocated to caches") +vmon_omit_literal(" kB\n", SYS_VM_CACHED_KB_UNIT_NL) +vmon_omit_literal("SwapCached:", SYS_VM_SWAPCACHED_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SWAPCACHED_KB_WHITESPACE) +vmon_datum_ulong( swapcached_kb, SYS_VM_SWAPCACHED_KB, "SwapCached", "Memory allocated to swap caches") +vmon_omit_literal(" kB\n", SYS_VM_SWAPCACHED_KB_UNIT_NL) +vmon_omit_literal("Active:", SYS_VM_ACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_ACTIVE_KB_WHITESPACE) +vmon_datum_ulong( active_kb, SYS_VM_ACTIVE_KB, "Active", "Active pages") +vmon_omit_literal(" kB\n", SYS_VM_ACTIVE_KB_UNIT_NL) +vmon_omit_literal("Inactive:", SYS_VM_INACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_INACTIVE_KB_WHITESPACE) +vmon_datum_ulong( inactive_kb, SYS_VM_INACTIVE_KB, "Inactive", "Inactive pages") +vmon_omit_literal(" kB\n", SYS_VM_INACTIVE_KB_UNIT_NL) +vmon_omit_literal("Active(anon):", SYS_VM_ANON_ACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_ANON_ACTIVE_KB_WHITESPACE) +vmon_datum_ulong( anon_active_kb, SYS_VM_ANON_ACTIVE_KB, "AnonActive", "Active anonymous pages") +vmon_omit_literal(" kB\n", SYS_VM_ANON_ACTIVE_KB_UNIT_NL) +vmon_omit_literal("Inactive(anon):", SYS_VM_ANON_INACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_ANON_INACTIVE_KB_WHITESPACE) +vmon_datum_ulong( anon_inactive_kb, SYS_VM_ANON_INACTIVE_KB, "AnonInactive", "Inactive anonymous pages") +vmon_omit_literal(" kB\n", SYS_VM_ANON_INACTIVE_KB_UNIT_NL) +vmon_omit_literal("Active(file):", SYS_VM_FILE_ACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_FILE_ACTIVE_KB_WHITESPACE) +vmon_datum_ulong( file_active_kb, SYS_VM_FILE_ACTIVE_KB, "FileActive", "Active file pages") +vmon_omit_literal(" kB\n", SYS_VM_FILE_ACTIVE_KB_UNIT_NL) +vmon_omit_literal("Inactive(file):", SYS_VM_FILE_INACTIVE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_FILE_INACTIVE_KB_WHITESPACE) +vmon_datum_ulong( file_inactive_kb, SYS_VM_FILE_INACTIVE_KB, "FileInactive", "Inactive file pages") +vmon_omit_literal(" kB\n", SYS_VM_FILE_INACTIVE_KB_UNIT_NL) +vmon_omit_literal("Unevictable:", SYS_VM_UNEVICTABLE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_UNEVICTABLE_KB_WHITESPACE) +vmon_datum_ulong( unevictable_kb, SYS_VM_UNEVICTABLE_KB, "Unevictable", "Unevictable pages") +vmon_omit_literal(" kB\n", SYS_VM_UNEVICTABLE_KB_UNIT_NL) +vmon_omit_literal("Mlocked:", SYS_VM_MLOCKED_KB_LABEL) +vmon_omit_run(' ', SYS_VM_MLOCKED_KB_WHITESPACE) +vmon_datum_ulong( mlocked_kb, SYS_VM_MLOCKED_KB, "Mlocked", "Locked pages") +vmon_omit_literal(" kB\n", SYS_VM_MLOCKED_KB_UNIT_NL) +vmon_omit_literal("SwapTotal:", SYS_VM_SWAP_TOTAL_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SWAP_TOTAL_KB_WHITESPACE) +vmon_datum_ulong( swap_total_kb, SYS_VM_SWAP_TOTAL_KB, "SwapTotal", "Total swap") +vmon_omit_literal(" kB\n", SYS_VM_SWAP_TOTAL_KB_UNIT_NL) +vmon_omit_literal("SwapFree:", SYS_VM_SWAP_FREE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SWAP_FREE_KB_WHITESPACE) +vmon_datum_ulong( swap_free_kb, SYS_VM_SWAP_FREE_KB, "SwapFree", "Free swap") +vmon_omit_literal(" kB\n", SYS_VM_SWAP_FREE_KB_UNIT_NL) +vmon_omit_literal("Dirty:", SYS_VM_DIRTY_KB_LABEL) +vmon_omit_run(' ', SYS_VM_DIRTY_KB_WHITESPACE) +vmon_datum_ulong( dirty_kb, SYS_VM_DIRTY_KB, "Dirty", "Dirty pages") +vmon_omit_literal(" kB\n", SYS_VM_DIRTY_KB_UNIT_NL) +vmon_omit_literal("Writeback:", SYS_VM_WRITEBACK_KB_LABEL) +vmon_omit_run(' ', SYS_VM_WRITEBACK_KB_WHITESPACE) +vmon_datum_ulong( writeback_kb, SYS_VM_WRITEBACK_KB, "Writeback", "Dirtied pages in the process of being written back") +vmon_omit_literal(" kB\n", SYS_VM_WRITEBACK_KB_UNIT_NL) +vmon_omit_literal("AnonPages:", SYS_VM_ANONPAGES_KB_LABEL) +vmon_omit_run(' ', SYS_VM_ANONPAGES_KB_WHITESPACE) +vmon_datum_ulong( anonpages_kb, SYS_VM_ANONPAGES_KB, "AnonPages", "Anonymous pages") +vmon_omit_literal(" kB\n", SYS_VM_ANONPAGES_KB_UNIT_NL) +vmon_omit_literal("Mapped:", SYS_VM_MAPPED_KB_LABEL) +vmon_omit_run(' ', SYS_VM_MAPPED_KB_WHITESPACE) +vmon_datum_ulong( mapped_kb, SYS_VM_MAPPED_KB, "Mapped", "Mapped pages") +vmon_omit_literal(" kB\n", SYS_VM_MAPPED_KB_UNIT_NL) +vmon_omit_literal("Shmem:", SYS_VM_SHMEM_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SHMEM_KB_WHITESPACE) +vmon_datum_ulong( shmem_kb, SYS_VM_SHMEM_KB, "Shmem", "SysV IPC shmem") +vmon_omit_literal(" kB\n", SYS_VM_SHMEM_KB_UNIT_NL) +vmon_omit_literal("Slab:", SYS_VM_SLAB_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SLAB_KB_WHITESPACE) +vmon_datum_ulong( slab_kb, SYS_VM_SLAB_KB, "Slab", "Slab memory") +vmon_omit_literal(" kB\n", SYS_VM_SLAB_KB_UNIT_NL) +vmon_omit_literal("SReclaimable:", SYS_VM_SRECLAIMABLE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SRECLAIMABLE_KB_WHITESPACE) +vmon_datum_ulong( sreclaimable_kb, SYS_VM_SRECLAIMABLE_KB, "SReclaimable", "Slab (reclaimable) memory") +vmon_omit_literal(" kB\n", SYS_VM_SRECLAIMABLE_KB_UNIT_NL) +vmon_omit_literal("SUnreclaim:", SYS_VM_SUNRECLAIMABLE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_SUNRECLAIMABLE_KB_WHITESPACE) +vmon_datum_ulong( sunreclaimable_kb, SYS_VM_SUNRECLAIMABLE_KB, "SUnreclaim", "Slab (unreclaimable) memory") +vmon_omit_literal(" kB\n", SYS_VM_SUNRECLAIMABLE_KB_UNIT_NL) +vmon_omit_literal("KernelStack:", SYS_VM_KERNELSTACK_KB_LABEL) +vmon_omit_run(' ', SYS_VM_KERNELSTACK_KB_WHITESPACE) +vmon_datum_ulong( kernelstack_kb, SYS_VM_KERNELSTACK_KB, "KernelStack", "Kernel stack") +vmon_omit_literal(" kB\n", SYS_VM_KERNELSTACK_KB_UNIT_NL) +vmon_omit_literal("PageTables:", SYS_VM_PAGETABLES_KB_LABEL) +vmon_omit_run(' ', SYS_VM_PAGETABLES_KB_WHITESPACE) +vmon_datum_ulong( pagetables_kb, SYS_VM_PAGETABLES_KB, "PageTables", "Page tables") +vmon_omit_literal(" kB\n", SYS_VM_PAGETABLES_KB_UNIT_NL) +vmon_omit_literal("NFS_Unstable:", SYS_VM_NFS_UNSTABLE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_NFS_UNSTABLE_KB_WHITESPACE) +vmon_datum_ulong( nfs_unstable_kb, SYS_VM_NFS_UNSTABLE_KB, "NFS_Unstable", "NFS unstable") +vmon_omit_literal(" kB\n", SYS_VM_NFS_UNSTABLE_KB_UNIT_NL) +vmon_omit_literal("Bounce:", SYS_VM_BOUNCE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_BOUNCE_KB_WHITESPACE) +vmon_datum_ulong( bounce_kb, SYS_VM_BOUNCE_KB, "Bounce", "Bounce") +vmon_omit_literal(" kB\n", SYS_VM_BOUNCE_KB_UNIT_NL) +vmon_omit_literal("WritebackTmp:", SYS_VM_WRITEBACKTMP_KB_LABEL) +vmon_omit_run(' ', SYS_VM_WRITEBACKTMP_KB_WHITESPACE) +vmon_datum_ulong( writebacktmp_kb, SYS_VM_WRITEBACKTMP_KB, "WritebackTmp", "Writeback temp") +vmon_omit_literal(" kB\n", SYS_VM_WRITEBACKTMP_KB_UNIT_NL) +vmon_omit_literal("CommitLimit:", SYS_VM_COMMITLIMIT_KB_LABEL) +vmon_omit_run(' ', SYS_VM_COMMITLIMIT_KB_WHITESPACE) +vmon_datum_ulong( commitlimit_kb, SYS_VM_COMMITLIMIT_KB, "CommitLimit", "Commit limit") +vmon_omit_literal(" kB\n", SYS_VM_COMMITLIMIT_KB_UNIT_NL) +vmon_omit_literal("Committed_AS:", SYS_VM_COMMITTED_AS_KB_LABEL) +vmon_omit_run(' ', SYS_VM_COMMITTED_AS_KB_WHITESPACE) +vmon_datum_ulong( commited_as_kb, SYS_VM_COMMITTED_AS_KB, "Commited_AS", "Commited address space? TODO ") +vmon_omit_literal(" kB\n", SYS_VM_COMMITTED_AS_KB_UNIT_NL) +vmon_omit_literal("VmallocTotal:", SYS_VM_VMALLOC_TOTAL_KB_LABEL) +vmon_omit_run(' ', SYS_VM_VMALLOC_KB_WHITESPACE) +vmon_datum_ulong( vmalloctotal_kb, SYS_VM_VMALLOC_TOTAL_KB, "VmallocTotal", "Vmalloc total") +vmon_omit_literal(" kB\n", SYS_VM_VMALLOC_TOTAL_KB_UNIT_NL) +vmon_omit_literal("VmallocUsed:", SYS_VM_VMALLOC_USED_KB_LABEL) +vmon_omit_run(' ', SYS_VM_VMALLOC_USED_KB_WHITESPACE) +vmon_datum_ulong( vmallocused_kb, SYS_VM_VMALLOC_USED_KB, "VmallocUsed", "Vmalloc used") +vmon_omit_literal(" kB\n", SYS_VM_VMALLOC_USED_KB_UNIT_NL) +vmon_omit_literal("VmallocChunk:", SYS_VM_VMALLOC_CHUNK_KB_LABEL) +vmon_omit_run(' ', SYS_VM_VMALLOC_CHUNK_KB_WHITESPACE) +vmon_datum_ulong( vmallocchunk_kb, SYS_VM_VMALLOC_CHUNK_KB, "VmallocChunk", "Vmalloc chunk") +vmon_omit_literal(" kB\n", SYS_VM_VMALLOC_CHUNK_KB_UNIT_NL) +vmon_omit_literal("HugePages_Total:", SYS_VM_HUGEPAGES_TOTAL_LABEL) +vmon_omit_run(' ', SYS_VM_HUGEPAGES_TOTAL_WHITESPACE) +vmon_datum_ulong( hugepages_total, SYS_VM_HUGEPAGES_TOTAL, "HugePages_Total", "HugePages total") +vmon_omit_literal("\n", SYS_VM_HUGEPAGES_TOTAL_NL) +vmon_omit_literal("HugePages_Free:", SYS_VM_HUGEPAGES_FREE_LABEL) +vmon_omit_run(' ', SYS_VM_HUGEPAGES_FREE_WHITESPACE) +vmon_datum_ulong( hugepages_free, SYS_VM_HUGEPAGES_FREE, "HugePages_Free", "HugePages free") +vmon_omit_literal("\n", SYS_VM_HUGEPAGES_FREE_NL) +vmon_omit_literal("HugePages_Rsvd:", SYS_VM_HUGEPAGES_RESERVED_LABEL) +vmon_omit_run(' ', SYS_VM_HUGEPAGES_RESERVED_WHITESPACE) +vmon_datum_ulong( hugepages_reserved, SYS_VM_HUGEPAGES_RESERVED, "HugePages_Rsvd", "HugePages reserved") +vmon_omit_literal("\n", SYS_VM_HUGEPAGES_RESERVED_UNIT_NL) +vmon_omit_literal("HugePages_Surp:", SYS_VM_HUGEPAGES_SURPLUS_LABEL) +vmon_omit_run(' ', SYS_VM_HUGEPAGES_SURPLUS_WHITESPACE) +vmon_datum_ulong( hugepages_surplus, SYS_VM_HUGEPAGES_SURPLUS, "HugePages_Surp", "HugePages surplus") +vmon_omit_literal("\n", SYS_VM_HUGEPAGES_SURPLUS_NL) +vmon_omit_literal("Hugepagesize:", SYS_VM_HUGEPAGE_SIZE_KB_LABEL) +vmon_omit_run(' ', SYS_VM_HUGEPAGE_SIZE_KB_WHITESPACE) +vmon_datum_ulong( hugepage_size_kb, SYS_VM_HUGEPAGE_SIZE_KB, "HugePage_Size", "HugePage page size") +vmon_omit_literal(" kB\n", SYS_VM_HUGEPAGE_SIZE_KB_UNIT_NL) +vmon_omit_literal("DirectMap4k:", SYS_VM_DIRECTMAP_4K_KB_LABEL) +vmon_omit_run(' ', SYS_VM_DIRECTMAP_4K_KB_WHITESPACE) +vmon_datum_ulong( directmap4k_kb, SYS_VM_DIRECTMAP_4K_KB, "DirectMap4k", "DirectMap 4K") +vmon_omit_literal(" kB\n", SYS_VM_DIRECTMAP_4K_KB_UNIT_NL) +vmon_omit_literal("DirectMap4M:", SYS_VM_DIRECTMAP_4M_KB_LABEL) +vmon_omit_run(' ', SYS_VM_DIRECTMAP_4M_KB_WHITESPACE) +vmon_datum_ulong( directmap2m_kb, SYS_VM_DIRECTMAP_4M_KB, "DirectMap4M", "DirectMap 4M") +vmon_omit_literal(" kB\n", SYS_VM_DIRECTMAP_4M_KB_UNIT_NL) + +/* TODO: /proc/vmstat */ + +#include "_end.def" diff --git a/src/libvmon/defs/sys_wants.def b/src/libvmon/defs/sys_wants.def new file mode 100644 index 0000000..750d7bb --- /dev/null +++ b/src/libvmon/defs/sys_wants.def @@ -0,0 +1,7 @@ +#include "_begin.def" + +/* the available sys-wide wants */ +vmon_want(SYS_STAT, sys_stat, sys_sample_stat) +vmon_want(SYS_VM, sys_vm, sys_sample_vm) + +#include "_end.def" |