changeset 200:f42c10dab862

drop cache
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jan 2019 16:22:48 +0100
parents dd05820b9f44
children c92e7191c912
files PerfsDb/Test.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/PerfsDb/Test.py	Tue Jan 08 15:38:34 2019 +0100
+++ b/PerfsDb/Test.py	Tue Jan 08 16:22:48 2019 +0100
@@ -1,3 +1,4 @@
+import os
 import time
 import statistics
 from orthancRestApi import OrthancClient
@@ -58,7 +59,13 @@
 
         for i in range(0, self.repeatCount):
             self.beforeEach()
-            
+
+            try:
+                with open('/proc/sys/vm/drop_caches', 'w') as f:
+                    f.write('3')
+            except:
+                print('Please run this script as root to be able to flush the disk cache, and have reproducible runtimes')
+
             startTime = time.time()
             self.test()
             endTime = time.time()
@@ -77,4 +84,4 @@
             avg = self.averageTimeInMs,
             min=self.minTimeInMs,
             max=self.maxTimeInMs
-        )
\ No newline at end of file
+        )