PG-311: Fix user/system cpu time zero values.

Some queries were taking less than one millisecond to execute, since we
store cpu time values in milliseconds in a float, a value of 0.1 (a tenth
of millisecond) cast to int64 would truncate the fractional part and
the result would be zero.

To fix the problem, the cast to (int64) when calculating the average cpu
time was removed, when updating entry statistics in pgss_update_entry()
function.
pull/183/head
Diego Fronza 2022-02-17 13:07:02 -03:00
parent 25aed955dd
commit 87876010f0
1 changed files with 2 additions and 2 deletions

View File

@ -1359,8 +1359,8 @@ pgss_update_entry(pgssEntry *entry,
}
if (sys_info)
{
e->counters.sysinfo.utime += (int64)(sys_info->utime - e->counters.sysinfo.utime)/e->counters.calls.calls;
e->counters.sysinfo.stime += (int64)(sys_info->stime - e->counters.sysinfo.stime)/e->counters.calls.calls;
e->counters.sysinfo.utime += (sys_info->utime - e->counters.sysinfo.utime)/e->counters.calls.calls;
e->counters.sysinfo.stime += (sys_info->stime - e->counters.sysinfo.stime)/e->counters.calls.calls;
}
if (walusage)
{