Change in vdsm[master]: vmstats: reorder the calculations

fromani at redhat.com fromani at redhat.com
Wed Mar 2 11:03:56 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: vmstats: reorder the calculations
......................................................................

vmstats: reorder the calculations

reorder the way we do the calculation such as there is no
difference in the happy path, but we could be able to add one key
if just the other is missing.

Change-Id: I6875ca2e55ac107498ee130062c665749f7f5b60
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/54248/1

diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index 8c8adc8..3223894 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -205,24 +205,25 @@
 
     with _skip_if_missing_stats(vm_obj):
         if_stats['rx'] = str(end_sample['net.%d.rx.bytes' % end_index])
-        if_stats['tx'] = str(end_sample['net.%d.tx.bytes' % end_index])
         rx_delta = (
             end_sample['net.%d.rx.bytes' % end_index] -
             start_sample['net.%d.rx.bytes' % start_index]
         )
+        if_rx_bytes = (100.0 *
+                       (rx_delta % 2 ** 32) /
+                       interval / if_speed / _MBPS_TO_BPS)
+        if_stats['rxRate'] = '%.1f' % if_rx_bytes
+
+        if_stats['tx'] = str(end_sample['net.%d.tx.bytes' % end_index])
         tx_delta = (
             end_sample['net.%d.tx.bytes' % end_index] -
             start_sample['net.%d.tx.bytes' % start_index]
         )
 
-        if_rx_bytes = (100.0 *
-                       (rx_delta % 2 ** 32) /
-                       interval / if_speed / _MBPS_TO_BPS)
         if_tx_bytes = (100.0 *
                        (tx_delta % 2 ** 32) /
                        interval / if_speed / _MBPS_TO_BPS)
 
-        if_stats['rxRate'] = '%.1f' % if_rx_bytes
         if_stats['txRate'] = '%.1f' % if_tx_bytes
 
     if_stats['sampleTime'] = monotonic_time()


-- 
To view, visit https://gerrit.ovirt.org/54248
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6875ca2e55ac107498ee130062c665749f7f5b60
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list