View | Details | Raw Unified | Return to issue 120289
Collapse All | Expand All

(-)src/testcase/performance/benchmark/GenerateReports.java (+294 lines)
Line 0 Link Here
1
/**************************************************************
2
 * 
3
 * Licensed to the Apache Software Foundation (ASF) under one
4
 * or more contributor license agreements.  See the NOTICE file
5
 * distributed with this work for additional information
6
 * regarding copyright ownership.  The ASF licenses this file
7
 * to you under the Apache License, Version 2.0 (the
8
 * "License"); you may not use this file except in compliance
9
 * with the License.  You may obtain a copy of the License at
10
 * 
11
 *   http://www.apache.org/licenses/LICENSE-2.0
12
 * 
13
 * Unless required by applicable law or agreed to in writing,
14
 * software distributed under the License is distributed on an
15
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
 * KIND, either express or implied.  See the License for the
17
 * specific language governing permissions and limitations
18
 * under the License.
19
 * 
20
 *************************************************************/
21
22
23
24
/**
25
 * 
26
 */
27
28
package testcase.performance.benchmark;
29
30
import java.io.File;
31
import java.io.BufferedReader;
32
import java.io.FileNotFoundException;
33
import java.io.FileReader;
34
import java.io.IOException;
35
36
import java.text.NumberFormat;
37
import java.util.Iterator;
38
import java.util.Map;
39
import java.util.HashMap;
40
import java.util.ArrayList;
41
import java.lang.Math;
42
43
import org.junit.Before;
44
import org.junit.Test;
45
import org.openoffice.test.common.FileUtil;
46
47
import testlib.CalcUtil;
48
49
import static org.openoffice.test.vcl.Tester.sleep;
50
import static org.openoffice.test.vcl.Tester.typeKeys;
51
import static testlib.AppUtil.*;
52
import static testlib.UIMap.SC_InsertColumnsRowsdialog;
53
import static testlib.UIMap.app;
54
import static testlib.UIMap.dialog;
55
import static testlib.UIMap.startcenter;
56
import static testlib.UIMap.writer;
57
import static testlib.CalcUtil.*;
58
import static testlib.UIMap.*;
59
60
public class GenerateReports {
61
	static public void computeResults(String resultDir)
62
	{
63
		try {
64
			Map<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();
65
			BufferedReader in = new BufferedReader(new FileReader(resultDir));
66
			String line = in.readLine();
67
			String testScenario;
68
			String testResult;
69
			
70
			while(line != null)
71
			{
72
				testScenario = line.substring(0, line.indexOf(":"));
73
				testResult = line.substring(line.indexOf(":") + 2);
74
				System.out.println(testScenario + " " + testResult);
75
				if(map.containsKey(testScenario))
76
				{
77
					map.get(testScenario).add(testResult);
78
				}
79
				else
80
				{
81
					ArrayList <String> array = new ArrayList<String>();
82
					array.add(testResult);
83
					map.put(testScenario, array);
84
				}
85
				line = in.readLine();
86
			}
87
			
88
			
89
			Iterator iter = map.keySet().iterator();
90
			while(iter.hasNext())
91
			{
92
				String key = (String)iter.next();
93
				ArrayList<String> val = (ArrayList<String>)map.get(key);
94
				
95
				if(val.size() < 8)
96
				{
97
					continue;
98
				}
99
				
100
				//Remove the first round result;
101
				val.remove(0);
102
				val.trimToSize();
103
				
104
				//Find the min and max value;
105
				Iterator iter1 = val.listIterator();
106
				int min_index = 0, max_index = 0, curr_index = 0;
107
				long min, max, curr_value;
108
				min = max = Long.parseLong((String)iter1.next());
109
				while(iter1.hasNext())
110
				{
111
					curr_index++;
112
					curr_value = Long.parseLong((String)iter1.next());
113
					if(curr_value <= min)
114
					{
115
						min = curr_value;
116
						min_index = curr_index;
117
					}
118
					
119
					if(curr_value > max)
120
					{
121
						max = curr_value;
122
						max_index = curr_index;
123
					}
124
				}
125
				
126
				if(min_index > max_index)
127
				{
128
					val.remove(min_index);
129
					val.remove(max_index);
130
				}
131
				else
132
				{
133
					val.remove(max_index);
134
					val.remove(min_index);
135
				}
136
				
137
				
138
				System.out.println("Map removed value: ");
139
				System.out.println("Key: " + key + " ;Value: " + (ArrayList<String>)map.get(key));
140
				
141
				//Compute the average and standard deviation value of the 5 left round result
142
				Iterator iter2 = val.listIterator();
143
				double average = 0;
144
				long sum = 0;
145
				while(iter2.hasNext())
146
				{
147
//					System.out.println("Result: " + (String)iter2.next());
148
					sum += Long.parseLong((String)iter2.next());
149
				}
150
				
151
				average = sum / 5;
152
				
153
				Iterator iter3 = val.listIterator();
154
				double stdev = 0;
155
				sum = 0;
156
				while(iter3.hasNext())
157
				{
158
					long curr_result = Long.parseLong((String)iter3.next());
159
					sum += (curr_result - average) * (curr_result - average);
160
 				}
161
				
162
				average = average / 1000;
163
				stdev = Math.sqrt(sum / 4) / 1000;
164
				
165
				val.add(Double.toString(average));
166
				val.add(Double.toString(stdev));
167
				
168
				System.out.println(val.size());
169
			}
170
			
171
			String resultOdsFile = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath() + "/output/output_start.ods";
172
			
173
			writeResultToFile(map, resultOdsFile);
174
			
175
		} catch (FileNotFoundException e) {
176
			// TODO Auto-generated catch block
177
			e.printStackTrace();
178
		} catch (IOException e) {
179
			e.printStackTrace();
180
		}
181
		
182
		
183
	}
184
	
185
	static void writeResultToFile(Map<String, ArrayList<String>> m, String report_dir)
186
	{
187
//		initApp();
188
		startcenter.menuItem("File->Open...").select();
189
		submitOpenDlg(report_dir);
190
		sleep(10);
191
		
192
		CalcUtil.selectRange("Spread.F1");
193
		calc.menuItem("Insert->Columns").select();
194
//		SC_InsertColumnsRowsdialog.ok();
195
		sleep(1);
196
		
197
//		fillReport(m, "Spread.F13", "New Document Result");
198
//		fillReport(m, "Spread.F15", "New Presentation Result");
199
//		fillReport(m, "Spread.F17", "New Spreadsheet Result");
200
		fillReport(m, "Spread.F3", "Plain ODT Load Show Result");
201
		fillReport(m, "Spread.F4", "Complex ODT Load Show Result");
202
		fillReport(m, "Spread.F5", "Plain ODT Load Finish Result");
203
		fillReport(m, "Spread.F6", "Complex ODT Load Finish Result");
204
		fillReport(m, "Spread.F7", "Plain DOC Load Show Result");
205
		fillReport(m, "Spread.F8", "Complex DOC Load Show Result");
206
		fillReport(m, "Spread.F9", "Plain DOC Load Finish Result");
207
		fillReport(m, "Spread.F10", "Complex DOC Load Finish Result");
208
		fillReport(m, "Spread.F11", "Plain ODP Load Show Result");
209
		fillReport(m, "Spread.F12", "Complex ODP Load Show Result");
210
		fillReport(m, "Spread.F13", "Plain ODP Load Finish Result");
211
		fillReport(m, "Spread.F14", "Complex ODP Load Finish Result");
212
		fillReport(m, "Spread.F15", "Plain PPT Load Show Result");
213
		fillReport(m, "Spread.F16", "Complex PPT Load Show Result");
214
		fillReport(m, "Spread.F17", "Plain PPT Load Finish Result");
215
		fillReport(m, "Spread.F18", "Complex PPT Load Finish Result");
216
		fillReport(m, "Spread.F19", "Plain ODS Load Show Result");
217
		fillReport(m, "Spread.F20", "Complex ODS Load Show Result");
218
		fillReport(m, "Spread.F21", "Plain XLS Load Show Result");
219
		fillReport(m, "Spread.F22", "Complex XLS Load Show Result");
220
		fillReport(m, "Spread.F23", "Plain ODT Save Result");
221
		fillReport(m, "Spread.F24", "Complex ODT Save Result");
222
		fillReport(m, "Spread.F25", "Plain DOC Save Result");
223
		fillReport(m, "Spread.F26", "Complex DOC Save Result");
224
		fillReport(m, "Spread.F27", "Plain ODP Save Result");
225
		fillReport(m, "Spread.F28", "Complex ODP Save Result");
226
		fillReport(m, "Spread.F29", "Plain PPT Save Result");
227
		fillReport(m, "Spread.F30", "Complex PPT Save Result");
228
		fillReport(m, "Spread.F31", "Plain ODS Save Result");
229
		fillReport(m, "Spread.F32", "Complex ODS Save Result");
230
		fillReport(m, "Spread.F33", "Plain XLS Save Result");
231
		fillReport(m, "Spread.F34", "Complex XLS Save Result");
232
//		fillReport(m, "Spread.F51", "SD-SShow Complex odp Slider Show Result");
233
		
234
		//Save the text document
235
		calc.menuItem("File->Save As...").select();
236
		String saveTo = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath() + "/output/output_start_1.ods";
237
		FileUtil.deleteFile(saveTo);
238
		submitSaveDlg(saveTo);	
239
//		if (dialog("33388").exists(3))
240
//			dialog("33388").ok();
241
		sleep(2);
242
		calc.menuItem("File->Exit").select();
243
		
244
	}
245
	
246
	static void fillReport(Map<String, ArrayList<String>> m, String cell, String scenario)
247
	{
248
		ArrayList <String> raw_data = m.get(scenario);
249
		
250
//		Iterator iter1 = raw_data.listIterator();
251
//		while(iter1.hasNext())
252
//		{
253
//			System.out.println(iter1.next());
254
//		}
255
		
256
//		NumberFormat nbf = NumberFormat.getInstance();
257
//		nbf.setMinimumFractionDigits(2);
258
//		nbf.setMaximumFractionDigits(2);
259
		String result;
260
		if(raw_data.size() == 1)
261
		{
262
			System.out.println("alsdjf");
263
			result = raw_data.get(0);
264
		}
265
		else
266
		{
267
//			result = " " + nbf.format(raw_data.get(raw_data.size() - 2)) + "/ " + nbf.format(raw_data.get(raw_data.size() - 1));
268
			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();
269
//			result = raw_data.get(raw_data.size() - 2) + "/ " + raw_data.get(raw_data.size() - 1);
270
		}
271
		CalcUtil.selectRange(cell);
272
		typeKeys(result + "<enter>");
273
	}
274
	
275
	static void printMap(Map<String, ArrayList<String>> m)
276
	{
277
		Iterator iter = m.keySet().iterator();
278
		while(iter.hasNext())
279
		{
280
			String key = (String)iter.next();
281
			System.out.println("Key: " + key + "; Value: " + m.get(key));
282
		}
283
	}
284
	@Before
285
	public void setUp(){
286
		app.start();
287
	}
288
	
289
	@Test
290
	public void genReport()
291
	{
292
		computeResults("D:\\Work\\MyWorkplace\\testspace\\output\\pvt_filter_results.txt");
293
	}
294
}
(-)src/testcase/performance/benchmark/Filter.java (+455 lines)
Line 0 Link Here
1
/**************************************************************
2
 * 
3
 * Licensed to the Apache Software Foundation (ASF) under one
4
 * or more contributor license agreements.  See the NOTICE file
5
 * distributed with this work for additional information
6
 * regarding copyright ownership.  The ASF licenses this file
7
 * to you under the Apache License, Version 2.0 (the
8
 * "License"); you may not use this file except in compliance
9
 * with the License.  You may obtain a copy of the License at
10
 * 
11
 *   http://www.apache.org/licenses/LICENSE-2.0
12
 * 
13
 * Unless required by applicable law or agreed to in writing,
14
 * software distributed under the License is distributed on an
15
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
 * KIND, either express or implied.  See the License for the
17
 * specific language governing permissions and limitations
18
 * under the License.
19
 * 
20
 *************************************************************/
21
22
23
24
/**
25
 * 
26
 */
27
28
29
package testcase.performance.benchmark;
30
31
import static testlib.AppUtil.*;
32
import static testlib.UIMap.*;
33
34
import org.junit.Before;
35
import org.junit.Ignore;
36
import org.junit.Rule;
37
import org.junit.Test;
38
import org.openoffice.test.common.Testspace;
39
40
41
import java.io.File;
42
import java.io.FileWriter;
43
import java.io.IOException;
44
45
import static org.openoffice.test.vcl.Tester.*;
46
47
public class Filter {
48
49
	@Before
50
	public void setUp(){
51
		app.start();
52
	}
53
	
54
	@Test
55
	public void pvtFilter()
56
	{
57
		String pvt_result_path = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath() + "/output/pvt_filter_results.txt";
58
		String testspacePath = new File(System.getProperty("testspace", "../testspace")).getAbsolutePath();
59
		String counterLists = testspacePath + "\\data\\pvt_benchmark\\perfmon\\counterlist.txt";
60
		String counterOutput = testspacePath + "\\output\\output_perfmon";
61
		String createCounters = testspacePath + "\\data\\pvt_benchmark\\perfmon\\createCounters.bat";
62
		String stopCounters = testspacePath + "\\data\\pvt_benchmark\\perfmon\\stopCounters.bat";
63
		
64
		Testspace.prepareData("pvt_benchmark/perfmon/counterlist.txt");
65
		Testspace.prepareData("pvt_benchmark/perfmon/createCounters.bat");
66
		Testspace.prepareData("pvt_benchmark/perfmon/stopCounters.bat");
67
		Testspace.prepareData("pvt_benchmark/output_start.ods", "/output/output_start.ods");
68
		
69
		try {
70
			String []cmdargs_start = {"cmd.exe", "/C", "start", createCounters, counterOutput, counterLists};
71
			java.lang.Runtime.getRuntime().exec(cmdargs_start);
72
			sleep(5);
73
			FileWriter out = new FileWriter(pvt_result_path);
74
			out.write("Test Start: " + System.getProperty("line.separator"));
75
			for(int i = 0; i < 8; i++)
76
			{
77
				System.out.println("This is the " + i + " time");
78
//				out.write("New Document Result: " + perfNew("Text Document") + System.getProperty("line.separator"));
79
//				out.flush();
80
//				out.write("New Presentation Result: " + perfNew("Presentation") + System.getProperty("line.separator"));
81
//				out.flush();
82
//				out.write("New Spreadsheet Result: " + perfNew("Spreadsheet") + System.getProperty("line.separator"));
83
//				out.flush();
84
				
85
				out.write("Plain ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p_odf1.2.odt") + System.getProperty("line.separator"));
86
				out.flush();
87
				out.write("Plain DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_plain_120p.doc") + System.getProperty("line.separator"));
88
				out.flush();
89
				out.write("Complex ODT Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p_odf1.2.odt") + System.getProperty("line.separator"));
90
				out.flush();
91
				out.write("Complex DOC Load Show Result: " + perfLoadShow("pvt_benchmark/sw_complex_100p.doc") + System.getProperty("line.separator"));
92
				out.flush();
93
				out.write("Plain ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p_odf1.2.odp") + System.getProperty("line.separator"));
94
				out.flush();
95
				out.write("Plain PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_plain_50p.ppt") + System.getProperty("line.separator"));
96
				out.flush();
97
				out.write("Complex ODP Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p_odf1.2.odp") + System.getProperty("line.separator"));
98
				out.flush();
99
				out.write("Complex PPT Load Show Result: " + perfLoadShow("pvt_benchmark/sd_complex_51p.ppt") + System.getProperty("line.separator"));
100
				out.flush();
101
				out.write("Plain ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
102
				out.flush();
103
				out.write("Plain XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_plain_4sh_5kcell.xls") + System.getProperty("line.separator"));
104
				out.flush();
105
				out.write("Complex ODS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
106
				out.flush();
107
				out.write("Complex XLS Load Show Result: " + perfLoadShow("pvt_benchmark/sc_complex_13sh_4kcell.xls") + System.getProperty("line.separator"));
108
				out.flush();
109
				
110
				out.write("Plain ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p_odf1.2.odt", 110) + System.getProperty("line.separator"));
111
				out.flush();
112
				out.write("Plain DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_plain_120p.doc", 110) + System.getProperty("line.separator"));
113
				out.flush();
114
				out.write("Complex ODT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p_odf1.2.odt", 100) + System.getProperty("line.separator"));
115
				out.flush();
116
				out.write("Complex DOC Load Finish Result: " + perfLoadFinish("pvt_benchmark/sw_complex_100p.doc", 95) + System.getProperty("line.separator"));
117
				out.flush();
118
				out.write("Plain ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p_odf1.2.odp", 50) + System.getProperty("line.separator"));
119
				out.flush();
120
				out.write("Plain PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_plain_50p.ppt", 50) + System.getProperty("line.separator"));
121
				out.flush();
122
				out.write("Complex ODP Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p_odf1.2.odp", 51) + System.getProperty("line.separator"));
123
				out.flush();
124
				out.write("Complex PPT Load Finish Result: " + perfLoadFinish("pvt_benchmark/sd_complex_51p.ppt", 51) + System.getProperty("line.separator"));
125
				out.flush();
126
				
127
				out.write("Plain ODT Save Result: " + perfSave("pvt_benchmark/sw_plain_120p_odf1.2.odt") + System.getProperty("line.separator"));
128
				out.flush();
129
				out.write("Plain DOC Save Result: " + perfSave("pvt_benchmark/sw_plain_120p.doc") + System.getProperty("line.separator"));
130
				out.flush();
131
				out.write("Complex ODT Save Result: " + perfSave("pvt_benchmark/sw_complex_100p_odf1.2.odt") + System.getProperty("line.separator"));
132
				out.flush();
133
				out.write("Complex DOC Save Result: " + perfSave("pvt_benchmark/sw_complex_100p.doc") + System.getProperty("line.separator"));
134
				out.flush();
135
				out.write("Plain ODP Save Result: " + perfSave("pvt_benchmark/sd_plain_50p_odf1.2.odp") + System.getProperty("line.separator"));
136
				out.flush();
137
				out.write("Plain PPT Save Result: " + perfSave("pvt_benchmark/sd_plain_50p.ppt") + System.getProperty("line.separator"));
138
				out.flush();
139
				out.write("Complex ODP Save Result: " + perfSave("pvt_benchmark/sd_complex_51p_odf1.2.odp") + System.getProperty("line.separator"));
140
				out.flush();
141
				out.write("Complex PPT Save Result: " + perfSave("pvt_benchmark/sd_complex_51p.ppt") + System.getProperty("line.separator"));
142
				out.flush();
143
				out.write("Plain ODS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
144
				out.flush();
145
				out.write("Plain XLS Save Result: " + perfSave("pvt_benchmark/sc_plain_4sh_5kcell.xls") + System.getProperty("line.separator"));
146
				out.flush();
147
				out.write("Complex ODS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods") + System.getProperty("line.separator"));
148
				out.flush();
149
				out.write("Complex XLS Save Result: " + perfSave("pvt_benchmark/sc_complex_13sh_4kcell.xls") + System.getProperty("line.separator"));
150
				out.flush();		
151
			}
152
			out.close();
153
			String []cmdargs_end = {"cmd.exe", "/C", "start", stopCounters};
154
			java.lang.Runtime.getRuntime().exec(cmdargs_end);
155
			
156
		} catch (IOException e) {
157
			// TODO Auto-generated catch block
158
			e.printStackTrace();
159
		} 
160
		
161
		
162
		GenerateReports genReport = new GenerateReports();
163
		genReport.computeResults(pvt_result_path);
164
		
165
	}
166
	
167
	public long perfNew(String fileType)
168
	{
169
		System.out.println("New " + fileType);
170
		startcenter.menuItem("File->New->" + fileType).select();
171
//		startcenter.menuItem("File->New->Spreadsheet").select();
172
		long tr = System.currentTimeMillis();
173
//		System.out.println("1: " + tr);
174
		while(true)
175
		{
176
			if(fileType.equals("Text Document"))
177
			{
178
				if(writer.exists())
179
				{
180
					break;
181
				}
182
			}
183
			
184
//			else{
185
				if(fileType.equals("Presentation"))
186
				{
187
//					System.out.println("2: " + System.currentTimeMillis());
188
					if(impress.exists())
189
					{
190
//						System.out.println("3: " + System.currentTimeMillis());
191
						break;
192
					}
193
				}
194
//				else
195
//				{
196
					if(calc.exists())
197
					{
198
						break;
199
					}
200
//				}
201
//			}
202
			
203
		}
204
//		System.out.println("4: " + System.currentTimeMillis());
205
		tr = System.currentTimeMillis() - tr;
206
		
207
		if(fileType.equals("Text Document"))
208
		{
209
			writer.menuItem("File->Close").select();
210
		}
211
		
212
		if(fileType.equals("Presentation"))
213
		{
214
			impress.menuItem("File->Close").select();
215
		}
216
		
217
		if(fileType.equals("Spreadsheet"))
218
		{
219
			calc.menuItem("File->Close").select();
220
		}
221
		
222
		return tr;
223
	}
224
	
225
	public long perfLoadShow(String fileName)
226
	{
227
		System.out.println(fileName + " Load Show");
228
		long tr = 0;
229
		String file = testFile(fileName);
230
		startcenter.menuItem("File->Open...").select();
231
		FilePicker_Path.setText(file);
232
		FilePicker_Open.click();
233
//		submitOpenDlg(file);
234
		tr = System.currentTimeMillis();
235
		while(true)
236
		{
237
			if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
238
			{
239
				if(writer.exists())
240
				{
241
//					writer.menuItem("File->Close").select();
242
					break;
243
				}
244
			}
245
			
246
			if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
247
			{
248
				if(impress.exists())
249
				{
250
//					impress.menuItem("File->Close").select();
251
					break;
252
				}
253
			}
254
			
255
			if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
256
			{
257
				if(calc.exists())
258
				{
259
//					calc.menuItem("File->Close").select();
260
					break;
261
				}
262
			}
263
		}
264
		tr = System.currentTimeMillis() - tr;
265
		sleep(2);
266
		
267
		if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
268
		{
269
			writer.menuItem("File->Close").select();
270
		}
271
		
272
		if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
273
		{
274
			impress.menuItem("File->Close").select();
275
		}
276
		
277
		if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
278
		{
279
			calc.menuItem("File->Close").select();
280
		}
281
		
282
		return tr;
283
	}
284
285
	public long perfLoadFinish(String fileName, int destPage)
286
	{
287
		System.out.println(fileName + " Load Finish");
288
		long tr = 0;
289
		String file = testFile(fileName);
290
		startcenter.menuItem("File->Open...").select();
291
//		submitOpenDlg(file);
292
		FilePicker_Path.setText(file);
293
		FilePicker_Open.click();
294
		tr = System.currentTimeMillis();
295
		while(true)
296
		{
297
			if(getLoadedPage(fileName) >= destPage)
298
			{
299
				break;
300
			}
301
		}
302
		tr = System.currentTimeMillis() - tr;
303
		sleep(5);
304
		System.out.println("Load Finish Time: " + tr);
305
		
306
		if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
307
		{
308
			writer.menuItem("File->Close").select();
309
		}
310
		
311
		if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
312
		{
313
			impress.menuItem("File->Close").select();
314
		}
315
		
316
		if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
317
		{
318
			calc.menuItem("File->Close").select();
319
		}
320
		return tr;
321
	}
322
	
323
	public static int getLoadedPage(String docName)
324
	{
325
		String tmp = "";
326
		if(docName.endsWith("odt") || docName.endsWith("doc") || docName.endsWith("docx"))
327
		{
328
			tmp = statusbar("FWK_HID_STATUSBAR").getItemText(0);
329
		}
330
		if(docName.endsWith("odp") || docName.endsWith("ppt") || docName.endsWith("pptx"))
331
		{
332
			tmp = statusbar("FWK_HID_STATUSBAR").getItemText(4);
333
		}
334
		//System.out.println(tmp);
335
		String s[]= tmp.split("/");
336
//		System.out.println(Integer.parseInt(s[1].trim()));
337
		return Integer.parseInt(s[1].trim());
338
	}
339
340
	public long perfSave(String fileName_i)
341
	{
342
		System.out.println(fileName_i + " Save");
343
		String fileName = fileName_i.substring(14);
344
//		System.out.println(fileName);
345
		long tr = 0;
346
		sleep(2);
347
		String file = testFile(fileName_i);
348
		startcenter.menuItem("File->Open...").select();
349
		submitOpenDlg(file);
350
		sleep(8);
351
		if(fileName.startsWith("sw")){				
352
			if(fileName.startsWith("sw_complex")){				
353
				typeKeys("<ctrl Home>");
354
				if(fileName.endsWith("odt")){
355
//					writer.click(180,300);
356
					typeKeys("<PageDown>");
357
					sleep(2);
358
					typeKeys("<PageDown>");
359
					sleep(2);
360
					typeKeys("<PageDown>");
361
					sleep(2);
362
					typeKeys("<Enter>");
363
					sleep(2);
364
					typeKeys("<delete>");
365
				}else{
366
//					writer.click(180,300);
367
//					org.vclauto.Tester.typeKeys("<PGDN pgdn pgdn pgdn pgdn>");
368
//					org.vclauto.Tester.typeKeys("<DOWN down>");
369
					typeKeys("<Enter>");
370
					sleep(2);
371
//					System.out.println("Enter");
372
					typeKeys("<backspace>");
373
//					System.out.println("backspace");
374
				}
375
			}else{				
376
//				writer.click(180,300);
377
//				writer.click();
378
				typeKeys("<enter>");
379
				typeKeys("<backspace>");
380
			}
381
		}
382
		else if(fileName.startsWith("sd")){			
383
//			writer.click(436, 326);
384
//			presenter.click();
385
//			sleep(2);
386
//			org.vclauto.Tester.typeKeys("<Enter>");
387
//			sleep(1);
388
//			org.vclauto.Tester.typeKeys("<BACKSPACE>");
389
//			sleep(1);
390
//			org.vclauto.Tester.typeKeys("<ESC>");
391
//			sleep(1);
392
//			org.vclauto.Tester.typeKeys("<ESC>");
393
//			System.out.println("SD");
394
			impress.menuItem("Insert->Slide").select();
395
//			System.out.println("Insert slide");
396
			sleep(5);
397
			impress.menuItem("Edit->Delete Slide").select();
398
//			System.out.println("Delete slide");
399
			sleep(5);
400
			
401
		}else{
402
//			writer.click(100, 220);
403
			typeKeys("1");
404
			typeKeys("<BACKSPACE>");
405
			typeKeys("<Enter>");
406
			typeKeys("<ESC>");
407
		}
408
		sleep(5);
409
		
410
		typeKeys("<ctrl s>");
411
		tr = System.currentTimeMillis();
412
		
413
		int index = 0;
414
		if(fileName.endsWith("odt") || fileName.endsWith("doc") || fileName.endsWith("docx"))
415
		{
416
			index = 5;
417
		}
418
		if(fileName.endsWith("odp") || fileName.endsWith("ppt") || fileName.endsWith("pptx"))
419
		{
420
			index = 2;
421
		}
422
		if(fileName.endsWith("ods") || fileName.endsWith("xls") || fileName.endsWith("xlsx"))
423
		{
424
			index = 4;
425
		}
426
		while(true)
427
		{
428
//			System.out.println(statusbar("FWK_HID_STATUSBAR").getItemText(index));
429
			if(statusbar("FWK_HID_STATUSBAR").getItemText(index).equals(" "))
430
			{
431
				break;
432
			}
433
		}
434
		tr = System.currentTimeMillis() - tr;
435
		
436
		sleep(2);
437
		
438
		if(fileName.contains("odt") || fileName.contains("doc") || fileName.contains("docx"))
439
		{
440
			writer.menuItem("File->Close").select();
441
		}
442
		
443
		if(fileName.contains("odp") || fileName.contains("ppt") || fileName.contains("pptx"))
444
		{
445
			impress.menuItem("File->Close").select();
446
		}
447
		
448
		if(fileName.contains("ods") || fileName.contains("xls") || fileName.contains("xlsx"))
449
		{
450
			calc.menuItem("File->Close").select();
451
		}
452
		return tr;
453
	}
454
		
455
}
(-)data/pvt_benchmark/perfmon/counterlist.txt (+12 lines)
Line 0 Link Here
1
;System
2
\Memory\Available Bytes	
3
\Memory\Page Reads/sec	
4
\Memory\Pages Input/sec	
5
\PhysicalDisk(_Total)\Disk Read Bytes/sec	
6
\PhysicalDisk(_Total)\Disk Reads/sec
7
;Process(soffice.bin, symphony.exe, java.exe)
8
\Process(soffice.bin)\% Processor Time	
9
\Process(soffice.bin)\Handle Count	
10
\Process(soffice.bin)\Private Bytes	
11
\Process(soffice.bin)\Thread Count	
12
\Process(soffice.bin)\Working Set
(-)data/pvt_benchmark/perfmon/resumeCounters.bat (+2 lines)
Line 0 Link Here
1
logman start pvt
2
exit
(-)data/pvt_benchmark/perfmon/stopCounters.bat (+1 lines)
Line 0 Link Here
1
logman stop pvt
(-)data/pvt_benchmark/perfmon/createCounters.bat (+6 lines)
Line 0 Link Here
1
logman stop pvt
2
logman delete counter pvt
3
logman create counter pvt -cf %2
4
logman update pvt -si 10 -f csv -o %1
5
logman start pvt
6
exit

Return to issue 120289