select DATE_TRUNC('hour',p.ts) as ts_hour count(distinct p.obj_uuid) as unique_vm_cnt count(distinct p.obj_uuid) FILTER (WHERE p.value=1) as unique_vm_cnt_on round((sum(p.value)/12.)::numeric,1) as vm_h round((sum(p.value)/12.*24.19)::numeric,2) as cost_wo_disk round((count(distinct obj_id)*8.00)::numeric,2) as disk_cost round((sum(p.value)/12.)::numeric, 1) as avg_roundclock_vm from gpu.vm JOIN gpu.vm_power_state p on (vm.obj_uuid=p.obj_uuid) where 1=1 /*watch time zone, accounting by MSK*/ AND p.ts >= AND p.ts < AND vm.client_id='WZ01516' GROUP BY DATE_TRUNC('hour',p.ts) ORDER BY 1; select max(ts) as dt_load from gpu.vm_power_state qGpuAge:#getTickCount()-request.startTickCount# Отчет по включенным ВМ с GPU
Период с по
Часов в периоде: #hours# Строк в отчете: #qRead.recordCount#
Актуальность данных: GPU-VM Power State: class="err">#dateFormat(qGpuAge.dt_load,'YYYY-MM-DD')# #timeFormat(qGpuAge.dt_load,'HH:mm:ss.lXX')#
Час Уникальных ВМ ВМ вкл ВМ-часов Стоимость без диска Стоимость диска Круглосуточных ВМ
#dateFormat(ts_hour,"YYYY-MM-DD")# #timeFormat(ts_hour,"HH:MM")# #unique_vm_cnt# #unique_vm_cnt_on# #vm_h# #cost_wo_disk# #disk_cost# #avg_roundclock_vm#
string function gaussianRoundSafe(any num, numeric precision = 0, string default="") { return (isNumeric(arguments.num)) ? gaussianRound(arguments.num, arguments.precision) : arguments.default; } function gaussianRound(numeric number, numeric precision = 0) { var factor = 10 ^ precision; var scaledNumber = number * factor; var absScaled = abs(scaledNumber); var sign = sgn(scaledNumber); var floored = int(absScaled); // If it's not ending in exactly .5, use standard rounding or precision scaling if (absScaled - floored != 0.5) { return round(number * factor) / factor; } // If it is exactly .5, round towards the nearest even number if (floored % 2 != 0) { // Nearest even is UP return (floored + 1) * sign / factor; } else { // Nearest even is DOWN return floored * sign / factor; } }