category.h
00001
00002
00003
00004
00005
00006
00007 #ifndef CCTOOLS_CATEGORY_H
00008 #define CCTOOLS_CATEGORY_H
00009
00010 #include "hash_table.h"
00011 #include "histogram.h"
00012 #include "timestamp.h"
00013
00014 typedef enum {
00015 CATEGORY_ALLOCATION_FIRST = 0,
00016 CATEGORY_ALLOCATION_AUTO = 0,
00017 CATEGORY_ALLOCATION_MAX,
00018 CATEGORY_ALLOCATION_ERROR
00019 } category_allocation_t;
00020
00021
00022
00023
00024
00025
00026 typedef enum {
00030 WORK_QUEUE_ALLOCATION_MODE_FIXED = 0,
00031 WORK_QUEUE_ALLOCATION_MODE_MAX,
00039 WORK_QUEUE_ALLOCATION_MODE_MIN_WASTE,
00041 WORK_QUEUE_ALLOCATION_MODE_MAX_THROUGHPUT
00042 } category_mode_t;
00043
00044 #define CATEGORY_ALLOCATION_MODE_FIXED WORK_QUEUE_ALLOCATION_MODE_FIXED
00045 #define CATEGORY_ALLOCATION_MODE_MAX WORK_QUEUE_ALLOCATION_MODE_MAX
00046 #define CATEGORY_ALLOCATION_MODE_MIN_WASTE WORK_QUEUE_ALLOCATION_MODE_MIN_WASTE
00047 #define CATEGORY_ALLOCATION_MODE_MAX_THROUGHPUT WORK_QUEUE_ALLOCATION_MODE_MAX_THROUGHPUT
00048
00049 struct category {
00050 char *name;
00051 category_mode_t allocation_mode;
00052
00053 double fast_abort;
00054
00055 struct rmsummary *first_allocation;
00056 struct rmsummary *max_allocation;
00057 struct rmsummary *max_resources_seen;
00058
00059
00060 struct rmsummary *autolabel_resource;
00061
00062 struct histogram *cores_histogram;
00063 struct histogram *cores_avg_histogram;
00064 struct histogram *wall_time_histogram;
00065 struct histogram *cpu_time_histogram;
00066 struct histogram *max_concurrent_processes_histogram;
00067 struct histogram *total_processes_histogram;
00068 struct histogram *memory_histogram;
00069 struct histogram *swap_memory_histogram;
00070 struct histogram *virtual_memory_histogram;
00071 struct histogram *bytes_read_histogram;
00072 struct histogram *bytes_written_histogram;
00073 struct histogram *bytes_received_histogram;
00074 struct histogram *bytes_sent_histogram;
00075 struct histogram *bandwidth_histogram;
00076 struct histogram *total_files_histogram;
00077 struct histogram *disk_histogram;
00078
00079 int64_t total_tasks;
00080
00081
00082 int time_peak_independece;
00083
00084
00085 int64_t completions_since_last_reset;
00086
00087
00088
00089 int steady_state;
00090
00091
00092 uint64_t average_task_time;
00093 struct work_queue_stats *wq_stats;
00094
00095
00096
00097 struct hash_table *mf_variables;
00098 };
00099
00100
00101 void category_specify_allocation_mode(struct category *c, int mode);
00102
00103 int category_enable_auto_resource(struct category *c, const char *resource_name, int autolabel);
00104
00105 void category_specify_max_allocation(struct category *c, const struct rmsummary *s);
00106 void category_specify_first_allocation_guess(struct category *c, const struct rmsummary *s);
00107
00108 struct category *category_create(const char *name);
00109 struct category *category_lookup_or_create(struct hash_table *categories, const char *name);
00110 void category_delete(struct hash_table *categories, const char *name);
00111 void categories_initialize(struct hash_table *categories, struct rmsummary *top, const char *summaries_file);
00112
00113 int category_accumulate_summary(struct category *c, const struct rmsummary *rs, const struct rmsummary *max_worker);
00114 int category_update_first_allocation(struct category *c, const struct rmsummary *max_worker);
00115
00116 int category_in_steady_state(struct category *c);
00117
00118 category_allocation_t category_next_label(struct category *c, category_allocation_t current_label, int resource_overflow, struct rmsummary *user, struct rmsummary *measured);
00119
00120 const struct rmsummary *category_dynamic_task_max_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
00121
00122 const struct rmsummary *category_dynamic_task_min_resources(struct category *c, struct rmsummary *user, category_allocation_t request);
00123
00124 #endif