cctools
category.h
1 /*
2 Copyright (C) 2015- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef CCTOOLS_CATEGORY_H
8 #define CCTOOLS_CATEGORY_H
9 
10 #include "hash_table.h"
11 #include "timestamp.h"
12 
13 typedef enum {
14  CATEGORY_ALLOCATION_UNLABELED = 0,
15  CATEGORY_ALLOCATION_USER,
16  CATEGORY_ALLOCATION_AUTO_ZERO,
17  CATEGORY_ALLOCATION_AUTO_FIRST,
18  CATEGORY_ALLOCATION_AUTO_MAX,
19  CATEGORY_ALLOCATION_ERROR
20 } category_allocation_t;
21 
22 typedef enum {
23  CATEGORY_ALLOCATION_MODE_MAX = 0,
24  CATEGORY_ALLOCATION_MODE_MIN_WASTE,
25  CATEGORY_ALLOCATION_MODE_MAX_THROUGHPUT
26 } category_mode_t;
27 
28 struct category {
29  char *name;
30  double fast_abort;
31 
32  struct rmsummary *first_allocation;
33  struct rmsummary *max_allocation;
34 
35  /* All keys are assumed positive. Thus, we shift them to the right so that
36  * we can have a "0" key. 0->1, 1->2, etc. */
37  struct itable *cores_histogram;
38  struct itable *wall_time_histogram;
39  struct itable *cpu_time_histogram;
40  struct itable *max_concurrent_processes_histogram;
41  struct itable *total_processes_histogram;
42  struct itable *memory_histogram;
43  struct itable *swap_memory_histogram;
44  struct itable *virtual_memory_histogram;
45  struct itable *bytes_read_histogram;
46  struct itable *bytes_written_histogram;
47  struct itable *bytes_received_histogram;
48  struct itable *bytes_sent_histogram;
49  struct itable *bandwidth_histogram;
50  struct itable *total_files_histogram;
51  struct itable *disk_histogram;
52 
53  category_mode_t allocation_mode;
54 
55  uint64_t total_tasks;
56 
57  /* assume that peak usage is independent of wall time */
58  int time_peak_independece;
59 
60  /* stats for wq */
61  uint64_t average_task_time;
62  struct work_queue_stats *wq_stats;
63 
64  /* variables for makeflow */
65  /* Mappings between variable names defined in the makeflow file and their values. */
66  struct hash_table *mf_variables;
67 };
68 
69 struct category *category_lookup_or_create(struct hash_table *categories, const char *name);
70 void category_delete(struct hash_table *categories, const char *name);
71 void category_accumulate_summary(struct hash_table *categories, const char *category, struct rmsummary *rs);
72 void category_update_first_allocation(struct hash_table *categories, const char *category);
73 void categories_initialize(struct hash_table *categories, struct rmsummary *top, const char *summaries_file);
74 category_allocation_t category_next_label(struct hash_table *categories, const char *category, category_allocation_t current_label, int resource_overflow);
75 
76 #endif
Portable routines for high resolution timing.
Statistics describing a work queue.
Definition: work_queue.h:153
Definition: rmsummary.h:25
A general purpose hash table.
Definition: category.h:28