Skip to content

Commit

Permalink
Merge pull request #1260 from gyorb/fix-timer
Browse files Browse the repository at this point in the history
fix timeit profiler
  • Loading branch information
csordasmarton authored Dec 14, 2017
2 parents 116d1e6 + 224142b commit bac5ab8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libcodechecker/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import cProfile
import pstats

from functools import wraps

try:
from StringIO import StringIO
except ImportError:
Expand Down Expand Up @@ -61,10 +63,14 @@ def release_wrapper(*args, **kwargs):
res = function(*args, **kwargs)
return res

if LoggerFactory.get_log_level() == logger.DEBUG:
return debug_wrapper
else:
return release_wrapper
@wraps(function)
def wrapper(*args, **kwargs):
if LoggerFactory.get_log_level() == logger.DEBUG:
return debug_wrapper(*args, **kwargs)
else:
return release_wrapper(*args, **kwargs)

return wrapper


def profileit(function):
Expand Down

0 comments on commit bac5ab8

Please sign in to comment.