Author: liuzhe
Date: Tue Jul 17 01:40:18 2012
New Revision: 1362331
URL: http://svn.apache.org/viewvc?rev=1362331&view=rev
Log:
#120289# - Performance test patch
Patch by: Liu Yi Xuan ([email protected])
Review by: Liu Zhe
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/output_start.ods
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/counterlist.txt
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/createCounters.bat
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/stopCounters.bat
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell.xls
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell.xls
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p.ppt
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p_odf1.2.odp
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p.ppt
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p_odf1.2.odp
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p.doc
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p_odf1.2.odt
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p.doc
(with props)
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p_odf1.2.odt
(with props)
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/Filter.java
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/GenerateReports.java
Added: incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/output_start.ods
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/output_start.ods?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/output_start.ods
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/counterlist.txt
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/counterlist.txt?rev=1362331&view=auto
==============================================================================
---
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/counterlist.txt
(added)
+++
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/counterlist.txt
Tue Jul 17 01:40:18 2012
@@ -0,0 +1,12 @@
+;System
+\Memory\Available Bytes
+\Memory\Page Reads/sec
+\Memory\Pages Input/sec
+\PhysicalDisk(_Total)\Disk Read Bytes/sec
+\PhysicalDisk(_Total)\Disk Reads/sec
+;Process(soffice.bin, symphony.exe, java.exe)
+\Process(soffice.bin)\% Processor Time
+\Process(soffice.bin)\Handle Count
+\Process(soffice.bin)\Private Bytes
+\Process(soffice.bin)\Thread Count
+\Process(soffice.bin)\Working Set
\ No newline at end of file
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/createCounters.bat
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/createCounters.bat?rev=1362331&view=auto
==============================================================================
---
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/createCounters.bat
(added)
+++
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/createCounters.bat
Tue Jul 17 01:40:18 2012
@@ -0,0 +1,6 @@
+logman stop pvt
+logman delete counter pvt
+logman create counter pvt -cf %2
+logman update pvt -si 10 -f csv -o %1
+logman start pvt
+exit
\ No newline at end of file
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/stopCounters.bat
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/stopCounters.bat?rev=1362331&view=auto
==============================================================================
---
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/stopCounters.bat
(added)
+++
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/perfmon/stopCounters.bat
Tue Jul 17 01:40:18 2012
@@ -0,0 +1 @@
+logman stop pvt
\ No newline at end of file
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell.xls
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell.xls?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell.xls
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell.xls?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell.xls
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p.ppt
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p.ppt?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p.ppt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p_odf1.2.odp
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p_odf1.2.odp?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_complex_51p_odf1.2.odp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p.ppt
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p.ppt?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p.ppt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p_odf1.2.odp
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p_odf1.2.odp?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sd_plain_50p_odf1.2.odp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p.doc
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p.doc?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p.doc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p_odf1.2.odt
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p_odf1.2.odt?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_complex_100p_odf1.2.odt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p.doc
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p.doc?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p.doc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p_odf1.2.odt
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p_odf1.2.odt?rev=1362331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/ooo/trunk/main/test/testoo/data/pvt_benchmark/sw_plain_120p_odf1.2.odt
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/Filter.java
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/Filter.java?rev=1362331&view=auto
==============================================================================
---
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/Filter.java
(added)
+++
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/Filter.java
Tue Jul 17 01:40:18 2012
@@ -0,0 +1,449 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+
+/**
+ *
+ */
+
+
+package testcase.performance.benchmark;
+
+import static org.openoffice.test.vcl.Tester.*;
+import static testlib.AppUtil.*;
+import static testlib.UIMap.*;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.Testspace;
+
+public class Filter {
+
+ @Before
+ public void setUp(){
+ app.start();
+ }
+
+ @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");
+ 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);
+ FileWriter out = new FileWriter(pvt_result_path);
+ out.write("Test Start: " +
System.getProperty("line.separator"));
+ for(int i = 0; i < 8; i++)
+ {
+ System.out.println("This is the " + i + "
time");
+// out.write("New Document Result: " +
perfNew("Text Document") + System.getProperty("line.separator"));
+// out.flush();
+// out.write("New Presentation Result: " +
perfNew("Presentation") + System.getProperty("line.separator"));
+// out.flush();
+// 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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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.flush();
+ out.write("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);
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ GenerateReports genReport = new GenerateReports();
+ genReport.computeResults(pvt_result_path);
+
+ }
+
+ public long perfNew(String fileType)
+ {
+ System.out.println("New " + fileType);
+ startcenter.menuItem("File->New->" + fileType).select();
+// startcenter.menuItem("File->New->Spreadsheet").select();
+ long tr = System.currentTimeMillis();
+// System.out.println("1: " + tr);
+ while(true)
+ {
+ if(fileType.equals("Text Document"))
+ {
+ if(writer.exists())
+ {
+ break;
+ }
+ }
+
+// else{
+ if(fileType.equals("Presentation"))
+ {
+// System.out.println("2: " +
System.currentTimeMillis());
+ if(impress.exists())
+ {
+// System.out.println("3: " +
System.currentTimeMillis());
+ break;
+ }
+ }
+// else
+// {
+ if(calc.exists())
+ {
+ break;
+ }
+// }
+// }
+
+ }
+// System.out.println("4: " + System.currentTimeMillis());
+ tr = System.currentTimeMillis() - tr;
+
+ if(fileType.equals("Text Document"))
+ {
+ writer.menuItem("File->Close").select();
+ }
+
+ if(fileType.equals("Presentation"))
+ {
+ impress.menuItem("File->Close").select();
+ }
+
+ if(fileType.equals("Spreadsheet"))
+ {
+ calc.menuItem("File->Close").select();
+ }
+
+ return tr;
+ }
+
+ public long perfLoadShow(String fileName)
+ {
+ System.out.println(fileName + " Load Show");
+ long tr = 0;
+ String file = testFile(fileName);
+ startcenter.menuItem("File->Open...").select();
+ FilePicker_Path.setText(file);
+ FilePicker_Open.click();
+// submitOpenDlg(file);
+ tr = System.currentTimeMillis();
+ while(true)
+ {
+ if(fileName.contains("odt") || fileName.contains("doc")
|| fileName.contains("docx"))
+ {
+ if(writer.exists())
+ {
+// writer.menuItem("File->Close").select();
+ break;
+ }
+ }
+
+ if(fileName.contains("odp") || fileName.contains("ppt")
|| fileName.contains("pptx"))
+ {
+ if(impress.exists())
+ {
+//
impress.menuItem("File->Close").select();
+ break;
+ }
+ }
+
+ if(fileName.contains("ods") || fileName.contains("xls")
|| fileName.contains("xlsx"))
+ {
+ if(calc.exists())
+ {
+// calc.menuItem("File->Close").select();
+ break;
+ }
+ }
+ }
+ tr = System.currentTimeMillis() - tr;
+ sleep(2);
+
+ if(fileName.contains("odt") || fileName.contains("doc") ||
fileName.contains("docx"))
+ {
+ writer.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("odp") || fileName.contains("ppt") ||
fileName.contains("pptx"))
+ {
+ impress.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("ods") || fileName.contains("xls") ||
fileName.contains("xlsx"))
+ {
+ calc.menuItem("File->Close").select();
+ }
+
+ return tr;
+ }
+
+ public long perfLoadFinish(String fileName, int destPage)
+ {
+ System.out.println(fileName + " Load Finish");
+ long tr = 0;
+ String file = testFile(fileName);
+ startcenter.menuItem("File->Open...").select();
+// submitOpenDlg(file);
+ FilePicker_Path.setText(file);
+ FilePicker_Open.click();
+ tr = System.currentTimeMillis();
+ while(true)
+ {
+ if(getLoadedPage(fileName) >= destPage)
+ {
+ break;
+ }
+ }
+ tr = System.currentTimeMillis() - tr;
+ sleep(5);
+ System.out.println("Load Finish Time: " + tr);
+
+ if(fileName.contains("odt") || fileName.contains("doc") ||
fileName.contains("docx"))
+ {
+ writer.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("odp") || fileName.contains("ppt") ||
fileName.contains("pptx"))
+ {
+ impress.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("ods") || fileName.contains("xls") ||
fileName.contains("xlsx"))
+ {
+ calc.menuItem("File->Close").select();
+ }
+ return tr;
+ }
+
+ public static int getLoadedPage(String docName)
+ {
+ String tmp = "";
+ if(docName.endsWith("odt") || docName.endsWith("doc") ||
docName.endsWith("docx"))
+ {
+ tmp = statusbar("FWK_HID_STATUSBAR").getItemText(0);
+ }
+ if(docName.endsWith("odp") || docName.endsWith("ppt") ||
docName.endsWith("pptx"))
+ {
+ tmp = statusbar("FWK_HID_STATUSBAR").getItemText(4);
+ }
+ //System.out.println(tmp);
+ String s[]= tmp.split("/");
+// System.out.println(Integer.parseInt(s[1].trim()));
+ return Integer.parseInt(s[1].trim());
+ }
+
+ public long perfSave(String fileName_i)
+ {
+ System.out.println(fileName_i + " Save");
+ String fileName = fileName_i.substring(14);
+// System.out.println(fileName);
+ long tr = 0;
+ sleep(2);
+ String file = testFile(fileName_i);
+ startcenter.menuItem("File->Open...").select();
+ submitOpenDlg(file);
+ sleep(8);
+ if(fileName.startsWith("sw")){
+ if(fileName.startsWith("sw_complex")){
+ typeKeys("<ctrl Home>");
+ if(fileName.endsWith("odt")){
+// writer.click(180,300);
+ typeKeys("<PageDown>");
+ sleep(2);
+ typeKeys("<PageDown>");
+ sleep(2);
+ typeKeys("<PageDown>");
+ sleep(2);
+ typeKeys("<Enter>");
+ sleep(2);
+ typeKeys("<delete>");
+ }else{
+// writer.click(180,300);
+// org.vclauto.Tester.typeKeys("<PGDN pgdn
pgdn pgdn pgdn>");
+// org.vclauto.Tester.typeKeys("<DOWN
down>");
+ typeKeys("<Enter>");
+ sleep(2);
+// System.out.println("Enter");
+ typeKeys("<backspace>");
+// System.out.println("backspace");
+ }
+ }else{
+// writer.click(180,300);
+// writer.click();
+ typeKeys("<enter>");
+ typeKeys("<backspace>");
+ }
+ }
+ else if(fileName.startsWith("sd")){
+// writer.click(436, 326);
+// presenter.click();
+// sleep(2);
+// org.vclauto.Tester.typeKeys("<Enter>");
+// sleep(1);
+// org.vclauto.Tester.typeKeys("<BACKSPACE>");
+// sleep(1);
+// org.vclauto.Tester.typeKeys("<ESC>");
+// sleep(1);
+// org.vclauto.Tester.typeKeys("<ESC>");
+// System.out.println("SD");
+ impress.menuItem("Insert->Slide").select();
+// System.out.println("Insert slide");
+ sleep(5);
+ impress.menuItem("Edit->Delete Slide").select();
+// System.out.println("Delete slide");
+ sleep(5);
+
+ }else{
+// writer.click(100, 220);
+ typeKeys("1");
+ typeKeys("<BACKSPACE>");
+ typeKeys("<Enter>");
+ typeKeys("<ESC>");
+ }
+ sleep(5);
+
+ typeKeys("<ctrl s>");
+ tr = System.currentTimeMillis();
+
+ int index = 0;
+ if(fileName.endsWith("odt") || fileName.endsWith("doc") ||
fileName.endsWith("docx"))
+ {
+ index = 5;
+ }
+ if(fileName.endsWith("odp") || fileName.endsWith("ppt") ||
fileName.endsWith("pptx"))
+ {
+ index = 2;
+ }
+ if(fileName.endsWith("ods") || fileName.endsWith("xls") ||
fileName.endsWith("xlsx"))
+ {
+ index = 4;
+ }
+ while(true)
+ {
+//
System.out.println(statusbar("FWK_HID_STATUSBAR").getItemText(index));
+
if(statusbar("FWK_HID_STATUSBAR").getItemText(index).equals(" "))
+ {
+ break;
+ }
+ }
+ tr = System.currentTimeMillis() - tr;
+
+ sleep(2);
+
+ if(fileName.contains("odt") || fileName.contains("doc") ||
fileName.contains("docx"))
+ {
+ writer.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("odp") || fileName.contains("ppt") ||
fileName.contains("pptx"))
+ {
+ impress.menuItem("File->Close").select();
+ }
+
+ if(fileName.contains("ods") || fileName.contains("xls") ||
fileName.contains("xlsx"))
+ {
+ calc.menuItem("File->Close").select();
+ }
+ return tr;
+ }
+
+}
Added:
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/GenerateReports.java
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/GenerateReports.java?rev=1362331&view=auto
==============================================================================
---
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/GenerateReports.java
(added)
+++
incubator/ooo/trunk/main/test/testoo/src/testcase/performance/benchmark/GenerateReports.java
Tue Jul 17 01:40:18 2012
@@ -0,0 +1,284 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+
+
+/**
+ *
+ */
+
+package testcase.performance.benchmark;
+
+import java.io.File;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import java.text.NumberFormat;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.lang.Math;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+
+import testlib.CalcUtil;
+
+import static org.openoffice.test.vcl.Tester.sleep;
+import static org.openoffice.test.vcl.Tester.typeKeys;
+import static testlib.AppUtil.*;
+import static testlib.UIMap.SC_InsertColumnsRowsdialog;
+import static testlib.UIMap.app;
+import static testlib.UIMap.dialog;
+import static testlib.UIMap.startcenter;
+import static testlib.UIMap.writer;
+import static testlib.CalcUtil.*;
+import static testlib.UIMap.*;
+
+public class GenerateReports {
+ static public void computeResults(String resultDir)
+ {
+ try {
+ Map<String, ArrayList<String>> map = new
HashMap<String, ArrayList<String>>();
+ BufferedReader in = new BufferedReader(new
FileReader(resultDir));
+ String line = in.readLine();
+ String testScenario;
+ String testResult;
+
+ while(line != null)
+ {
+ testScenario = line.substring(0,
line.indexOf(":"));
+ testResult = line.substring(line.indexOf(":") +
2);
+ System.out.println(testScenario + " " +
testResult);
+ if(map.containsKey(testScenario))
+ {
+ map.get(testScenario).add(testResult);
+ }
+ else
+ {
+ ArrayList <String> array = new
ArrayList<String>();
+ array.add(testResult);
+ map.put(testScenario, array);
+ }
+ line = in.readLine();
+ }
+
+
+ Iterator iter = map.keySet().iterator();
+ while(iter.hasNext())
+ {
+ String key = (String)iter.next();
+ ArrayList<String> val =
(ArrayList<String>)map.get(key);
+
+ if(val.size() < 8)
+ {
+ continue;
+ }
+
+ //Remove the first round result;
+ val.remove(0);
+ val.trimToSize();
+
+ //Find the min and max value;
+ Iterator iter1 = val.listIterator();
+ int min_index = 0, max_index = 0, curr_index =
0;
+ long min, max, curr_value;
+ min = max =
Long.parseLong((String)iter1.next());
+ while(iter1.hasNext())
+ {
+ curr_index++;
+ curr_value =
Long.parseLong((String)iter1.next());
+ if(curr_value <= min)
+ {
+ min = curr_value;
+ min_index = curr_index;
+ }
+
+ if(curr_value > max)
+ {
+ max = curr_value;
+ max_index = curr_index;
+ }
+ }
+
+ if(min_index > max_index)
+ {
+ val.remove(min_index);
+ val.remove(max_index);
+ }
+ else
+ {
+ val.remove(max_index);
+ val.remove(min_index);
+ }
+
+
+ System.out.println("Map removed value: ");
+ System.out.println("Key: " + key + " ;Value: "
+ (ArrayList<String>)map.get(key));
+
+ //Compute the average and standard deviation
value of the 5 left round result
+ Iterator iter2 = val.listIterator();
+ double average = 0;
+ long sum = 0;
+ while(iter2.hasNext())
+ {
+// System.out.println("Result: " +
(String)iter2.next());
+ sum +=
Long.parseLong((String)iter2.next());
+ }
+
+ average = sum / 5;
+
+ Iterator iter3 = val.listIterator();
+ double stdev = 0;
+ sum = 0;
+ while(iter3.hasNext())
+ {
+ long curr_result =
Long.parseLong((String)iter3.next());
+ sum += (curr_result - average) *
(curr_result - average);
+ }
+
+ average = average / 1000;
+ stdev = Math.sqrt(sum / 4) / 1000;
+
+ val.add(Double.toString(average));
+ val.add(Double.toString(stdev));
+
+ System.out.println(val.size());
+ }
+
+ String resultOdsFile = new
File(System.getProperty("testspace", "../testspace")).getAbsolutePath() +
"/output/output_start.ods";
+
+ writeResultToFile(map, resultOdsFile);
+
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+ static void writeResultToFile(Map<String, ArrayList<String>> m, String
report_dir)
+ {
+// initApp();
+ startcenter.menuItem("File->Open...").select();
+ submitOpenDlg(report_dir);
+ sleep(10);
+
+ CalcUtil.selectRange("Spread.F1");
+ calc.menuItem("Insert->Columns").select();
+// SC_InsertColumnsRowsdialog.ok();
+ sleep(1);
+
+// fillReport(m, "Spread.F13", "New Document Result");
+// fillReport(m, "Spread.F15", "New Presentation Result");
+// fillReport(m, "Spread.F17", "New Spreadsheet Result");
+ fillReport(m, "Spread.F3", "Plain ODT Load Show Result");
+ fillReport(m, "Spread.F4", "Complex ODT Load Show Result");
+ fillReport(m, "Spread.F5", "Plain ODT Load Finish Result");
+ fillReport(m, "Spread.F6", "Complex ODT Load Finish Result");
+ fillReport(m, "Spread.F7", "Plain DOC Load Show Result");
+ fillReport(m, "Spread.F8", "Complex DOC Load Show Result");
+ fillReport(m, "Spread.F9", "Plain DOC Load Finish Result");
+ fillReport(m, "Spread.F10", "Complex DOC Load Finish Result");
+ fillReport(m, "Spread.F11", "Plain ODP Load Show Result");
+ fillReport(m, "Spread.F12", "Complex ODP Load Show Result");
+ fillReport(m, "Spread.F13", "Plain ODP Load Finish Result");
+ fillReport(m, "Spread.F14", "Complex ODP Load Finish Result");
+ fillReport(m, "Spread.F15", "Plain PPT Load Show Result");
+ fillReport(m, "Spread.F16", "Complex PPT Load Show Result");
+ fillReport(m, "Spread.F17", "Plain PPT Load Finish Result");
+ fillReport(m, "Spread.F18", "Complex PPT Load Finish Result");
+ fillReport(m, "Spread.F19", "Plain ODS Load Show Result");
+ fillReport(m, "Spread.F20", "Complex ODS Load Show Result");
+ fillReport(m, "Spread.F21", "Plain XLS Load Show Result");
+ fillReport(m, "Spread.F22", "Complex XLS Load Show Result");
+ fillReport(m, "Spread.F23", "Plain ODT Save Result");
+ fillReport(m, "Spread.F24", "Complex ODT Save Result");
+ fillReport(m, "Spread.F25", "Plain DOC Save Result");
+ fillReport(m, "Spread.F26", "Complex DOC Save Result");
+ fillReport(m, "Spread.F27", "Plain ODP Save Result");
+ fillReport(m, "Spread.F28", "Complex ODP Save Result");
+ fillReport(m, "Spread.F29", "Plain PPT Save Result");
+ fillReport(m, "Spread.F30", "Complex PPT Save Result");
+ fillReport(m, "Spread.F31", "Plain ODS Save Result");
+ fillReport(m, "Spread.F32", "Complex ODS Save Result");
+ fillReport(m, "Spread.F33", "Plain XLS Save Result");
+ fillReport(m, "Spread.F34", "Complex XLS Save Result");
+// fillReport(m, "Spread.F51", "SD-SShow Complex odp Slider Show
Result");
+
+ //Save the text document
+ calc.menuItem("File->Save As...").select();
+ String saveTo = new File(System.getProperty("testspace",
"../testspace")).getAbsolutePath() + "/output/output_start_1.ods";
+ FileUtil.deleteFile(saveTo);
+ submitSaveDlg(saveTo);
+// if (dialog("33388").exists(3))
+// dialog("33388").ok();
+ sleep(2);
+ calc.menuItem("File->Exit").select();
+
+ }
+
+ static void fillReport(Map<String, ArrayList<String>> m, String cell,
String scenario)
+ {
+ ArrayList <String> raw_data = m.get(scenario);
+
+// Iterator iter1 = raw_data.listIterator();
+// while(iter1.hasNext())
+// {
+// System.out.println(iter1.next());
+// }
+
+// NumberFormat nbf = NumberFormat.getInstance();
+// nbf.setMinimumFractionDigits(2);
+// nbf.setMaximumFractionDigits(2);
+ String result;
+ if(raw_data.size() == 1)
+ {
+ System.out.println("alsdjf");
+ result = raw_data.get(0);
+ }
+ else
+ {
+// result = " " + nbf.format(raw_data.get(raw_data.size()
- 2)) + "/ " + nbf.format(raw_data.get(raw_data.size() - 1));
+ result = new
java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size()
- 2))).toString() + "/ " + new
java.text.DecimalFormat("0.00").format(Double.parseDouble(raw_data.get(raw_data.size()
- 1))).toString();
+// result = raw_data.get(raw_data.size() - 2) + "/ " +
raw_data.get(raw_data.size() - 1);
+ }
+ CalcUtil.selectRange(cell);
+ typeKeys(result + "<enter>");
+ }
+
+ static void printMap(Map<String, ArrayList<String>> m)
+ {
+ Iterator iter = m.keySet().iterator();
+ while(iter.hasNext())
+ {
+ String key = (String)iter.next();
+ System.out.println("Key: " + key + "; Value: " +
m.get(key));
+ }
+ }
+}