Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python time function duration and memory usage

import time
import resource 

time_start = time.perf_counter()
# insert code here ...
time_elapsed = (time.perf_counter() - time_start)
memMb=resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/1024.0/1024.0
print ("%5.1f secs %5.1f MByte" % (time_elapsed,memMb))

# sample output:
# 2.3 secs 140.8 MByte
Comment

PREVIOUS NEXT
Code Example
Python :: how to check if two columns match in pandas 
Python :: python webdriver element not interactable 
Python :: python rickroll code 
Python :: python game over screen 
Python :: pandas add column from list 
Python :: plt.figure resize 
Python :: dataframe to dictionary without index 
Python :: python sort list in reverse 
Python :: Static Assets in Django 
Python :: python datetime subtract seconds 
Python :: numpy apply log to array 
Python :: model.predict([x_test]) error 
Python :: python last element of list 
Python :: python truncate to integer 
Python :: how to make square shape python 
Python :: minute range python 
Python :: python live radio 
Python :: python strftime utc offset 
Python :: rename columns in dataframe 
Python :: pandas dataframe macd 
Python :: python create a matrix with one in diagonal 
Python :: run sql query on pandas dataframe 
Python :: how to pick a random number in a list python 
Python :: roll longitude about zero 
Python :: youtube-dl python download to specific folder 
Python :: python socket recv timeout 
Python :: password combination python 
Python :: pandas print full dataframe 
Python :: sqlalchemy lock row 
Python :: how to sort in greatest to least python 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =