incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1366968 - in /incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark: Filter.java GenerateReports.java
Date Mon, 30 Jul 2012 00:27:48 GMT
Author: liuzhe
Date: Mon Jul 30 00:27:48 2012
New Revision: 1366968

URL: http://svn.apache.org/viewvc?rev=1366968&view=rev
Log:
#120394# - Modify PVT script to support Linux System 

Modified:
    incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
    incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java

Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java?rev=1366968&r1=1366967&r2=1366968&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
(original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
Mon Jul 30 00:27:48 2012
@@ -32,40 +32,94 @@ import static org.openoffice.test.vcl.Te
 import static testlib.gui.AppUtil.*;
 import static testlib.gui.UIMap.*;
 
+import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
 
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.openoffice.test.OpenOffice;
 import org.openoffice.test.common.Testspace;
+import org.openoffice.test.common.SystemUtil;
 
-public class Filter {
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
 
+public class Filter {
+//	@Rule
+	
+	public String counterOutput = null;
+	private String pid = null;
+	private Timer timer = new Timer();
+	
 	@Before
-	public void setUp(){
+	public void setUp() throws FileNotFoundException{
+		
+		OpenOffice.killAll();
 		app.start();
+		String processSoffice = null;
+		if(SystemUtil.isWindows())
+		{
+			processSoffice = ".*soffice\\.exe.*";
+		}
+		else 
+		{
+			processSoffice = ".*soffice\\.bin.*";
+		}
+		HashMap<String, Object> proccessInfo = SystemUtil.findProcess(processSoffice);
+		pid = (String)proccessInfo.get("pid");
 	}
 	
 	@Test
 	public void pvtFilter()
 	{
-		String pvt_result_path = Testspace.getPath("output/pvt_filter_results.txt");
-		String counterLists =  Testspace.getPath("data/pvt_benchmark/perfmon/counterlist.txt");
 		String counterOutput = Testspace.getPath("output/output_perfmon");
-		String createCounters = Testspace.getPath("data/pvt_benchmark/perfmon/createCounters.bat");
-		String stopCounters = Testspace.getPath("data/pvt_benchmark/perfmon/stopCounters.bat");
-		
-		Testspace.prepareData("pvt_benchmark/perfmon/counterlist.txt");
-		Testspace.prepareData("pvt_benchmark/perfmon/createCounters.bat");
-		Testspace.prepareData("pvt_benchmark/perfmon/stopCounters.bat");
+		String pvt_result_path = Testspace.getPath("output/pvt_filter_results.txt");
 		Testspace.prepareData("pvt_benchmark/output_start.ods", "output/output_start.ods");
 		
+		
 		try {
-			String []cmdargs_start = {"cmd.exe", "/C", "start", createCounters, counterOutput, counterLists};
-			java.lang.Runtime.getRuntime().exec(cmdargs_start);
-			sleep(5);
+			if(SystemUtil.isWindows())
+			{
+				String counterLists =  Testspace.getPath("data/pvt_benchmark/perfmon/counterlist.txt");
+				String createCounters = Testspace.getPath("data/pvt_benchmark/perfmon/createCounters.bat");
+				
+				Testspace.prepareData("pvt_benchmark/perfmon/counterlist.txt");
+				Testspace.prepareData("pvt_benchmark/perfmon/createCounters.bat");
+
+				String []cmdargs_start = {"cmd.exe", "/C", "start", createCounters, counterOutput, counterLists};
+				java.lang.Runtime.getRuntime().exec(cmdargs_start);
+				sleep(5);
+			}
+			else
+			{
+				final FileWriter counterOut = new FileWriter(counterOutput);
+				counterOut.write("Time,Memory(KB),CPU(%)");
+				
+				timer.schedule(new TimerTask(){
+					public void run(){
+						HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
+						String record = System.currentTimeMillis() + "," + perfData.get("rss") + "," + perfData.get("pcpu");
+						try {
+							counterOut.write(record + System.getProperty("line.separator"));
+							counterOut.flush();
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						}
+					}
+				}, 0, 1000);
+			}
+			
 			FileWriter out = new FileWriter(pvt_result_path);
 			out.write("Test Start: " + System.getProperty("line.separator"));
+			
+			HashMap<String, Object> perfData = SystemUtil.getProcessPerfData(pid);
+			
 			for(int i = 0; i < 8; i++)
 			{
 				System.out.println("This is the " + i + " time");
@@ -76,76 +130,87 @@ public class Filter {
 //				out.write("New Spreadsheet Result: " + perfNew("Spreadsheet") + System.getProperty("line.separator"));
 //				out.flush();
 				
-				out.write("Plain ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p_odf1.2.odt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p_odf1.2.odt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p.doc")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p.doc")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p_odf1.2.odt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p_odf1.2.odt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p.doc")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p.doc")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p_odf1.2.odp")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p_odf1.2.odp")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p.ppt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p.ppt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p_odf1.2.odp")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p_odf1.2.odp")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p.ppt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p.ppt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell.xls")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell.xls")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell.xls")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell.xls")
+ System.getProperty("line.separator"));
 				out.flush();
 				
-				out.write("Plain ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p_odf1.2.odt",
110) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p_odf1.2.odt",
110) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p.doc",
110) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p.doc",
110) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p_odf1.2.odt",
100) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p_odf1.2.odt",
100) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p.doc",
95) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p.doc",
95) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p_odf1.2.odp",
50) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p_odf1.2.odp",
50) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p.ppt",
50) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p.ppt",
50) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p_odf1.2.odp",
51) + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p_odf1.2.odp",
51) + System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p.ppt",
51) + System.getProperty("line.separator"));
+				sleep(5);
+				out.write(getTime() + "," + "Complex PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p.ppt",
51) + System.getProperty("line.separator"));
 				out.flush();
 				
-				out.write("Plain ODT Save Result: " + perfSave("pvt_benchmark/sw_plain_120p_odf1.2.odt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODT Save Result: " + perfSave("pvt_benchmark/sw_plain_120p_odf1.2.odt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain DOC Save Result: " + perfSave("pvt_benchmark/sw_plain_120p.doc") + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain DOC Save Result: " + perfSave("pvt_benchmark/sw_plain_120p.doc")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODT Save Result: " + perfSave("pvt_benchmark/sw_complex_100p_odf1.2.odt")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODT Save Result: " + perfSave("pvt_benchmark/sw_complex_100p_odf1.2.odt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex DOC Save Result: " + perfSave("pvt_benchmark/sw_complex_100p.doc")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex DOC Save Result: " + perfSave("pvt_benchmark/sw_complex_100p.doc")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain ODP Save Result: " + perfSave("pvt_benchmark/sd_plain_50p_odf1.2.odp")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODP Save Result: " + perfSave("pvt_benchmark/sd_plain_50p_odf1.2.odp")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain PPT Save Result: " + perfSave("pvt_benchmark/sd_plain_50p.ppt") + System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain PPT Save Result: " + perfSave("pvt_benchmark/sd_plain_50p.ppt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODP Save Result: " + perfSave("pvt_benchmark/sd_complex_51p_odf1.2.odp")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODP Save Result: " + perfSave("pvt_benchmark/sd_complex_51p_odf1.2.odp")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex PPT Save Result: " + perfSave("pvt_benchmark/sd_complex_51p.ppt")
+ System.getProperty("line.separator"));
+				sleep(5);
+				out.write(getTime() + "," + "Complex PPT Save Result: " + perfSave("pvt_benchmark/sd_complex_51p.ppt")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain ODS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain ODS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Plain XLS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell.xls")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Plain XLS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell.xls")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex ODS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex ODS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods")
+ System.getProperty("line.separator"));
 				out.flush();
-				out.write("Complex XLS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell.xls")
+ System.getProperty("line.separator"));
+				out.write(getTime() + "," + "Complex XLS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell.xls")
+ System.getProperty("line.separator"));
 				out.flush();		
 			}
 			out.close();
-			String []cmdargs_end = {"cmd.exe", "/C", "start", stopCounters};
-			java.lang.Runtime.getRuntime().exec(cmdargs_end);
+			if(SystemUtil.isWindows())
+			{
+				String stopCounters = Testspace.getPath("data/pvt_benchmark/perfmon/stopCounters.bat");
+				Testspace.prepareData("pvt_benchmark/perfmon/stopCounters.bat");
+				String []cmdargs_end = {"cmd.exe", "/C", "start", stopCounters};
+				java.lang.Runtime.getRuntime().exec(cmdargs_end);
+			}
+			else
+			{
+				timer.cancel();
+			}
 			
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
@@ -158,6 +223,14 @@ public class Filter {
 		
 	}
 	
+	public String getTime() {
+		
+		Date d=new Date();
+		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+		String date=sdf.format(d);
+		return date;
+	}
+
 	public long perfNew(String fileType)
 	{
 		System.out.println("New " + fileType);
@@ -288,6 +361,10 @@ public class Filter {
 		tr = System.currentTimeMillis();
 		while(true)
 		{
+			while(!statusbar("FWK_HID_STATUSBAR").exists())
+			{
+				;
+			}
 			if(getLoadedPage(fileName) >= destPage)
 			{
 				break;
@@ -295,7 +372,7 @@ public class Filter {
 		}
 		tr = System.currentTimeMillis() - tr;
 		sleep(5);
-		System.out.println("Load Finish Time: " + tr);
+//		System.out.println("Load Finish Time: " + tr);
 		
 		if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
 		{

Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java?rev=1366968&r1=1366967&r2=1366968&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java
(original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java
Mon Jul 30 00:27:48 2012
@@ -62,10 +62,11 @@ public class GenerateReports {
 			String testScenario;
 			String testResult;
 			
-			while(line != null)
+			while((line = in.readLine())!= null)
 			{
-				testScenario = line.substring(0, line.indexOf(":"));
-				testResult = line.substring(line.indexOf(":") + 2);
+				String temp = line.substring(9);
+				testScenario = temp.substring(0, temp.indexOf(":"));
+				testResult = temp.substring(temp.indexOf(":") + 2);
 				System.out.println(testScenario + " " + testResult);
 				if(map.containsKey(testScenario))
 				{
@@ -77,7 +78,7 @@ public class GenerateReports {
 					array.add(testResult);
 					map.put(testScenario, array);
 				}
-				line = in.readLine();
+//				line = in.readLine();
 			}
 			
 			



Mime
View raw message