select
DATE_TRUNC('hour',p.ts) as ts_hourcount(distinct p.obj_uuid) as unique_vm_cntcount(distinct p.obj_uuid) FILTER (WHERE p.value=1) as unique_vm_cnt_onround((sum(p.value)/12.)::numeric,1) as vm_hround((sum(p.value)/12.*24.19)::numeric,2) as cost_wo_diskround((count(distinct obj_id)*8.00)::numeric,2) as disk_costround((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')#
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;
}
}