Commit 3436512f authored by Daniel Honsel's avatar Daniel Honsel
Browse files

added total processing time as output

parent da9a7924
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class TTCN3ResourceProvider {

		TTCN3StatisticsProvider.getInstance().setParsingCompleted(true);
		System.out.println("Test suite parsed in "
				+ MiscTools.secondsToString(TTCN3StatisticsProvider
				+ MiscTools.msToString(TTCN3StatisticsProvider
						.getInstance().getParseTime()) + " minutes.");
	}

@@ -110,7 +110,7 @@ public class TTCN3ResourceProvider {
								.elapsed(TimeUnit.SECONDS)) + " minutes).");

		TTCN3StatisticsProvider.getInstance().addParseTime(
				stopwatch.elapsed(TimeUnit.SECONDS));
				stopwatch.elapsed(TimeUnit.MILLISECONDS));
		stopwatch.reset();
	}

@@ -143,7 +143,7 @@ public class TTCN3ResourceProvider {
							.elapsed(TimeUnit.SECONDS)) + " minutes).");

			TTCN3StatisticsProvider.getInstance().addAnalyzeTime(
					stopwatch.elapsed(TimeUnit.SECONDS));
					stopwatch.elapsed(TimeUnit.MILLISECONDS));
			stopwatch.reset();
		}

@@ -168,8 +168,13 @@ public class TTCN3ResourceProvider {
		}

		System.out.println("Test suite analyzed in "
				+ MiscTools.secondsToString(TTCN3StatisticsProvider
						.getInstance().getAnalyzeTime()) + " minutes.");
				+ MiscTools.msToString(TTCN3StatisticsProvider
						.getInstance().getAnalyzeTime()) + " minutes." + '\n');
		
		System.out.println("Total processing time: "
				+ MiscTools.msToString(TTCN3StatisticsProvider
						.getInstance().getAnalyzeTime() + TTCN3StatisticsProvider
						.getInstance().getParseTime()) + " minutes." + '\n');				
	}

	private void validate(Resource resource) {
+20 −8
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.DecimalFormat;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@@ -75,7 +76,8 @@ public class MiscTools {
				e.printStackTrace();
			}
		} catch (SecurityException se) {
			System.out.println("IO ERROR: Could not create ouput files and / or directories!" + "Caused by: \"" + filename + "\"");
			System.out.println(
					"IO ERROR: Could not create ouput files and / or directories!" + "Caused by: \"" + filename + "\"");
		}

	}
@@ -85,7 +87,8 @@ public class MiscTools {
			File targetFile = new File(targetFilename);
			if (!targetFile.getParentFile().exists()) {
				if (!targetFile.getParentFile().mkdirs()) {
					System.out.println("IO ERROR: Creating the directory structure for \"" + targetFilename + "\" failed!");
					System.out.println(
							"IO ERROR: Creating the directory structure for \"" + targetFilename + "\" failed!");
				}
			}
			FileOutputStream outStream = new FileOutputStream(targetFile);
@@ -96,7 +99,8 @@ public class MiscTools {
					outStream.write(c);
				}
			} catch (IOException e) {
				System.out.println("IO ERROR: Caused while copying: \"" + sourceFilename + "\" to \"" + targetFilename + "\"");
				System.out.println(
						"IO ERROR: Caused while copying: \"" + sourceFilename + "\" to \"" + targetFilename + "\"");
			}
		} catch (FileNotFoundException e1) {
			System.out.println("IO ERROR: File not found: \"" + sourceFilename + " / " + targetFilename + "\"");
@@ -124,6 +128,14 @@ public class MiscTools {
		return string;
	}

	public static String msToString(long millis) {
		String res = String.format("%d:%02d", 
				TimeUnit.MILLISECONDS.toMinutes(millis),
				TimeUnit.MILLISECONDS.toSeconds(millis)
				- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)));
		return res;
	}

	public static String secondsToString(long seconds) {
		int minutes = (int) seconds / 60;
		int remainder = (int) seconds % 60;