Change in vdsm[ovirt-3.5]: utils: Add stopwatch for timing operations

fromani at redhat.com fromani at redhat.com
Wed Oct 21 20:47:40 UTC 2015


Francesco Romani has submitted this change and it was merged.

Change subject: utils: Add stopwatch for timing operations
......................................................................


utils: Add stopwatch for timing operations

stopwatch is a context manager that make it easy to time block of code
that may take significant amount of time.

Example:

    with stopwatch("Resized multipath map %r" % name):
        _resize_map(name)

Will log a debug message:

    Resized multipath map 'dm-42': 0.12 seconds

If debug log level is not enabled, this contents manager does nothing.
The log can be disabled by disabling the vds.stopwatch logger.

Change-Id: Ie0a60538936dbb4596243abe9d731779fd9efb47
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Bug-Url: https://bugzilla.redhat.com/1267851
Reviewed-on: https://gerrit.ovirt.org/29685
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/47039
Tested-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Continuous-Integration: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/utils.py
M tests/utilsTests.py
2 files changed, 65 insertions(+), 0 deletions(-)

Approvals:
  Nir Soffer: Looks good to me, but someone else must approve
  Dan Kenigsberg: Looks good to me, approved
  Francesco Romani: Verified; Passed CI tests



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0a60538936dbb4596243abe9d731779fd9efb47
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list