Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jun 19, 2020

#210 Additional changes to show correct values

@ghost ghost mentioned this pull request Jun 19, 2020
@ghost ghost changed the title Fix memory, Add Number of Cores and fix block-size on Storage Size Fix memory, Add Mbps/Gbps to Speed, Add Number of Cores and fix block-size on Storage Size Jun 20, 2020
@kesselb
Copy link
Collaborator

kesselb commented Jun 20, 2020

exec("/sbin/sysctl -n hw.physmem hw.pagesize vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count", $return, $status);
if ($status === 0) {
$return = array_map('intval', $return);
if ($return === array_filter($return, 'is_int')) {
return [
'mem_total' => (int)$return[0]/1024,
'mem_free' => (int)$return[1] * ($return[2] + $return[3] + $return[4]) / 1024,
'swap_free' => (isset($swapFree)) ? $swapFree : 'N/A',
'swap_total' => (isset($swapTotal)) ? $swapTotal : 'N/A'
];
}
}

hw.physmem was also used with the old code. It's not correct?

@ghost
Copy link
Author

ghost commented Jun 20, 2020

hw.physmem was also used with the old code. It's not correct?

I suppose it depends on how you want to display the memory in two different situations. The hw.realmem reports the real values of the memory totaled (in my case 64.00 GB). The hw.physmem (63.9 GB in my case) displays the actual available memory that can be used by the system. So these are two different use cases. I don't think either can be considered wrong for their respective use case.

The code in the FreeBSD.php is used to set the memory value in the image below. It does not appear to change any other value.

image

The old code is what sets the memory in the live usage display. FreeBSD.php has no influence on these values. SystemStatistics.php controls this image.

exec("/sbin/sysctl -n hw.physmem hw.pagesize vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count", $return, $status);
if ($status === 0) {
$return = array_map('intval', $return);
if ($return === array_filter($return, 'is_int')) {
return [
'mem_total' => (int)$return[0]/1024,
'mem_free' => (int)$return[1] * ($return[2] + $return[3] + $return[4]) / 1024,
'swap_free' => (isset($swapFree)) ? $swapFree : 'N/A',
'swap_total' => (isset($swapTotal)) ? $swapTotal : 'N/A'
];
}
}

image

@ghost ghost changed the title Fix memory, Add Mbps/Gbps to Speed, Add Number of Cores and fix block-size on Storage Size Fix memory, Add Mbps/Gbps to Speed, Add Number of Cores and fix block-size on Storage/Swap Size Jun 20, 2020
@ghost ghost changed the title Fix memory, Add Mbps/Gbps to Speed, Add Number of Cores and fix block-size on Storage/Swap Size Fix memory, Add Mbps/Gbps to Speed, Add Number of Cores and fix block-size on Storage/Swap Size (FreeBSD) Jun 20, 2020
Copy link
Collaborator

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@kesselb kesselb merged commit 7528cec into nextcloud:master Jun 20, 2020
@VVD
Copy link

VVD commented Jun 21, 2020

Is any possibility to merge it to stable19 branch or even stable18?

@kesselb
Copy link
Collaborator

kesselb commented Jun 21, 2020

Is any possibility to merge it to stable19 branch or even stable18?

No as this a new feature.

@VVD
Copy link

VVD commented Jun 21, 2020

N as this a new feature.

For me it's bug fix - system information was incorrect before this patch.

@kesselb
Copy link
Collaborator

kesselb commented Jun 21, 2020

system information was incorrect before this patch.

To be precise: System information was incorrect before this patch for the unsupported operating system FreeBSD. If that is such a problem for you just disable the serverinfo app ;)

@VVD
Copy link

VVD commented Jun 24, 2020

:-P

Make FreeBSD supported operating system. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants