X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/c92009fe1efa17ab89dea62611b3c53f3bdfdb5a..0af0ceef5266448f578adebfe070760388ed1b01:/measure_energy_iot/client_tcp4.py?ds=sidebyside diff --git a/measure_energy_iot/client_tcp4.py b/measure_energy_iot/client_tcp4.py index 0944d1e..13f7208 100644 --- a/measure_energy_iot/client_tcp4.py +++ b/measure_energy_iot/client_tcp4.py @@ -13,7 +13,7 @@ PORT = 2345 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) -nb_times=100 +nb_times=20 quality=int(sys.argv[1]) print("quality ",quality) @@ -27,14 +27,14 @@ elapsed_time=0 t = time.time() for i in range(nb_times): buf = BytesIO() - im.save(buf, "JPEG", quality=quality) + im.save(buf, "BMP", quality=quality) elapsed_time += time.time() - t print("time in memory bmp",elapsed_time/nb_times) - +""" im=Image.open("lena.jpg") elapsed_time=0 @@ -45,16 +45,18 @@ for i in range(nb_times): elapsed_time += time.time() - t print("time bmp",elapsed_time/nb_times) - +""" im=Image.open("lena.jpg") elapsed_time=0 +im.save("lena2.jpg",quality=quality) t = time.time() for i in range(nb_times): - - im.save("lena2.jpg",quality=quality) + buf = BytesIO() + im.save(buf, "JPEG", quality=quality) + elapsed_time += time.time() - t print("time noscale jpg",elapsed_time/nb_times) @@ -62,10 +64,14 @@ print("time noscale jpg",elapsed_time/nb_times) elapsed_time=0 +im2=im.resize((256, 256)) +im2.save("lena3.jpg",quality=quality) t = time.time() for i in range(nb_times): im2=im.resize((256, 256)) - im2.save("lena3.jpg",quality=quality) + buf = BytesIO() + im2.save(buf, "JPEG", quality=quality) + elapsed_time += time.time() - t print("time resize + pil",elapsed_time/nb_times)