public static final int MAX_BINARY_COUNT = (int) Math.pow(2, 16); // 65535
public static final int MAX_FUNCTION_COUNT = (int) Math.pow(2, 20); // 1,048,576
public static final int MAX_FUNCTION_ARGUMENTS_COUNT = FUNCTION_ARGUMENTS_FORMAT_LENGTH; // Because "MAX_FUNCTION_ARGUMENTS_COUNT < FUNCTION_ARGUMENTS_FORMAT_LENGTH" is always true
+ public static final long MAX_DAEMON_LOG_SIZE = 1024*1024; // 1 mega byte
// Leak
public static final int MAX_LEAK_CHECK_BUFFER_SIZE = (int) Math.pow(2, 20); // 1,048,576
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
+import org.tizen.dynamicanalyzer.common.DALimit;
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.common.path.PathConstants;
public static void pullDaemonLog() {
final String from = PathConstants.DA_DAEMON_LOG_PATH;
- final String to = PathManager.DA_LOG_PATH + File.separator + DAEMONLOG_PREFIX
- + PathManager.getLogPostFix();//$NON-NLS-1$
- SyncResult res = CommunicatorUtils.pull(from, to);
- if (null != res && res.isOk()) {
- Logger.debug("daemon log copying success!!");//$NON-NLS-1$
- } else {
- Logger.debug("Failed to get " + from); //$NON-NLS-1$
+ String command = AnalyzerShellCommands.CMD_GET_FILE_SIZE + CommonConstants.SPACE + from;
+
+ cmdResultMultiLines.clear();
+ CommunicatorUtils.execShellCommand(command, new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ for (int i = 0; i < lines.length; i++) {
+ cmdResultMultiLines.add(lines[i]);
+ }
+ }
+ });
+
+ long filesize = -1;
+ if (cmdResultMultiLines.size() > 0) {
+ filesize = Long.parseLong(cmdResultMultiLines.get(0));
}
- AnalyzerUtil.checkLogs(PathManager.DA_LOG_PATH, DAEMONLOG_PREFIX, DAEMONLOG_COUNT);
+ if (filesize > 0 && filesize < DALimit.MAX_DAEMON_LOG_SIZE) {
+ final String to = PathManager.DA_LOG_PATH + File.separator + DAEMONLOG_PREFIX
+ + PathManager.getLogPostFix();//$NON-NLS-1$
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && res.isOk()) {
+ Logger.debug("daemon log copying success!!");//$NON-NLS-1$
+ } else {
+ Logger.debug("Failed to get " + from); //$NON-NLS-1$
+ }
+
+ AnalyzerUtil.checkLogs(PathManager.DA_LOG_PATH, DAEMONLOG_PREFIX, DAEMONLOG_COUNT);
+ } else {
+ Logger.debug("daemon log file is too large or does not exist");
+ }
}
// public static String getLocalhost() {