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 <nsof...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/1267851
Reviewed-on: https://gerrit.ovirt.org/29685
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <from...@redhat.com>
Reviewed-by: Federico Simoncelli <fsimo...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/47039
Tested-by: Francesco Romani <from...@redhat.com>
Reviewed-by: Dan Kenigsberg <dan...@redhat.com>
Continuous-Integration: Francesco Romani <from...@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 <from...@redhat.com>
Gerrit-Reviewer: Amit Aviram <aavi...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to