Skip to content

Commit

Permalink
Merge pull request #13050 from dsblank/patch-6
Browse files Browse the repository at this point in the history
Make Ipython.utils.timing work with jupyterlite
  • Loading branch information
Carreau committed Jul 31, 2021
2 parents be4887f + f2bc813 commit 9c2eee6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion IPython/utils/timing.py
Expand Up @@ -23,6 +23,11 @@
# If possible (Unix), use the resource module instead of time.clock()
try:
import resource
except ImportError:
resource = None

# Some implementations (like jyputerlite) don't have getrusage
if resource is not None and hasattr(resource, "getrusage"):
def clocku():
"""clocku() -> floating point number
Expand Down Expand Up @@ -56,7 +61,9 @@ def clock2():
Similar to clock(), but return a tuple of user/system times."""
return resource.getrusage(resource.RUSAGE_SELF)[:2]
except ImportError:


else:
# There is no distinction of user/system time under windows, so we just use
# time.perff_counter() for everything...
clocku = clocks = clock = time.perf_counter
Expand Down

0 comments on commit 9c2eee6

Please sign in to comment.