cctools
rmsummary.h
1 /*
2 Copyright (C) 2013- The University of Notre Dame This software is
3 distributed under the GNU General Public License. See the file
4 COPYING for details.
5 */
6 
7 #ifndef __RMSUMMARY_H
8 #define __RMSUMMARY_H
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 
13 #include "int_sizes.h"
14 
15 /* Environment variables names */
16 #define RESOURCES_CORES "CORES"
17 #define RESOURCES_MEMORY "MEMORY"
18 #define RESOURCES_DISK "DISK"
19 #define RESOURCES_GPUS "GPUS"
20 
21 // These fields are defined as signed integers, even though they
22 // will only contain positive numbers. This is to conversion to
23 // signed quantities when comparing to maximum limits.
24 struct rmsummary
25 {
26  char *category;
27  char *command;
28 
29  int64_t start;
30  int64_t end;
31 
32  char *exit_type;
33  int64_t signal;
34  char *limits_exceeded;
35  int64_t exit_status;
36 
37  int64_t wall_time;
38  int64_t total_processes;
39  int64_t max_concurrent_processes;
40  int64_t cpu_time;
41  int64_t virtual_memory;
42  int64_t resident_memory;
43  int64_t swap_memory;
44  int64_t bytes_read;
45  int64_t bytes_written;
46  int64_t workdir_num_files;
47  int64_t workdir_footprint;
48 
49  int64_t cores;
50  int64_t gpus;
51  int64_t task_id;
52 
53  /* these fields are not used when reading/printing summaries */
54  int64_t fs_nodes;
55 
56 };
57 
59 {
60  char *name;
61  size_t offset;
62  int type;
63  union { uint64_t integer;
64  double real;
65  char *string;
66  } value;
67 };
68 
69 void rmsummary_print(FILE *stream, struct rmsummary *s, struct rmsummary *limits);
70 void rmsummary_print_only_resources(FILE *stream, struct rmsummary *s, const char *prefix);
71 
72 
74 struct rmsummary *rmsummary_parse_file_single(char *filename);
75 struct rmsummary *rmsummary_parse_limits_exceeded(char *filename);
76 
78 struct rmsummary *rmsummary_parse_from_str(const char *buffer, const char separator);
79 
81 struct rmsummary *rmsummary_parse_next(FILE *stream);
82 
83 struct rmsummary *make_rmsummary(signed char default_value);
84 void rmsummary_read_env_vars(struct rmsummary *s);
85 
86 
87 void rmsummary_merge_override(struct rmsummary *dest, struct rmsummary *src);
88 void rmsummary_merge_max(struct rmsummary *dest, struct rmsummary *src);
89 void rmsummary_debug_report(struct rmsummary *s);
90 
91 #endif
92 
Definition: rmsummary.h:24
Definition: buffer.h:23
Definition: rmsummary.h:58