I there a way to calculate memory utilization of python program?

239 views Asked by At

I am working on new encryption algorithm. And as you know there are some parameters to check if any algorithm is efficient or not. I have done performance check "Execution Time" on the algorithm and the result is amazing. So, I hopefully ask you to help me on how to find the memory utilization or CPU utilization by giving me the most useful methods. I use python.

   if __name__ == "__main__": 
   while True:
   mem1 = (psutil.virtual_memory().available)

   input_text = (randomString(4096))
   encryption_keyV =(randomString(32))
   encryptionV = vernamCipherFunction(input_text, encryption_keyV);
   
   input_key = random.randint(2,9)
   encryption = encryptRailFence(encryptionV, input_key);
   
   decryption = decryptRailFence(encryption, input_key);
   
   decryptionV = vernamCipherFunction(decryption, encryption_keyV);

   
   mem2 = (psutil.virtual_memory().available)
   mem = (mem1 - mem2)/1024

print ("Memory Usage\t", mem) ''' I have tried to get the available RAM memory before and after the execution and subtract them to get some answers which I am not sure if they are right..

0

There are 0 answers