Dan Kenigsberg has submitted this change and it was merged.

Change subject: profile: Introduce profile decorator
......................................................................


profile: Introduce profile decorator

The profile decorator can be used for profiling certain code path, where
whole application profile is not needed.

To profile a function, decorate it:

    from profile import profile
    import slowmodule
    ...
    @profile('expensive_stuff.prof')
    def test_expensive_stuff():
        slowmodule.do_expensive_stuff()

The recorded profile will include all threads running or started while
my_function was executed.

Note that you cannot use application wide profile and function profile
in the same time. To prevent confusion, a profile.Error is raised if you
try to start a profile while the profiler is already running.

Change-Id: I2bc861832bbbda67937b5663f6cfbc1a54bfbf7d
Signed-off-by: Nir Soffer <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/27389
Reviewed-by: Antoni Segura Puimedon <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M lib/vdsm/profile.py
M tests/profileTests.py
2 files changed, 99 insertions(+), 13 deletions(-)

Approvals:
  Nir Soffer: Verified
  Antoni Segura Puimedon: Looks good to me, but someone else must approve
  Dan Kenigsberg: Looks good to me, approved



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2bc861832bbbda67937b5663f6cfbc1a54bfbf7d
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to