Nir Soffer has uploaded a new change for review.

Change subject: misc: Cleaner readspeed
......................................................................

misc: Cleaner readspeed

When checking reading speed from storage, we used to actually read the
data from the dd process into vdsm, just to drop it on the floor. This
makes no sense since we are interested only in the 3 lines of statistics
read from dd stderr.

This patch uses execCmd directly instead of using the generic _readfile
and configure dd to write the data to /dev/null.

Profiling show no significant change in cpu usage, but doing less work
is always better than doing more work.

Change-Id: Ib6145d018a691321976d684a9f355e3eb5252f83
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/storage/misc.py
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/27616/1

diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 12d4d97..4eb56e7 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -224,8 +224,13 @@
     Measures the amount of bytes transferred and the time elapsed
     reading the content of the file/device
     """
-    rc, _, err = _readfile(path, buffersize)
+    cmd = [constants.EXT_DD, "if=%s" % path, "iflag=%s" % DIRECTFLAG,
+           "of=/dev/null"]
 
+    if buffersize:
+        cmd.extend(["bs=%d" % buffersize, "count=1"])
+
+    rc, _, err = execCmd(cmd)
     if rc != 0:
         log.error("Unable to read file '%s'", path)
         raise se.MiscFileReadException(path)


-- 
To view, visit http://gerrit.ovirt.org/27616
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6145d018a691321976d684a9f355e3eb5252f83
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to