]> AND Private Git Repository - Cipher_code.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
authorRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Sat, 17 Jul 2021 07:26:58 +0000 (09:26 +0200)
committerRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Sat, 17 Jul 2021 07:26:58 +0000 (09:26 +0200)
measure_energy_iot/client_tcp4.py
measure_energy_iot/lena2.jpg

index 885451f5ba462a1e6d3643e50b1fa36c3e15c6d9..6485a5dfafc9f447882261ebaebd65a0f92e7847 100644 (file)
@@ -7,7 +7,7 @@ from PIL import Image
 import sys
 from io import BytesIO
 from pathlib import Path
 import sys
 from io import BytesIO
 from pathlib import Path
-
+import numpy as np
 
 HOST = "192.168.0.106"
 PORT = 2345
 
 HOST = "192.168.0.106"
 PORT = 2345
@@ -15,7 +15,7 @@ PORT = 2345
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 s.connect((HOST, PORT))
 
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 s.connect((HOST, PORT))
 
-nb_times=10
+nb_times=100
 
 quality=int(sys.argv[1])
 print("quality ",quality)
 
 quality=int(sys.argv[1])
 print("quality ",quality)
@@ -86,11 +86,10 @@ with s:
     sbuf = buffer.Buffer(s)
 
 
     sbuf = buffer.Buffer(s)
 
 
-    elapsed_time=0
-    t=time.time()
+    elapsed_time=[]
     file_name="lena.bmp"
     for i in range(nb_times):
     file_name="lena.bmp"
     for i in range(nb_times):
-#        print(file_name)
+        t=time.time()
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
@@ -98,15 +97,14 @@ with s:
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
-#        print('File Sent')
-    elapsed_time += time.time() - t    
-    print("send bmp ",elapsed_time/nb_times)
+        elapsed_time.append(time.time() - t)
+
+    print("send bmp mean",np.mean(elapsed_time), " std ",np.std(elapsed_time))
 
 
-    elapsed_time=0
-    t=time.time()
+    elapsed_time=[]
     file_name="lena2.jpg"
     for i in range(nb_times):
     file_name="lena2.jpg"
     for i in range(nb_times):
#       print(file_name)
       t=time.time()
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
@@ -114,15 +112,15 @@ with s:
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
- #       print('File Sent')
-    elapsed_time += time.time() - t    
-    print("send noscale jpg ",elapsed_time/nb_times)
+        elapsed_time.append(time.time() - t)
+
+    print("send noscale jpg   mean",np.mean(elapsed_time), " std ",np.std(elapsed_time))
+
+    elapsed_time=[]
 
 
-    elapsed_time=0
-    t=time.time()
     file_name="lena3.jpg"
     for i in range(nb_times):
     file_name="lena3.jpg"
     for i in range(nb_times):
#       print(file_name)
       t=time.time()
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
         sbuf.put_utf8(file_name)
 
         file_size = os.path.getsize(file_name)
@@ -130,7 +128,7 @@ with s:
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
 
         with open(file_name, 'rb') as f:
             sbuf.put_bytes(f.read())
#       print('File Sent')
-    elapsed_time += time.time() - t    
-    print("send scale 4 jpg ",elapsed_time/nb_times)
       elapsed_time.append(time.time() - t)
+
+    print("send scale 4 jpg  mean",np.mean(elapsed_time), " std ",np.std(elapsed_time))
 
 
index 866507b78bbd50ea25e95d383a3b5504d990ce78..cef42efdd1ebde96ebf796cd1a54437f330da85b 100644 (file)
Binary files a/measure_energy_iot/lena2.jpg and b/measure_energy_iot/lena2.jpg differ