|
Lines 45-50
Link Here
|
| 45 |
typedef struct { |
45 |
typedef struct { |
| 46 |
int id; |
46 |
int id; |
| 47 |
uint64_t a_cpu; |
47 |
uint64_t a_cpu; |
|
|
48 |
uint64_t energy; |
| 48 |
} local_id_usage_t; |
49 |
} local_id_usage_t; |
| 49 |
|
50 |
|
| 50 |
typedef struct { |
51 |
typedef struct { |
|
Lines 59-64
typedef struct {
Link Here
|
| 59 |
uint64_t r_cpu; |
60 |
uint64_t r_cpu; |
| 60 |
time_t start; |
61 |
time_t start; |
| 61 |
time_t end; |
62 |
time_t end; |
|
|
63 |
uint64_t energy; |
| 62 |
} local_cluster_usage_t; |
64 |
} local_cluster_usage_t; |
| 63 |
|
65 |
|
| 64 |
typedef struct { |
66 |
typedef struct { |
|
Lines 269-285
static int _process_cluster_usage(mysql_conn_t *mysql_conn,
Link Here
|
| 269 |
"cpu_count, alloc_cpu_secs, " |
271 |
"cpu_count, alloc_cpu_secs, " |
| 270 |
"down_cpu_secs, pdown_cpu_secs, " |
272 |
"down_cpu_secs, pdown_cpu_secs, " |
| 271 |
"idle_cpu_secs, over_cpu_secs, " |
273 |
"idle_cpu_secs, over_cpu_secs, " |
| 272 |
"resv_cpu_secs) " |
274 |
"resv_cpu_secs, consumed_energy) " |
| 273 |
"values (%ld, %ld, %ld, %d, " |
275 |
"values (%ld, %ld, %ld, %d, " |
| 274 |
"%"PRIu64", %"PRIu64", %"PRIu64", " |
276 |
"%"PRIu64", %"PRIu64", %"PRIu64", " |
| 275 |
"%"PRIu64", %"PRIu64", %"PRIu64")", |
277 |
"%"PRIu64", %"PRIu64", %"PRIu64", " |
|
|
278 |
"%"PRIu64")", |
| 276 |
cluster_name, cluster_hour_table, |
279 |
cluster_name, cluster_hour_table, |
| 277 |
now, now, |
280 |
now, now, |
| 278 |
c_usage->start, |
281 |
c_usage->start, |
| 279 |
c_usage->cpu_count, |
282 |
c_usage->cpu_count, |
| 280 |
c_usage->a_cpu, c_usage->d_cpu, |
283 |
c_usage->a_cpu, c_usage->d_cpu, |
| 281 |
c_usage->pd_cpu, c_usage->i_cpu, |
284 |
c_usage->pd_cpu, c_usage->i_cpu, |
| 282 |
c_usage->o_cpu, c_usage->r_cpu); |
285 |
c_usage->o_cpu, c_usage->r_cpu, |
|
|
286 |
c_usage->energy); |
| 283 |
|
287 |
|
| 284 |
/* Spacing out the inserts here instead of doing them |
288 |
/* Spacing out the inserts here instead of doing them |
| 285 |
all at once in the end proves to be faster. Just FYI |
289 |
all at once in the end proves to be faster. Just FYI |
|
Lines 294-300
static int _process_cluster_usage(mysql_conn_t *mysql_conn,
Link Here
|
| 294 |
"pdown_cpu_secs=VALUES(pdown_cpu_secs), " |
298 |
"pdown_cpu_secs=VALUES(pdown_cpu_secs), " |
| 295 |
"idle_cpu_secs=VALUES(idle_cpu_secs), " |
299 |
"idle_cpu_secs=VALUES(idle_cpu_secs), " |
| 296 |
"over_cpu_secs=VALUES(over_cpu_secs), " |
300 |
"over_cpu_secs=VALUES(over_cpu_secs), " |
| 297 |
"resv_cpu_secs=VALUES(resv_cpu_secs)", |
301 |
"resv_cpu_secs=VALUES(resv_cpu_secs), " |
|
|
302 |
"consumed_energy=VALUES(consumed_energy)", |
| 298 |
now); |
303 |
now); |
| 299 |
debug3("%d(%s:%d) query\n%s", |
304 |
debug3("%d(%s:%d) query\n%s", |
| 300 |
mysql_conn->conn, THIS_FILE, __LINE__, query); |
305 |
mysql_conn->conn, THIS_FILE, __LINE__, query); |
|
Lines 478-495
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 478 |
/* char start_char[20], end_char[20]; */ |
483 |
/* char start_char[20], end_char[20]; */ |
| 479 |
|
484 |
|
| 480 |
char *job_req_inx[] = { |
485 |
char *job_req_inx[] = { |
| 481 |
"job_db_inx", |
486 |
"job.job_db_inx", |
| 482 |
"id_job", |
487 |
"job.id_job", |
| 483 |
"id_assoc", |
488 |
"job.id_assoc", |
| 484 |
"id_wckey", |
489 |
"job.id_wckey", |
| 485 |
"time_eligible", |
490 |
"job.time_eligible", |
| 486 |
"time_start", |
491 |
"job.time_start", |
| 487 |
"time_end", |
492 |
"job.time_end", |
| 488 |
"time_suspended", |
493 |
"job.time_suspended", |
| 489 |
"cpus_alloc", |
494 |
"job.cpus_alloc", |
| 490 |
"cpus_req", |
495 |
"job.cpus_req", |
| 491 |
"id_resv" |
496 |
"job.id_resv", |
| 492 |
|
497 |
"SUM(step.consumed_energy)" |
| 493 |
}; |
498 |
}; |
| 494 |
char *job_str = NULL; |
499 |
char *job_str = NULL; |
| 495 |
enum { |
500 |
enum { |
|
Lines 504-509
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 504 |
JOB_REQ_ACPU, |
509 |
JOB_REQ_ACPU, |
| 505 |
JOB_REQ_RCPU, |
510 |
JOB_REQ_RCPU, |
| 506 |
JOB_REQ_RESVID, |
511 |
JOB_REQ_RESVID, |
|
|
512 |
JOB_REQ_ENERGY, |
| 507 |
JOB_REQ_COUNT |
513 |
JOB_REQ_COUNT |
| 508 |
}; |
514 |
}; |
| 509 |
|
515 |
|
|
Lines 687-697
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 687 |
mysql_free_result(result); |
693 |
mysql_free_result(result); |
| 688 |
|
694 |
|
| 689 |
/* now get the jobs during this time only */ |
695 |
/* now get the jobs during this time only */ |
| 690 |
query = xstrdup_printf("select %s from \"%s_%s\" where " |
696 |
query = xstrdup_printf("select %s from \"%s_%s\" as job " |
| 691 |
"(time_eligible < %ld && " |
697 |
"left outer join \"%s_%s\" as step on " |
| 692 |
"(time_end >= %ld || time_end = 0)) " |
698 |
"job.job_db_inx=step.job_db_inx " |
| 693 |
"order by id_assoc, time_eligible", |
699 |
"where (job.time_eligible < %ld && " |
|
|
700 |
"(job.time_end >= %ld || " |
| 701 |
"job.time_end = 0)) and" |
| 702 |
" (step.id_step>=0) " |
| 703 |
"group by job.job_db_inx " |
| 704 |
"order by job.id_assoc, " |
| 705 |
"job.time_eligible", |
| 694 |
job_str, cluster_name, job_table, |
706 |
job_str, cluster_name, job_table, |
|
|
707 |
cluster_name, step_table, |
| 695 |
curr_end, curr_start); |
708 |
curr_end, curr_start); |
| 696 |
|
709 |
|
| 697 |
debug3("%d(%s:%d) query\n%s", |
710 |
debug3("%d(%s:%d) query\n%s", |
|
Lines 714-719
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 714 |
time_t row_end = slurm_atoul(row[JOB_REQ_END]); |
727 |
time_t row_end = slurm_atoul(row[JOB_REQ_END]); |
| 715 |
uint32_t row_acpu = slurm_atoul(row[JOB_REQ_ACPU]); |
728 |
uint32_t row_acpu = slurm_atoul(row[JOB_REQ_ACPU]); |
| 716 |
uint32_t row_rcpu = slurm_atoul(row[JOB_REQ_RCPU]); |
729 |
uint32_t row_rcpu = slurm_atoul(row[JOB_REQ_RCPU]); |
|
|
730 |
uint32_t row_energy = slurm_atoul(row[JOB_REQ_ENERGY]); |
| 717 |
int loc_seconds = 0; |
731 |
int loc_seconds = 0; |
| 718 |
seconds = 0; |
732 |
seconds = 0; |
| 719 |
|
733 |
|
|
Lines 791-796
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 791 |
} |
805 |
} |
| 792 |
|
806 |
|
| 793 |
a_usage->a_cpu += seconds * row_acpu; |
807 |
a_usage->a_cpu += seconds * row_acpu; |
|
|
808 |
a_usage->energy+= row_energy; |
| 794 |
|
809 |
|
| 795 |
if (!track_wckey) |
810 |
if (!track_wckey) |
| 796 |
goto calc_cluster; |
811 |
goto calc_cluster; |
|
Lines 813-818
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 813 |
last_wckeyid = wckey_id; |
828 |
last_wckeyid = wckey_id; |
| 814 |
} |
829 |
} |
| 815 |
w_usage->a_cpu += seconds * row_acpu; |
830 |
w_usage->a_cpu += seconds * row_acpu; |
|
|
831 |
w_usage->energy+= row_energy; |
| 816 |
/* do the cluster allocated calculation */ |
832 |
/* do the cluster allocated calculation */ |
| 817 |
calc_cluster: |
833 |
calc_cluster: |
| 818 |
|
834 |
|
|
Lines 910-915
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 910 |
/* row_acpu); */ |
926 |
/* row_acpu); */ |
| 911 |
|
927 |
|
| 912 |
c_usage->a_cpu += seconds * row_acpu; |
928 |
c_usage->a_cpu += seconds * row_acpu; |
|
|
929 |
c_usage->energy+= row_energy; |
| 913 |
} |
930 |
} |
| 914 |
|
931 |
|
| 915 |
/* now reserved time */ |
932 |
/* now reserved time */ |
|
Lines 1003-1030
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1003 |
/* a_usage->a_cpu); */ |
1020 |
/* a_usage->a_cpu); */ |
| 1004 |
if (query) { |
1021 |
if (query) { |
| 1005 |
xstrfmtcat(query, |
1022 |
xstrfmtcat(query, |
| 1006 |
", (%ld, %ld, %d, %ld, %"PRIu64")", |
1023 |
", (%ld, %ld, %d, %ld, %"PRIu64",%"PRIu64")", |
| 1007 |
now, now, |
1024 |
now, now, |
| 1008 |
a_usage->id, curr_start, |
1025 |
a_usage->id, curr_start, |
| 1009 |
a_usage->a_cpu); |
1026 |
a_usage->a_cpu, a_usage->energy); |
| 1010 |
} else { |
1027 |
} else { |
| 1011 |
xstrfmtcat(query, |
1028 |
xstrfmtcat(query, |
| 1012 |
"insert into \"%s_%s\" " |
1029 |
"insert into \"%s_%s\" " |
| 1013 |
"(creation_time, " |
1030 |
"(creation_time, " |
| 1014 |
"mod_time, id_assoc, time_start, " |
1031 |
"mod_time, id_assoc, time_start, " |
| 1015 |
"alloc_cpu_secs) values " |
1032 |
"alloc_cpu_secs, consumed_energy) values " |
| 1016 |
"(%ld, %ld, %d, %ld, %"PRIu64")", |
1033 |
"(%ld, %ld, %d, %ld, %"PRIu64",%"PRIu64")", |
| 1017 |
cluster_name, assoc_hour_table, |
1034 |
cluster_name, assoc_hour_table, |
| 1018 |
now, now, |
1035 |
now, now, |
| 1019 |
a_usage->id, curr_start, |
1036 |
a_usage->id, curr_start, |
| 1020 |
a_usage->a_cpu); |
1037 |
a_usage->a_cpu, a_usage->energy); |
| 1021 |
} |
1038 |
} |
| 1022 |
} |
1039 |
} |
| 1023 |
if (query) { |
1040 |
if (query) { |
| 1024 |
xstrfmtcat(query, |
1041 |
xstrfmtcat(query, |
| 1025 |
" on duplicate key update " |
1042 |
" on duplicate key update " |
| 1026 |
"mod_time=%ld, " |
1043 |
"mod_time=%ld, " |
| 1027 |
"alloc_cpu_secs=VALUES(alloc_cpu_secs);", |
1044 |
"alloc_cpu_secs=VALUES(alloc_cpu_secs), " |
|
|
1045 |
"consumed_energy=VALUES(consumed_energy);", |
| 1028 |
now); |
1046 |
now); |
| 1029 |
|
1047 |
|
| 1030 |
debug3("%d(%s:%d) query\n%s", |
1048 |
debug3("%d(%s:%d) query\n%s", |
|
Lines 1048-1075
extern int as_mysql_hourly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1048 |
/* w_usage->a_cpu); */ |
1066 |
/* w_usage->a_cpu); */ |
| 1049 |
if (query) { |
1067 |
if (query) { |
| 1050 |
xstrfmtcat(query, |
1068 |
xstrfmtcat(query, |
| 1051 |
", (%ld, %ld, %d, %ld, %"PRIu64")", |
1069 |
", (%ld, %ld, %d, %ld, " |
|
|
1070 |
"%"PRIu64", %"PRIu64")", |
| 1052 |
now, now, |
1071 |
now, now, |
| 1053 |
w_usage->id, curr_start, |
1072 |
w_usage->id, curr_start, |
| 1054 |
w_usage->a_cpu); |
1073 |
w_usage->a_cpu, w_usage->energy); |
| 1055 |
} else { |
1074 |
} else { |
| 1056 |
xstrfmtcat(query, |
1075 |
xstrfmtcat(query, |
| 1057 |
"insert into \"%s_%s\" " |
1076 |
"insert into \"%s_%s\" " |
| 1058 |
"(creation_time, " |
1077 |
"(creation_time, " |
| 1059 |
"mod_time, id_wckey, time_start, " |
1078 |
"mod_time, id_wckey, time_start, " |
| 1060 |
"alloc_cpu_secs) values " |
1079 |
"alloc_cpu_secs, consumed_energy) " |
| 1061 |
"(%ld, %ld, %d, %ld, %"PRIu64")", |
1080 |
"values " |
|
|
1081 |
"(%ld, %ld, %d, %ld, " |
| 1082 |
"%"PRIu64", %"PRIu64")", |
| 1062 |
cluster_name, wckey_hour_table, |
1083 |
cluster_name, wckey_hour_table, |
| 1063 |
now, now, |
1084 |
now, now, |
| 1064 |
w_usage->id, curr_start, |
1085 |
w_usage->id, curr_start, |
| 1065 |
w_usage->a_cpu); |
1086 |
w_usage->a_cpu, w_usage->energy); |
| 1066 |
} |
1087 |
} |
| 1067 |
} |
1088 |
} |
| 1068 |
if (query) { |
1089 |
if (query) { |
| 1069 |
xstrfmtcat(query, |
1090 |
xstrfmtcat(query, |
| 1070 |
" on duplicate key update " |
1091 |
" on duplicate key update " |
| 1071 |
"mod_time=%ld, " |
1092 |
"mod_time=%ld, " |
| 1072 |
"alloc_cpu_secs=VALUES(alloc_cpu_secs);", |
1093 |
"alloc_cpu_secs=VALUES(alloc_cpu_secs), " |
|
|
1094 |
"consumed_energy=VALUES(consumed_energy);", |
| 1073 |
now); |
1095 |
now); |
| 1074 |
|
1096 |
|
| 1075 |
debug3("%d(%s:%d) query\n%s", |
1097 |
debug3("%d(%s:%d) query\n%s", |
|
Lines 1151-1162
extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1151 |
query = xstrdup_printf( |
1173 |
query = xstrdup_printf( |
| 1152 |
"insert into \"%s_%s\" (creation_time, mod_time, " |
1174 |
"insert into \"%s_%s\" (creation_time, mod_time, " |
| 1153 |
"id_assoc, " |
1175 |
"id_assoc, " |
| 1154 |
"time_start, alloc_cpu_secs) select %ld, %ld, " |
1176 |
"time_start, alloc_cpu_secs, consumed_energy) select %ld, %ld, " |
| 1155 |
"id_assoc, " |
1177 |
"id_assoc, " |
| 1156 |
"%ld, @ASUM:=SUM(alloc_cpu_secs) from \"%s_%s\" where " |
1178 |
"%ld, @ASUM:=SUM(alloc_cpu_secs), @ESUM:=SUM(consumed_energy) " |
|
|
1179 |
"from \"%s_%s\" where " |
| 1157 |
"(time_start < %ld && time_start >= %ld) " |
1180 |
"(time_start < %ld && time_start >= %ld) " |
| 1158 |
"group by id_assoc on duplicate key update " |
1181 |
"group by id_assoc on duplicate key update " |
| 1159 |
"mod_time=%ld, alloc_cpu_secs=@ASUM;", |
1182 |
"mod_time=%ld, alloc_cpu_secs=@ASUM, consumed_energy=@ESUM;", |
| 1160 |
cluster_name, assoc_day_table, now, now, curr_start, |
1183 |
cluster_name, assoc_day_table, now, now, curr_start, |
| 1161 |
cluster_name, assoc_hour_table, |
1184 |
cluster_name, assoc_hour_table, |
| 1162 |
curr_end, curr_start, now); |
1185 |
curr_end, curr_start, now); |
|
Lines 1168-1174
extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1168 |
"insert into \"%s_%s\" (creation_time, " |
1191 |
"insert into \"%s_%s\" (creation_time, " |
| 1169 |
"mod_time, time_start, cpu_count, " |
1192 |
"mod_time, time_start, cpu_count, " |
| 1170 |
"alloc_cpu_secs, down_cpu_secs, pdown_cpu_secs, " |
1193 |
"alloc_cpu_secs, down_cpu_secs, pdown_cpu_secs, " |
| 1171 |
"idle_cpu_secs, over_cpu_secs, resv_cpu_secs) " |
1194 |
"idle_cpu_secs, over_cpu_secs, resv_cpu_secs, consumed_energy) " |
| 1172 |
"select %ld, %ld, " |
1195 |
"select %ld, %ld, " |
| 1173 |
"%ld, @CPU:=MAX(cpu_count), " |
1196 |
"%ld, @CPU:=MAX(cpu_count), " |
| 1174 |
"@ASUM:=SUM(alloc_cpu_secs), " |
1197 |
"@ASUM:=SUM(alloc_cpu_secs), " |
|
Lines 1176-1189
extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1176 |
"@PDSUM:=SUM(pdown_cpu_secs), " |
1199 |
"@PDSUM:=SUM(pdown_cpu_secs), " |
| 1177 |
"@ISUM:=SUM(idle_cpu_secs), " |
1200 |
"@ISUM:=SUM(idle_cpu_secs), " |
| 1178 |
"@OSUM:=SUM(over_cpu_secs), " |
1201 |
"@OSUM:=SUM(over_cpu_secs), " |
| 1179 |
"@RSUM:=SUM(resv_cpu_secs) from \"%s_%s\" where " |
1202 |
"@RSUM:=SUM(resv_cpu_secs), " |
|
|
1203 |
"@ESUM:=SUM(consumed_energy) from \"%s_%s\" where " |
| 1180 |
"(time_start < %ld && time_start >= %ld) " |
1204 |
"(time_start < %ld && time_start >= %ld) " |
| 1181 |
"group by deleted " |
1205 |
"group by deleted " |
| 1182 |
"on duplicate key update " |
1206 |
"on duplicate key update " |
| 1183 |
"mod_time=%ld, cpu_count=@CPU, " |
1207 |
"mod_time=%ld, cpu_count=@CPU, " |
| 1184 |
"alloc_cpu_secs=@ASUM, down_cpu_secs=@DSUM, " |
1208 |
"alloc_cpu_secs=@ASUM, down_cpu_secs=@DSUM, " |
| 1185 |
"pdown_cpu_secs=@PDSUM, idle_cpu_secs=@ISUM, " |
1209 |
"pdown_cpu_secs=@PDSUM, idle_cpu_secs=@ISUM, " |
| 1186 |
"over_cpu_secs=@OSUM, resv_cpu_secs=@RSUM;", |
1210 |
"over_cpu_secs=@OSUM, resv_cpu_secs=@RSUM, " |
|
|
1211 |
"consumed_energy=@ESUM;", |
| 1187 |
cluster_name, cluster_day_table, |
1212 |
cluster_name, cluster_day_table, |
| 1188 |
now, now, curr_start, |
1213 |
now, now, curr_start, |
| 1189 |
cluster_name, cluster_hour_table, |
1214 |
cluster_name, cluster_hour_table, |
|
Lines 1192-1203
extern int as_mysql_daily_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1192 |
xstrfmtcat(query, |
1217 |
xstrfmtcat(query, |
| 1193 |
"insert into \"%s_%s\" (creation_time, " |
1218 |
"insert into \"%s_%s\" (creation_time, " |
| 1194 |
"mod_time, id_wckey, time_start, " |
1219 |
"mod_time, id_wckey, time_start, " |
| 1195 |
"alloc_cpu_secs) select %ld, %ld, " |
1220 |
"alloc_cpu_secs, consumed_energy) select %ld, %ld, " |
| 1196 |
"id_wckey, %ld, @ASUM:=SUM(alloc_cpu_secs) " |
1221 |
"id_wckey, %ld, @ASUM:=SUM(alloc_cpu_secs), " |
|
|
1222 |
"@ESUM:=SUM(consumed_energy) " |
| 1197 |
"from \"%s_%s\" where (time_start < %ld && " |
1223 |
"from \"%s_%s\" where (time_start < %ld && " |
| 1198 |
"time_start >= %ld) " |
1224 |
"time_start >= %ld) " |
| 1199 |
"group by id_wckey on duplicate key update " |
1225 |
"group by id_wckey on duplicate key update " |
| 1200 |
"mod_time=%ld, alloc_cpu_secs=@ASUM;", |
1226 |
"mod_time=%ld, alloc_cpu_secs=@ASUM, " |
|
|
1227 |
"consumed_energy=@ESUM;", |
| 1201 |
cluster_name, wckey_day_table, |
1228 |
cluster_name, wckey_day_table, |
| 1202 |
now, now, curr_start, |
1229 |
now, now, curr_start, |
| 1203 |
cluster_name, wckey_hour_table, |
1230 |
cluster_name, wckey_hour_table, |
|
Lines 1267-1278
extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1267 |
query = xstrdup_printf( |
1294 |
query = xstrdup_printf( |
| 1268 |
"insert into \"%s_%s\" (creation_time, " |
1295 |
"insert into \"%s_%s\" (creation_time, " |
| 1269 |
"mod_time, id_assoc, " |
1296 |
"mod_time, id_assoc, " |
| 1270 |
"time_start, alloc_cpu_secs) select " |
1297 |
"time_start, alloc_cpu_secs, consumed_energy) select " |
| 1271 |
"%ld, %ld, id_assoc, " |
1298 |
"%ld, %ld, id_assoc, " |
| 1272 |
"%ld, @ASUM:=SUM(alloc_cpu_secs) from \"%s_%s\" where " |
1299 |
"%ld, @ASUM:=SUM(alloc_cpu_secs), @ESUM:=SUM(consumed_energy) " |
|
|
1300 |
"from \"%s_%s\" where " |
| 1273 |
"(time_start < %ld && time_start >= %ld) " |
1301 |
"(time_start < %ld && time_start >= %ld) " |
| 1274 |
"group by id_assoc on duplicate key update " |
1302 |
"group by id_assoc on duplicate key update " |
| 1275 |
"mod_time=%ld, alloc_cpu_secs=@ASUM;", |
1303 |
"mod_time=%ld, alloc_cpu_secs=@ASUM, consumed_energy=@ESUM;", |
| 1276 |
cluster_name, assoc_month_table, now, now, curr_start, |
1304 |
cluster_name, assoc_month_table, now, now, curr_start, |
| 1277 |
cluster_name, assoc_day_table, |
1305 |
cluster_name, assoc_day_table, |
| 1278 |
curr_end, curr_start, now); |
1306 |
curr_end, curr_start, now); |
|
Lines 1284-1290
extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1284 |
"insert into \"%s_%s\" (creation_time, " |
1312 |
"insert into \"%s_%s\" (creation_time, " |
| 1285 |
"mod_time, time_start, cpu_count, " |
1313 |
"mod_time, time_start, cpu_count, " |
| 1286 |
"alloc_cpu_secs, down_cpu_secs, pdown_cpu_secs, " |
1314 |
"alloc_cpu_secs, down_cpu_secs, pdown_cpu_secs, " |
| 1287 |
"idle_cpu_secs, over_cpu_secs, resv_cpu_secs) " |
1315 |
"idle_cpu_secs, over_cpu_secs, resv_cpu_secs, consumed_energy) " |
| 1288 |
"select %ld, %ld, " |
1316 |
"select %ld, %ld, " |
| 1289 |
"%ld, @CPU:=MAX(cpu_count), " |
1317 |
"%ld, @CPU:=MAX(cpu_count), " |
| 1290 |
"@ASUM:=SUM(alloc_cpu_secs), " |
1318 |
"@ASUM:=SUM(alloc_cpu_secs), " |
|
Lines 1292-1305
extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1292 |
"@PDSUM:=SUM(pdown_cpu_secs), " |
1320 |
"@PDSUM:=SUM(pdown_cpu_secs), " |
| 1293 |
"@ISUM:=SUM(idle_cpu_secs), " |
1321 |
"@ISUM:=SUM(idle_cpu_secs), " |
| 1294 |
"@OSUM:=SUM(over_cpu_secs), " |
1322 |
"@OSUM:=SUM(over_cpu_secs), " |
| 1295 |
"@RSUM:=SUM(resv_cpu_secs) from \"%s_%s\" where " |
1323 |
"@RSUM:=SUM(resv_cpu_secs), " |
|
|
1324 |
"@ESUM:=SUM(consumed_energy) from \"%s_%s\" where " |
| 1296 |
"(time_start < %ld && time_start >= %ld) " |
1325 |
"(time_start < %ld && time_start >= %ld) " |
| 1297 |
"group by deleted " |
1326 |
"group by deleted " |
| 1298 |
"on duplicate key update " |
1327 |
"on duplicate key update " |
| 1299 |
"mod_time=%ld, cpu_count=@CPU, " |
1328 |
"mod_time=%ld, cpu_count=@CPU, " |
| 1300 |
"alloc_cpu_secs=@ASUM, down_cpu_secs=@DSUM, " |
1329 |
"alloc_cpu_secs=@ASUM, down_cpu_secs=@DSUM, " |
| 1301 |
"pdown_cpu_secs=@PDSUM, idle_cpu_secs=@ISUM, " |
1330 |
"pdown_cpu_secs=@PDSUM, idle_cpu_secs=@ISUM, " |
| 1302 |
"over_cpu_secs=@OSUM, resv_cpu_secs=@RSUM;", |
1331 |
"over_cpu_secs=@OSUM, resv_cpu_secs=@RSUM, " |
|
|
1332 |
"consumed_energy=@ESUM;", |
| 1303 |
cluster_name, cluster_month_table, |
1333 |
cluster_name, cluster_month_table, |
| 1304 |
now, now, curr_start, |
1334 |
now, now, curr_start, |
| 1305 |
cluster_name, cluster_day_table, |
1335 |
cluster_name, cluster_day_table, |
|
Lines 1308-1320
extern int as_mysql_monthly_rollup(mysql_conn_t *mysql_conn,
Link Here
|
| 1308 |
xstrfmtcat(query, |
1338 |
xstrfmtcat(query, |
| 1309 |
"insert into \"%s_%s\" " |
1339 |
"insert into \"%s_%s\" " |
| 1310 |
"(creation_time, mod_time, " |
1340 |
"(creation_time, mod_time, " |
| 1311 |
"id_wckey, time_start, alloc_cpu_secs) " |
1341 |
"id_wckey, time_start, alloc_cpu_secs, consumed_energy) " |
| 1312 |
"select %ld, %ld, id_wckey, %ld, " |
1342 |
"select %ld, %ld, id_wckey, %ld, " |
| 1313 |
"@ASUM:=SUM(alloc_cpu_secs) " |
1343 |
"@ASUM:=SUM(alloc_cpu_secs), @ESUM:=SUM(consumed_energy) " |
| 1314 |
"from \"%s_%s\" where (time_start < %ld && " |
1344 |
"from \"%s_%s\" where (time_start < %ld && " |
| 1315 |
"time_start >= %ld) " |
1345 |
"time_start >= %ld) " |
| 1316 |
"group by id_wckey on duplicate key update " |
1346 |
"group by id_wckey on duplicate key update " |
| 1317 |
"mod_time=%ld, alloc_cpu_secs=@ASUM;", |
1347 |
"mod_time=%ld, alloc_cpu_secs=@ASUM, consumed_energy=@ESUM;", |
| 1318 |
cluster_name, wckey_month_table, |
1348 |
cluster_name, wckey_month_table, |
| 1319 |
now, now, curr_start, |
1349 |
now, now, curr_start, |
| 1320 |
cluster_name, wckey_day_table, |
1350 |
cluster_name, wckey_day_table, |