X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/1675b71b9488fd8b62558d9af2e30b4f9d150849..1c788dbaab3c18d2541c516aaacbd3110142f3f9:/measure_energy_iot/image_compression.py?ds=inline diff --git a/measure_energy_iot/image_compression.py b/measure_energy_iot/image_compression.py index 6e99203..03aafcd 100644 --- a/measure_energy_iot/image_compression.py +++ b/measure_energy_iot/image_compression.py @@ -10,28 +10,27 @@ print("quality ",quality) im=Image.open("lena.jpg") elapsed_time=0 +t = time.time() +for i in range(10): -for i in range(100): - t = time.process_time() im.save("lena2.jpg",quality=quality) - elapsed_time += time.process_time() - t +elapsed_time += time.time() - t print("time pil",elapsed_time) - elapsed_time=0 -for i in range(100): - t = time.process_time() +t = time.time() +for i in range(10): + im2=im.resize((256, 256)) im2.save("lena3.jpg",quality=quality) - elapsed_time += time.process_time() - t - +elapsed_time += time.time() - t print("time resize + pil",elapsed_time) - +""" img = cv2.imread('lena.jpg') @@ -54,22 +53,24 @@ for i in range(100): elapsed_time += time.process_time() - t print("time resize + cv2",elapsed_time) +""" + elapsed_time=0 +t = time.time() for i in range(10): - t = time.process_time() - proc=subprocess.Popen("scp lena4.jpg bilbo:/tmp", shell=True) - proc.wait() - elapsed_time += time.process_time() - t + proc=subprocess.Popen("scp lena2.jpg bilbo.iut-bm.univ-fcomte.fr:/tmp", shell=True) + proc.wait() +elapsed_time += time.time() - t print("ssh normal",elapsed_time) elapsed_time=0 +t = time.time() for i in range(10): - t = time.process_time() - proc=subprocess.Popen("scp lena5.jpg bilbo:/tmp", shell=True) - proc.wait() - elapsed_time += time.process_time() - t + proc=subprocess.Popen("scp lena3.jpg bilbo.iut-bm.univ-fcomte.fr:/tmp", shell=True) + proc.wait() +elapsed_time += time.time() - t print("ssh reduce",elapsed_time)