📄 logfileanalyse.java
字号:
/**
*
*/
package logfileAnalyse;
/**
* @author Jack
*
*/
public class LogfileAnalyse {
/**
* @param args
*/
public static void main(String[] args) {
double begin = 0, end = 0;
if (args.length == 0) {
System.err.println("Please input the log file!");
System.err.println("Usage Example: LogfileAnalyse test.log");
return;
}
else {
if(args[0].endsWith(".log"))
{
EventCount ec = new EventCount(args[0]);
ProcessCount pc = new ProcessCount(args[0]);
ProcessRunTime pt = new ProcessRunTime(args[0]);
ec.calculate();
pc.calculate();
pt.calculate();
begin = ec.getBegin();
end = ec.getEnd();
System.out.println(ec);
System.out.println(pc);
System.out.println(pt);
if( (end - begin) <= 0 ) {
System.out.println("Calculating time error!");
return;
}
else
System.out.printf("Processing data/onelog (%d events) took %2.2f seconds at %2.2f events/second",
ec.getTotalEvents(), (end - begin)/1000, ec.getTotalEvents()*1000/(end - begin));
}
else {
System.err.println("The input file incorrect! Please try again...");
System.err.println("Usage Example: LogfileAnalyse test.log");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -