rmsummary.h

00001 /*
00002 Copyright (C) 2013- The University of Notre Dame This software is
00003 distributed under the GNU General Public License.  See the file
00004 COPYING for details.
00005 */
00006 
00007 #ifndef __RMSUMMARY_H
00008 #define __RMSUMMARY_H
00009 
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 
00013 #include "int_sizes.h"
00014 
00015 /* Environment variables names */
00016 #define RESOURCES_CORES  "CORES"
00017 #define RESOURCES_MEMORY "MEMORY"
00018 #define RESOURCES_DISK   "DISK"
00019 #define RESOURCES_GPUS   "GPUS"
00020 
00021 // These fields are defined as signed integers, even though they
00022 // will only contain positive numbers. This is to conversion to
00023 // signed quantities when comparing to maximum limits.
00024 struct rmsummary
00025 {
00026         char    *category;
00027         char    *command;
00028 
00029         int64_t  start;
00030         int64_t  end;
00031 
00032         char    *exit_type;
00033         int64_t  signal;
00034         char    *limits_exceeded;
00035         int64_t  exit_status;
00036         int64_t  last_error;
00037 
00038         int64_t  wall_time;
00039         int64_t  total_processes;
00040         int64_t  max_concurrent_processes;
00041         int64_t  cpu_time;
00042         int64_t  virtual_memory;
00043         int64_t  resident_memory;
00044         int64_t  swap_memory;
00045         int64_t  bytes_read;
00046         int64_t  bytes_written;
00047         int64_t  workdir_num_files;
00048         int64_t  workdir_footprint;
00049 
00050         int64_t  cores;
00051         int64_t  gpus;
00052         int64_t  task_id;
00053 
00054         /* these fields are not used when reading/printing summaries */
00055         int64_t  fs_nodes;
00056 
00057 };
00058 
00059 struct rmsummary_field
00060 {
00061         char   *name;
00062         size_t  offset;
00063         int     type;
00064         union { uint64_t integer;
00065                 double   real;
00066                 char    *string;
00067         }       value;
00068 };
00069 
00070 void rmsummary_print(FILE *stream, struct rmsummary *s, struct rmsummary *limits, char *preamble, char *epilogue);
00071 void rmsummary_print_only_resources(FILE *stream, struct rmsummary *s, const char *prefix);
00072 
00073 
00075 struct rmsummary *rmsummary_parse_file_single(char *filename);
00076 struct rmsummary *rmsummary_parse_limits_exceeded(char *filename);
00077 
00079 struct rmsummary *rmsummary_parse_from_str(const char *buffer, const char separator);
00080 
00082 struct rmsummary *rmsummary_parse_next(FILE *stream);
00083 
00084 struct rmsummary *make_rmsummary(signed char default_value);
00085 void rmsummary_read_env_vars(struct rmsummary *s);
00086 
00087 
00088 void rmsummary_merge_override(struct rmsummary *dest, struct rmsummary *src);
00089 void rmsummary_merge_max(struct rmsummary *dest, struct rmsummary *src);
00090 void rmsummary_debug_report(struct rmsummary *s);
00091 
00092 #endif

Generated on 23 Nov 2015 for cctools by  doxygen 1.6.1