1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
package com.sun.star.filter.config.tools.utils;
//_______________________________________________
// imports
import java.util.*;
import java.lang.*;
//_______________________________________________
// implementation
public class AnalyzeStartupLog
{
private class OperationTime
{
/** name the measured operation. */
public java.lang.String sOperation;
/** contains the time value, when this operation was started. */
public long nStartTime;
/** contains the time value, when this operation was finished. */
public long nEndTime;
/** text inside log file, which identifies the start time value. */
public java.lang.String sStartMsg;
/** text inside log file, which identifies the end time value. */
public java.lang.String sEndMsg;
}
//_________________________________
// main
public static void main(java.lang.String[] lCmdLine)
{
int nExit = 0;
try
{
// analyze command line
ConfigHelper aCmdLine = new ConfigHelper("", lCmdLine);
java.lang.String sLogDir = aCmdLine.getString("logdir" );
java.lang.String sDataFile = aCmdLine.getString("datafile");
if (sLogDir == null || sDataFile == null)
{
System.err.println("AnalyzeStartupLog lodir=<dir> datafile=<file>");
System.err.println("E.g.: AnalyzeStartupLog lodir=c:\\temp\\logs datafile=c:\\temp\\data.csv");
System.exit(--nExit);
}
// get list of all log files
boolean bRecursive = true;
java.util.Vector lLogs = FileHelper.getSystemFilesFromDir(new java.io.File(sLogDir), bRecursive);
if (lLogs == null || lLogs.isEmpty())
{
System.err.println("log dir is empty");
System.exit(--nExit);
}
// analyze it
java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
sOut.append("log;t_cfg_start;t_cfg_end;t_fwk_start;t_fwk_end;t_sfx_start;t_sfx_end;t_types_start;t_types_end;t_filters_start;t_filters_end;");
sOut.append("t_filters_swriter_start;t_filters_swriter_end;t_filters_sweb_start;t_filters_sweb_end;t_filters_sglobal_start;t_filters_sglobal_end;t_filters_scalc_start;t_filters_scalc_end;t_filters_sdraw_start;t_filters_sdraw_end;t_filters_simpress_start;t_filters_simpress_end;t_filters_schart_start;t_filters_schart_end;t_filters_smath_start;t_filters_smath_end;");
sOut.append("t_others_start;t_others_end;d_cfg;d_fwk;d_sfx;d_types;d_filters;d_others;d_complete\n");
java.util.Enumeration aIt = lLogs.elements();
while (aIt.hasMoreElements())
{
java.io.File aLog = (java.io.File)aIt.nextElement();
java.io.FileReader aReader = new java.io.FileReader(aLog);
java.io.BufferedReader aBuffer = new java.io.BufferedReader(aReader);
long t_cfg_start = 0;
long t_cfg_end = 0;
long t_fwk_start = 0;
long t_fwk_end = 0;
long t_sfx_start = 0;
long t_sfx_end = 0;
long t_types_start = 0;
long t_types_end = 0;
long t_filters_start = 0;
long t_filters_end = 0;
long t_filters_swriter_start = 0;
long t_filters_swriter_end = 0;
long t_filters_sweb_start = 0;
long t_filters_sweb_end = 0;
long t_filters_sglobal_start = 0;
long t_filters_sglobal_end = 0;
long t_filters_scalc_start = 0;
long t_filters_scalc_end = 0;
long t_filters_sdraw_start = 0;
long t_filters_sdraw_end = 0;
long t_filters_simpress_start = 0;
long t_filters_simpress_end = 0;
long t_filters_schart_start = 0;
long t_filters_schart_end = 0;
long t_filters_smath_start = 0;
long t_filters_smath_end = 0;
long t_others_start = 0;
long t_others_end = 0;
while (true)
{
java.lang.String sLine = aBuffer.readLine();
if (sLine == null)
break;
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { creation ConfigItem [file=standard, version=6, mode=3]"))
t_cfg_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } creation ConfigItem"))
t_cfg_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : { reading TypeDetection.xml"))
t_fwk_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("| framework (as96863) ::FilterCache::FilterCache : } reading TypeDetection.xml"))
t_fwk_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadTypes"))
t_types_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadTypes"))
t_types_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadFilters"))
t_filters_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadFilters"))
t_filters_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [swriter]"))
t_filters_swriter_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [swriter]"))
t_filters_swriter_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [sweb]"))
t_filters_sweb_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [sweb]"))
t_filters_sweb_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [sglobal]"))
t_filters_sglobal_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [sglobal]"))
t_filters_sglobal_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [scalc]"))
t_filters_scalc_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [scalc]"))
t_filters_scalc_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [sdraw]"))
t_filters_sdraw_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [sdraw]"))
t_filters_sdraw_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [simpress]"))
t_filters_simpress_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [simpress]"))
t_filters_simpress_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [schart]"))
t_filters_schart_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [schart]"))
t_filters_schart_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ reading FilterGroup [smath]"))
t_filters_smath_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} reading FilterGroup [smath]"))
t_filters_smath_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("{ framework (as96863) ::FilterCFGAccess::impl_loadDetectors"))
t_others_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} framework (as96863) ::FilterCFGAccess::impl_loadContentHandlers"))
t_others_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} framework (as96863) ::FilterCache::FilterCache"))
t_sfx_start = new java.lang.Long(sLine.substring(0, 6)).longValue();
else
if (sLine.endsWith("} desktop (lo119109) OfficeWrapper::OfficeWrapper"))
t_sfx_end = new java.lang.Long(sLine.substring(0, 6)).longValue();
}
sOut.append(aLog.getName() );
sOut.append(";" );
sOut.append(t_cfg_start );
sOut.append(";" );
sOut.append(t_cfg_end );
sOut.append(";" );
sOut.append(t_fwk_start );
sOut.append(";" );
sOut.append(t_fwk_end );
sOut.append(";" );
sOut.append(t_sfx_start );
sOut.append(";" );
sOut.append(t_sfx_end );
sOut.append(";" );
sOut.append(t_types_start );
sOut.append(";" );
sOut.append(t_types_end );
sOut.append(";" );
sOut.append(t_filters_start );
sOut.append(";" );
sOut.append(t_filters_end );
sOut.append(";" );
sOut.append(t_filters_swriter_start );
sOut.append(";" );
sOut.append(t_filters_swriter_end );
sOut.append(";" );
sOut.append(t_filters_sweb_start );
sOut.append(";" );
sOut.append(t_filters_sweb_end );
sOut.append(";" );
sOut.append(t_filters_sglobal_start );
sOut.append(";" );
sOut.append(t_filters_sglobal_end );
sOut.append(";" );
sOut.append(t_filters_scalc_start );
sOut.append(";" );
sOut.append(t_filters_scalc_end );
sOut.append(";" );
sOut.append(t_filters_sdraw_start );
sOut.append(";" );
sOut.append(t_filters_sdraw_end );
sOut.append(";" );
sOut.append(t_filters_simpress_start );
sOut.append(";" );
sOut.append(t_filters_simpress_end );
sOut.append(";" );
sOut.append(t_filters_schart_start );
sOut.append(";" );
sOut.append(t_filters_schart_end );
sOut.append(";" );
sOut.append(t_filters_smath_start );
sOut.append(";" );
sOut.append(t_filters_smath_end );
sOut.append(";" );
sOut.append(t_others_start );
sOut.append(";" );
sOut.append(t_others_end );
sOut.append(";" );
sOut.append(t_cfg_end -t_cfg_start );
sOut.append(";" );
sOut.append(t_fwk_end -t_fwk_start );
sOut.append(";" );
sOut.append(t_sfx_end -t_sfx_start );
sOut.append(";" );
sOut.append(t_types_end -t_types_start );
sOut.append(";" );
sOut.append(t_filters_end-t_filters_start);
sOut.append(";" );
sOut.append(t_others_end -t_others_start );
sOut.append(";" );
sOut.append(t_others_end -t_cfg_start );
sOut.append("\n" );
aBuffer.close();
}
java.io.FileWriter aCSV = new java.io.FileWriter(sDataFile);
java.lang.String sData = sOut.toString();
aCSV.write(sData, 0, sData.length());
aCSV.flush();
aCSV.close();
}
catch(java.lang.Throwable exAny)
{
System.err.println(exAny.getMessage());
exAny.printStackTrace();
System.exit(--nExit);
}
System.exit(0);
}
}
|