Change in vdsm[master]: utils: Add stopwatch for timing operations

danken at redhat.com danken at redhat.com
Sat Jul 4 09:48:03 UTC 2015


Dan Kenigsberg 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>
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>
---
M lib/vdsm/utils.py
M tests/utilsTests.py
2 files changed, 46 insertions(+), 0 deletions(-)

Approvals:
  Nir Soffer: Verified
  Federico Simoncelli: Looks good to me, approved
  Jenkins CI: Passed CI tests
  Francesco Romani: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0a60538936dbb4596243abe9d731779fd9efb47
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list