|
package JavaPerf;
public class StartupTest {
public static void main(String[] args) {
long mainEntryTime = System.currentTimeMillis();//miliseconds since since 1970/1/1
int result = 0;
if (args.length > 0)
{
//FileTimeUtc adjusted for java epoch
long fileTimeUtc = Long.parseLong(args[0]);//100 nanoseconds units since 1601/1/1
long launchTime = fileTimeUtc - 116444736000000000L;//100 nanoseconds units since 1970/1/1
launchTime /= 10000;//miliseconds since since 1970/1/1
result = (int)(mainEntryTime - launchTime);
//System.out.println("startup time " + result+ " ms");
}
else
{
try
{
System.gc();
System.runFinalization();
Thread.sleep(5000);
}
catch (Exception e)
{
e.printStackTrace();
}
}
java.lang.System.exit(result);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.