InstallProgressMonitor monitor) throws IMExitException, IMNetworkException{
Log.log("InstallManager.install() installable packages : " + installablePackages);
+ //performance measurement
+ Performance.sdkPackageSize = packageManager.getTotalSizeOfInstallablePackages(installablePackages, true);
+
if (installablePackages == null || targetDir == null || targetDir.isEmpty()) {
Log.err("packaegs => " + installablePackages + ", targetDir => "
+ targetDir);
mConfig.setTargetDir(targetDir);
+ Performance.setDownloadStartTime();
+
// download packages from repository
if (downloadPackages(installablePackages, monitor)) {
Log.log("Success to download packages from repository.");
}
}
}
+
+ Performance.setDownloadEndTime();
+ Performance.setInstallationStartTime();
// save target directory
initializeTargetDir(targetDir);
ErrorController.setInfoCode(InfoCode.RESTART_THE_COMPUTER);
}
+ Performance.setInstallationEndTime();
+
return true;
}
import org.tizen.installmanager.util.PathUtil;
public class Performance {
+ //total time
private static Date imStartTime = null;
private static Date imEndTime = null;
+
+ //initialize time
+ private static Date initializeStartTime = null;
+ private static Date initializeEndTime = null;
+
+ //download time
+ private static Date downloadStartTime = null;
+ private static Date downloadEndTime = null;
+
+
+ //installation time
private static Date installationStartTime = null;
private static Date installationEndTime = null;
+ //uninstallation time
+ private static Date uninstallStartTime = null;
+ private static Date uninstallEndTime = null;
+
+ //information
+ public static long sdkPackageSize = 0;
+
+
public static void setIMStartTime() {
imStartTime = new Date();
}
imEndTime = new Date();
}
+ public static void setInitializeStartTime() {
+ initializeStartTime = new Date();
+ }
+
+ public static void setInitializeEndTime() {
+ initializeEndTime = new Date();
+ }
+
+ public static void setDownloadStartTime() {
+ downloadStartTime = new Date();
+ }
+
+ public static void setDownloadEndTime() {
+ downloadEndTime = new Date();
+ }
+
public static void setInstallationStartTime() {
installationStartTime = new Date();
}
installationEndTime = new Date();
}
+ public static void setUninstallStartTime() {
+ uninstallStartTime = new Date();
+ }
+
+ public static void setUninstallEndTime() {
+ uninstallEndTime = new Date();
+ }
+
public static void printToLogFile() {
Log.log("The installmanager start time : " + imStartTime);
Log.log("The installmanager end time : " + imEndTime);
Log.log("The installation start time : " + installationStartTime);
Log.log("The installation end time : " + installationEndTime);
- long progressSecond = getProgressTimeOfInstallation()/1000;
+ long progressSecond = getInstallationTime()/1000;
if (progressSecond >= 0) {
Log.log("The progress time of the installation : About " + progressSecond/60 + " minutes"
try {
out = new BufferedWriter(new FileWriter(testResultFile));
- out.write("*** InstallManager performance test ***");
+ out.write("*** InstallManager performance test ***");
+ out.newLine();
+ out.write("The initialization time\t: " + getInitializeTime() + "sec");
+ out.write("(" + getBitPerSecond(sdkPackageSize, getInitializeTime())+ "b/s)");
out.newLine();
+ out.write("The download time\t: " + getDownloadTime() + "sec");
+ out.write("(" + getBitPerSecond(sdkPackageSize, getDownloadTime())+ "b/s)");
out.newLine();
- out.write("The installmanager start time\t: " + imStartTime);
+ out.write("The installation time\t: " + getInstallationTime() + "sec");
+ out.write("(" + getBitPerSecond(sdkPackageSize, getInstallationTime())+ "b/s)");
out.newLine();
- out.write("The installmanager end time\t: " + imEndTime);
+ out.write("The removal time\t: " + getUninstallTime() + "sec");
+ out.write("(" + getBitPerSecond(sdkPackageSize, getUninstallTime())+ "b/s)");
out.newLine();
- out.write("The installation start time\t: " + installationStartTime);
+ out.write("The install-manager start time\t: " + imStartTime);
out.newLine();
- out.write("The installation end time\t: " + installationEndTime);
+ out.write("The install-manager end time\t: " + imEndTime);
out.newLine();
out.newLine();
- long progressSecond = getProgressTimeOfInstallation()/1000;
+ long progressSecond = getTotalTime();
if (progressSecond >= 0) {
out.write("* Total time to install : About " + progressSecond/60 + " minutes"
}
}
- private static long getProgressTimeOfInstallation() {
+ private static long getInitializeTime() {
+ if (initializeStartTime == null || initializeEndTime == null) {
+ return 0;
+ }
+
+ long interval = (initializeEndTime.getTime() - initializeStartTime.getTime())/1000;
+ return interval;
+ }
+
+ private static long getDownloadTime() {
+ if (downloadStartTime == null || downloadEndTime == null) {
+ return 0;
+ }
+
+ long interval = (downloadEndTime.getTime() - downloadStartTime.getTime())/1000;
+ return interval;
+ }
+
+ private static long getTotalTime() {
+ if (imStartTime == null || imEndTime == null) {
+ return 0;
+ }
+
+ long interval = (imEndTime.getTime() - imStartTime.getTime())/1000;
+ return interval;
+ }
+
+ private static long getInstallationTime() {
if (installationStartTime == null || installationEndTime == null) {
- return -1;
+ return 0;
}
- long interval = installationEndTime.getTime() - installationStartTime.getTime();
+ long interval = (installationEndTime.getTime() - installationStartTime.getTime())/1000;
return interval;
}
+
+ private static long getUninstallTime() {
+ if (uninstallStartTime == null || uninstallEndTime == null) {
+ return 0;
+ }
+
+ long interval = (uninstallEndTime.getTime() - uninstallStartTime.getTime())/1000;
+ return interval;
+ }
+
+ private static long getBitPerSecond(long size, long seconds) {
+ if (seconds == 0) {
+ return 0;
+ } else {
+ return size/seconds;
+ }
+ }
}
shell.getDisplay().asyncExec(new Runnable(){
public void run() {
//initialize installmanager
- if (!Options.doInitTest) {
- progressbar.updateName("Connecting to package server.\nIt may take a minute...");
- }
+ progressbar.updateName("Connecting to package server.\nIt may take a minute...");
shell.getDisplay().asyncExec(new Runnable() {
public void run() {
});
//init end
- if (!Options.doInitTest) {
- progressbar.finish();
- }
+ progressbar.finish();
}
});
if (!shell.isDisposed()) {
- if (!Options.doInitTest) {
- progressbar.open();
- }
+ progressbar.open();
}
Log.log("Window init end");
* @param args
*/
public static void main(String args[]) {
+ //performance measurement
Performance.setIMStartTime();
+
InstallManager.deleteTempFile();
Log.open();
window.init();
- if (Options.doInitTest) {
- System.exit(0);
- }
-
Log.log("after init");
if (Options.checkPackageUpdate) {
checkMetaPackageUpdate();
ProgramController.createProgramController().removeSDKTempDir();
}
+ //performance measurement
Performance.setIMEndTime();
Performance.printToLogFile();
* @throws IMExitException
*/
public boolean install(Collection<String> installList, String targetPath,
- InstallProgressMonitor monitor) throws IMExitException {
- Performance.setInstallationStartTime();
-
+ InstallProgressMonitor monitor) throws IMExitException {
Log.log("======== Start Installing ========");
Log.log("Selected package list => " + installList);
Log.log("target path => " + targetPath);
PathUtil.remove(Config.getInstance().getDownloadDirPath());
}
- Performance.setInstallationEndTime();
return bResult;
}
* @return If uninstallation is succeed, return true. if not return false.
* @see ViewController#uninstallPackages(PackageSet, IIMProgressMonitor)
*/
- public boolean uninstall(List<String> uninstallList, IIMProgressMonitor monitor) {
- Performance.setInstallationStartTime();
-
+ public boolean uninstall(List<String> uninstallList, IIMProgressMonitor monitor) {
Log.log("ViewController Uninstall Start => " + uninstallList);
+
+ //performance measurement
+ Performance.setUninstallStartTime();
if (packageManager == null || uninstallList.size() == 0) {
Log.err("ViewController.uninstall() uninstalllist does not exist. => " + uninstallList);
ErrorController.setError(ErrorCode.UNKNOWN_ERROR);
+
+ Performance.setUninstallEndTime();
return false;
}
if (Options.doRemoveOldSDK || (uninstallList.size() == 1 && uninstallList.get(0).equals(Config.SDK_NAME))) {
uninstallAll(monitor);
- Performance.setInstallationEndTime();
+
+ //performance measurement
+ Performance.setUninstallEndTime();
+
return true;
} else {
PackageSet removablePackages = packageManager.getInstalledPackagesByName(uninstallList);
+ //performance measurement
+ Performance.sdkPackageSize = packageManager.getTotalSizeOfRemovablePackages(removablePackages);
+
boolean result = uninstallPackages(removablePackages, monitor);
- Performance.setInstallationEndTime();
+
+ //performance measurement
+ Performance.setUninstallEndTime();
return result;
}
}