rmsummary.h
00001
00002
00003
00004
00005
00006
00007 #ifndef __RMSUMMARY_H
00008 #define __RMSUMMARY_H
00009
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012
00013 #include "jx.h"
00014 #include "int_sizes.h"
00015 #include "buffer.h"
00016
00017
00018 #define RESOURCES_CORES "CORES"
00019 #define RESOURCES_MEMORY "MEMORY"
00020 #define RESOURCES_DISK "DISK"
00021 #define RESOURCES_GPUS "GPUS"
00022
00023
00024
00025
00026 struct rmsummary
00027 {
00028 char *category;
00029 char *command;
00030 char *taskid;
00031
00032 int64_t start;
00033 int64_t end;
00034
00035 char *exit_type;
00036 int64_t signal;
00037 int64_t exit_status;
00038 int64_t last_error;
00039
00040 int64_t wall_time;
00041 int64_t total_processes;
00042 int64_t max_concurrent_processes;
00043 int64_t cpu_time;
00044 int64_t virtual_memory;
00045 int64_t memory;
00046 int64_t swap_memory;
00047
00048 int64_t bytes_read;
00049 int64_t bytes_written;
00050
00051 int64_t bytes_sent;
00052 int64_t bytes_received;
00053 int64_t bandwidth;
00054
00055 int64_t total_files;
00056 int64_t disk;
00057
00058 int64_t cores;
00059 int64_t gpus;
00060
00061 struct rmsummary *limits_exceeded;
00062 struct rmsummary *peak_times;
00063
00064
00065 int64_t fs_nodes;
00066 };
00067
00068 struct rmsummary_field
00069 {
00070 char *name;
00071 size_t offset;
00072 int type;
00073 union { uint64_t integer;
00074 double real;
00075 char *string;
00076 } value;
00077 };
00078
00079 void rmsummary_print(FILE *stream, struct rmsummary *s, int pprint, struct jx *verbatim_fields);
00080 void rmsummary_print_buffer(struct buffer *B, const struct rmsummary *s, int only_resources);
00081 char *rmsummary_print_string(const struct rmsummary *s, int only_resources);
00082
00083 const char *rmsummary_unit_of(const char *key);
00084
00085 int rmsummary_assign_int_field(struct rmsummary *s, const char *key, int64_t value);
00086 int rmsummary_assign_char_field(struct rmsummary *s, const char *key, char *value);
00087
00088 int64_t rmsummary_get_int_field(struct rmsummary *s, const char *key);
00089 const char *rmsummary_get_char_field(struct rmsummary *s, const char *key);
00090
00092 struct rmsummary *rmsummary_parse_file_single(const char *filename);
00093
00095 struct rmsummary *rmsummary_parse_string(const char *str);
00096
00098 struct list *rmsummary_parse_file_multiple(const char *filename);
00099
00100 struct jx *rmsummary_to_json(const struct rmsummary *s, int only_resources);
00101 struct rmsummary *json_to_rmsummary(struct jx *j);
00102
00103 struct rmsummary *rmsummary_create(signed char default_value);
00104 void rmsummary_delete(struct rmsummary *s);
00105
00106 void rmsummary_read_env_vars(struct rmsummary *s);
00107
00108 void rmsummary_merge_max_w_time(struct rmsummary *dest, const struct rmsummary *src);
00109
00110 struct rmsummary *rmsummary_copy(const struct rmsummary *src);
00111 void rmsummary_merge_override(struct rmsummary *dest, const struct rmsummary *src);
00112 void rmsummary_merge_max(struct rmsummary *dest, const struct rmsummary *src);
00113 void rmsummary_merge_min(struct rmsummary *dest, const struct rmsummary *src);
00114 void rmsummary_debug_report(const struct rmsummary *s);
00115
00116 double rmsummary_to_external_unit(const char *field, int64_t n);
00117 int rmsummary_to_internal_unit(const char *field, double input_number, int64_t *output_number, const char *unit);
00118
00119 size_t rmsummary_field_offset(const char *key);
00120 int64_t rmsummary_get_int_field_by_offset(const struct rmsummary *s, size_t offset);
00121
00122 #endif