Strabon

changeset 775:07471ffabaca temporals

fix (it runs!)
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Fri Dec 07 20:11:40 2012 +0200 (2012-12-07)
parents 527cfbdcf5a3
children d6259e17e93d
files runtime/src/main/java/eu/earthobservatory/utils/ExperimentsReal.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/utils/ExperimentsReal.java	Fri Dec 07 19:16:41 2012 +0200
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/ExperimentsReal.java	Fri Dec 07 20:11:40 2012 +0200
     1.3 @@ -74,20 +74,35 @@
     1.4  				long warmtime = 0;
     1.5  				long results = 0;
     1.6  
     1.7 +                                String script = Main.class.getResource("/pg_restart_clear_caches.sh").toString();
     1.8 +                                System.out.println("main: " + script);
     1.9 +                                int start = script.indexOf("/");
    1.10 +                                int end = script.lastIndexOf("/");
    1.11 +                                script = script.substring(start, end);
    1.12 +                                System.out.println("main: " + script);
    1.13 +                                end = script.lastIndexOf("/");
    1.14 +                                script = script.substring(0, end);
    1.15 +                                System.out.println("main: " + script);
    1.16 +                                String script_file = script + File.separator + "classes"  + File.separator + "pg_restart_clear_caches.sh"; 
    1.17 +                                System.out.println("script_file: " + script_file);
    1.18 +
    1.19 +
    1.20  				// cold runs
    1.21  				long[][] coldruns = new long[repetitions][4];
    1.22  				for (int i = 0; i < repetitions; i++) {
    1.23 +					System.out.println("Starting Strabon...");
    1.24  					strabon = new Strabon(db, user, passwd, port, host, true);
    1.25 +                                        System.out.println("Strabon started. Sending query...");
    1.26  					coldruns[i] = (long[])run("cold", queryString, i);
    1.27 +                                        System.out.println("Evaluated query. Closing Strabon...");
    1.28  					strabon.close();
    1.29 -					strabon = null;
    1.30 -					
    1.31 -					URL script = Main.class.getResource("/pg_restart_clear_caches.sh");
    1.32 -					String restart_script = script.toString().substring(5);					
    1.33 -					Process p = Runtime.getRuntime().exec(restart_script);
    1.34 +                                        System.out.println("Strabon closed. Restarting postgres...");
    1.35 +					Process p = Runtime.getRuntime().exec(script_file);
    1.36  					p.waitFor();
    1.37 +                                        System.out.println("Postgres restarted. Cleaning...");
    1.38  					System.gc();
    1.39  					Thread.sleep(5000);
    1.40 +                                        System.out.println("Clean complete. Iteration complete.");
    1.41  				}
    1.42  
    1.43  				//Strabon strabon = new Strabon(db, user, passwd, port, host, true, cachepath);
    1.44 @@ -104,7 +119,6 @@
    1.45  				}
    1.46  
    1.47  				strabon.close();
    1.48 -				strabon = null;
    1.49  
    1.50  				// sort results
    1.51  				SortedSet<Long> coldtimes = new TreeSet<Long>();