Francesco Romani has uploaded a new change for review.

Change subject: sampling: micro-optimization
......................................................................

sampling: micro-optimization

make timestamp update faster.

Change-Id: Id4361bf4ccae67be3a9e42a0d3368e1e1c246393
TODO: benchmark this.
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M lib/vdsm/virt/sampling.py
1 file changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/61311/1

diff --git a/lib/vdsm/virt/sampling.py b/lib/vdsm/virt/sampling.py
index 4c34e13..4595701 100644
--- a/lib/vdsm/virt/sampling.py
+++ b/lib/vdsm/virt/sampling.py
@@ -452,17 +452,14 @@
             if monotonic_ts >= last_sample_time:
                 self._samples.append(bulk_stats)
                 self._last_sample_time = monotonic_ts
-
-                self._update_ts(bulk_stats, monotonic_ts)
+                # FIXME: this is expected to be costly performance-wise.
+                self._vm_last_timestamp.update(
+                    (vm_id, monotonic_ts) for vm_id in bulk_stats
+                )
             else:
                 self._log.warning(
                     'dropped stale old sample: sampled %f stored %f',
                     monotonic_ts, last_sample_time)
-
-    def _update_ts(self, bulk_stats, monotonic_ts):
-        # FIXME: this is expected to be costly performance-wise.
-        for vmid in bulk_stats:
-            self._vm_last_timestamp[vmid] = monotonic_ts
 
 
 stats_cache = StatsCache()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4361bf4ccae67be3a9e42a0d3368e1e1c246393
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to