--- /dev/null
- import org.tizen.dynamicanalyzer.util.DALogger;
+package org.tizen.dynamicanalyzer.ui.file.manager;
+
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeran Lim <hyeran74.kim@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+import java.util.ArrayList;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DALimit;
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.FilePageLabels;
+import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.data.FileData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
+import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
+import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
- private static final DALogger DA_LOG = DALogger.getInstance();
-
++import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
+
+public class FileDataMaker {
- DA_LOG.debug(">>probe pid:" + input.getPid()
+ // from LogPackage to...
+ private List<FileStatus> fileStatusList = new ArrayList<FileStatus>();
+ private List<FileAccess> fileAccessList = new ArrayList<FileAccess>();
+ private List<FileEvent> fileApiList = new ArrayList<FileEvent>();
+
+
+ // to find file path, (key(PID, TID, FD), value (file_path))
+ private Map<String, String> fileAccessorMap = new HashMap<String, String>();
+
+ // temporary, file log list for 1second
+ private Queue<List<FileEvent>> fileLogsQueue = new ConcurrentLinkedQueue<List<FileEvent>>();
+
+ // (key(file path), value (read_count or write_count))
+ private Map<String, Integer> concurrentReadNumMap = new HashMap<String, Integer>();
+ private Map<String, Integer> concurrentWriteNumMap = new HashMap<String, Integer>();
+ private Map<String, Integer> concurrentAccessNumMap = new HashMap<String, Integer>();
+ private Map<String, Integer> lockNumMap = new HashMap<String, Integer>();
+ private List<HashSet<Object>> lockWaitingAccessor = new ArrayList<HashSet<Object>>();
+
+ // for filtering out non-target file from syscall messages
+ List<String> accessedFilePathList = new ArrayList<String>();
+
+ // temporary, to check if open event has been sent before the event has been sent
+ private Map<String, FileEvent> sysCallMap = new HashMap<String, FileEvent>();
+ private List<Long> sysLockedFd = new ArrayList<Long>();
+ // for searching entry message from exit message
+ Map<Integer, FileEvent> entryMap = new HashMap<Integer, FileEvent>();
+
+ // temp
+ private List<Long> sentOpenEventList = new ArrayList<Long>();
+
+ public FileDataMaker() {}
+
+ public void clear(){
+ fileStatusList.clear();
+ fileAccessList.clear();
+ fileAccessorMap.clear();
+ concurrentReadNumMap.clear();
+ concurrentWriteNumMap.clear();
+ sysCallMap.clear();
+ accessedFilePathList.clear();
+ entryMap.clear();
+ }
+
+ public void makeData(LogPackage pack) {
+ if (!AnalyzerManager.isRunning()) {
+ return;
+ }
+ /*
+ * TODO: considering the start of trace when the process is running
+ * for not-open event
+ * 1) make fake open event: time: start trace time (0sec) => FileDataMaker...., add field: isFake
+ */
+
+ List<FileEvent> fileEventList = new ArrayList<FileEvent>();
+
+ // 1. In case of target process that the user is interested to analyze
+ ArrayList<List<Object>> fileApiList = new ArrayList<List<Object>>();
+ Logs probeLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
+
+ if(null != probeLogs && probeLogs.getRawLogs().size() != 0) {
+ List<LogData> inputs = probeLogs.getLogs();
+ FileEvent event = null;
+
+ for (int i = 0; i < inputs.size(); i++) {
+ FileData input = (FileData) inputs.get(i);
+
+ // filtering out internal call
+ // some internal calls are sent when the open or close event to check leak
+ if (ConfigurationDialogDataManager.getInstance()
+ .getfeatureValue(
+ ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) {
+ if (input.isInternal()) {
+ continue;
+ }
+ }
+ // filtering out print log and main func log
+ // TODO: DISCUSSION: checkInvalidApiName: make the SWAP not send
+ // TODO: DISCUSSION: isOpenMainLog: why osp main?
+ if (checkInvalidApiName(input) || isOpenMainLog(input)) {
+ continue;
+ }
+
+ // make failed API list
+ if (input.getErrno() != 0) {
+ SummaryDataManager.getInstance().getFailedApiDataMaker().makeData(input);
+ }
+
+ long fd = input.getFdValue();
+ if(input.getFdApiType() == LogCenterConstants.FD_API_TYPE_OPEN){
+ accessedFilePathList.add(input.getFilePath());
+ // TODO temp code
+ sentOpenEventList.add(fd);
+ }
+
- DA_LOG.debug(">> syscall:seq:" + seq + ", pid:" + pid
++ Logger.debug(">>probe pid:" + input.getPid()
+ + ", tid:" + input.getTid() + ", fd:" + input.getFdValue()
+ + ", type:" + input.getFdApiType()
+ + ", filePath:" + input.getFilePath() + ", err:" + input.getErrno() );
+
+ if(sentOpenEventList.contains(fd)) {
+ event = new FileEvent(input.getSeq(), input.getFilePath(),
+ input.getPid(), input.getTid(), input.getFdValue(),
+ input.getFdApiType(), input.getApiName(),
+ input.getTime(), input.getFileSize(), input.getSize(),
+ input.getArgs(), input.getReturn(), input.getErrno(),
+ true);
+ addFileEvent(fileEventList, event, input);
+ }
+
+ // TODO temp code
+ if (input.getFdApiType() == LogCenterConstants.FD_API_TYPE_CLOSE) {
+ sentOpenEventList.remove(fd);
+ }
+ }
+ }
+
+ // 2. In case of non-target process that the user is not interested but access the target files
+ Logs syscallLogs = pack.getLogs(DataChannelConstants.MSG_FUCNTION_ENTRY_EXIT);
+ if (syscallLogs != null) {
+ ProfileData profileData = null;
+ FileEvent event = null;
+ String filePath = null;
+ long fd = 0;
+
+ List<LogData> inputs = syscallLogs.getLogs();
+ for (int i = 0; i < inputs.size(); i++) {
+ LogData input = (LogData) inputs.get(i);
+ profileData = (ProfileData) input;
+ int seq = profileData.getSeq();
+ int pid = profileData.getPid();
+ int tid = profileData.getTid();
+ long time = profileData.getTime();
+ int eventType = profileData.getProbeSubType();
+
++ Logger.debug(">> syscall:seq:" + seq + ", pid:" + pid
++ + ", tid:" + tid + ", type:" + eventType );
++
+ switch (profileData.getId()) {
+ case DataChannelConstants.MSG_FUNCTION_ENTRY:
+ // get file path and FD from args : string of "file_path,fd"
+ String args = profileData.getArgs();
+ String[] splitPath = args.split(",\\s+");
+ filePath = splitPath[0];
+ fd = Long.parseLong(splitPath[1]);
+ FileEvent openEvent = null;
+
+ // filtering out non-target files that user in not interested
+ if(accessedFilePathList.contains(filePath)) {
+ // target file
- DA_LOG.debug(">> syscall end :seq:" + seq + ", pid:" + pid
++ Logger.debug(">> syscall:seq:" + seq + ", pid:" + pid
+ + ", tid:" + tid + ", type:" + eventType + ", args:" + args);
+
+ event = new FileEvent(seq, pid, tid, fd, filePath, eventType, time, 0, false);
+ if(fd == -1) {
+ event.setErrNo(-1);
+ }
+ switch(eventType) {
+ case LogCenterConstants.FD_API_TYPE_OPEN:
+ sysCallMap.put(filePath, event);
+ addFileEvent(fileEventList, event, null);
+ break;
+ case LogCenterConstants.FD_API_TYPE_CLOSE:
+ openEvent = sysCallMap.get(filePath);
+ if(openEvent != null) {
+ if(sysLockedFd.contains(fd)) {
+ sysLockedFd.remove(fd);
+ }
+ addFileEvent(fileEventList, event, null);
+ }
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_START:
+ openEvent = sysCallMap.get(filePath);
+ if(openEvent == null) {
+ // make fake open event
+ openEvent = new FileEvent(0, pid,
+ tid, fd, filePath,
+ LogCenterConstants.FD_API_TYPE_OPEN,
+ time, 0, false);
+ addFileEvent(fileEventList, openEvent, null);
+ }
+ sysLockedFd.add(fd);
+ addFileEvent(fileEventList, event, null);
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_END:
+ if(sysLockedFd.contains(fd)) {
+ addFileEvent(fileEventList, event, null);
+ }
+ break;
+ case LogCenterConstants.FD_API_TYPE_READ_START:
+ case LogCenterConstants.FD_API_TYPE_WRITE_START:
+ openEvent = sysCallMap.get(filePath);
+ if(openEvent == null) {
+ // make fake open event
+ openEvent = new FileEvent(0, pid,
+ tid, fd, filePath,
+ LogCenterConstants.FD_API_TYPE_OPEN,
+ time, 0, false);
+ addFileEvent(fileEventList, openEvent, null);
+ }
+ entryMap.put(seq, event);
+ addFileEvent(fileEventList, event, null);
+ break;
+ default:
+ break;
+ }
+ }// else, non-target file
+ break;
+ case DataChannelConstants.MSG_FUNCTION_EXIT:
+ // for creating read/write end event with MSG_FUNCTION_EXIT
+ if(Long.parseLong(profileData.getReturn()) == -1) {
+ event.setErrNo(-1);
+ }
+ int entrySeq = profileData.getEntrySeq();
+ if(entryMap.containsKey(entrySeq)) {
- DA_LOG.error(" addFileAccessor:" + key + "is aleady exist" );
++ Logger.debug(">> syscall end :seq:" + seq + ", pid:" + pid
+ + ", tid:" + tid + ", type:" + eventType);
+ event = entryMap.get(entrySeq);
+ switch(eventType) {
+ case LogCenterConstants.FD_API_TYPE_READ_START:
+ event.setFdApiType(LogCenterConstants.FD_API_TYPE_READ_END);
+ addFileEvent(fileEventList, event, null);
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_START:
+ event.setFdApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
+ addFileEvent(fileEventList, event, null);
+ break;
+ default:
+ break;
+ }
+ }// else, dump read/write end event
+ break;
+ }
+ }
+ }
+
+ // insert to DB: file API Table
+ if(fileEventList.size() > 0) {
+ for(FileEvent data : fileEventList) {
+ fileApiList.add(data.getDBData());
+ }
+ fileLogsQueue.add(fileEventList);
+ FileDataManager.getInstance().getApiDB().insert((List<List<Object>>)fileApiList);
+ }
+ }
+
+ /**
+ * Add FileEvent list into eventList
+ * @param list: target probe list for all file event
+ * @param event: original file event
+ * set event to list
+ */
+ public void addFileEvent(List<FileEvent> fileEventList, FileEvent event, FileData logData ) {
+
+ // check heap memory
+ checkFileAnalysisLimit();
+
+ int pid = event.getPid();
+ int tid = event.getTid();
+ long fd = event.getFdValue();
+ String filePath = event.getFilePath();
+ int apiType = event.getFdApiType();
+ long eventTime = event.getTime();
+ boolean isTarget = event.isTarget();
+
+ long size = event.getSize();
+ long errNo = event.getErrno();
+ String key = null;
+
+ if(isTarget) {
+ key = createKey(pid, tid, fd);
+ if(fd == -1) {
+ // set the unknown file if the file open or close has been failed
+ event.setFilePath(FilePageLabels.FILE_CHART_UNKNOWN_FILE);
+ } else if(filePath == null || filePath.equals("")) {
+ // set the file path to all normal file event that open and close was succeed
+ filePath = getFilePath(key);
+ event.setFilePath(filePath);
+ }
+ }
+
+ switch (apiType) {
+ case LogCenterConstants.FD_API_TYPE_OPEN:
+ if(isTarget && errNo == 0) {
+ addFileAccessor(key, filePath);
+ }
+ addStatusData(new FileStatus(pid, tid, fd, filePath,
+ apiType, eventTime, errNo));
+ break;
+ case LogCenterConstants.FD_API_TYPE_CLOSE:
+ if(isTarget && errNo == 0) {
+ removeFileAccessor(key);
+ }
+ addStatusData(new FileStatus(pid, tid, fd, filePath,
+ apiType, eventTime, errNo));
+ break;
+ case LogCenterConstants.FD_API_TYPE_READ_START:
+ FileAccess readAccess = new FileAccess(filePath, pid,
+ tid, fd, apiType, eventTime);
+
+ if(isLockWaitingAccessor(pid, tid)) {
+ addEndAccessData(pid, tid, fd, filePath, eventTime,
+ size, LogCenterConstants.FD_API_TYPE_LOCK_WAIT_END, 0);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_START, eventTime));
+ }else{
+ if(checkConcurrentAccess(filePath)) {
+ readAccess.setWarning();
+ SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ logData,
+ FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
+ FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
+ WarningCase.CONCURRENT_ACCESS.getType());
+ }
+ }
+ addStartAccessData(readAccess);
+ break;
+ case LogCenterConstants.FD_API_TYPE_READ_END:
+ addEndAccessData(pid, tid, fd, filePath, eventTime,
+ size, LogCenterConstants.FD_API_TYPE_READ_START, errNo);
+ removeConcurrentAccess(filePath);
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_START:
+ FileAccess writeAccess = new FileAccess(filePath, pid,
+ tid, fd, apiType, eventTime);
+
+ if (isLockWaitingAccessor(pid, tid)) {
+ addEndAccessData(pid, tid, fd, filePath, eventTime, size,
+ LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START, 0);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_START, eventTime));
+ }else{
+ if(checkConcurrentAccess(filePath)) {
+ writeAccess.setWarning();
+ SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ logData,
+ FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
+ FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
+ WarningCase.CONCURRENT_ACCESS.getType());
+ }
+ }
+ addStartAccessData(writeAccess);
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_END:
+ addEndAccessData(pid, tid, fd, filePath, eventTime,
+ size, LogCenterConstants.FD_API_TYPE_WRITE_START, errNo);
+ removeConcurrentAccess(filePath);
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_START:
+ if(getCurrentLockNum(filePath) > 0) {
+ addLockWaitingAccessor(pid, tid);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START, eventTime));
+ } else {
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ apiType, eventTime));
+ }
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_END:
+ removeLockNum(filePath);
+ addEndAccessData(pid, tid, fd, filePath, eventTime,
+ size, LogCenterConstants.FD_API_TYPE_LOCK_START, errNo);
+ break;
+ default:
+ break;
+ }
+ fileEventList.add(event);
+ }
+
+ public void addStatusData(FileStatus data) {
+ fileStatusList.add(data);
+ FileDataManager.getInstance().getStatusDB().insert(data);
+ }
+
+ public void addStartAccessData(FileAccess data) {
+ fileAccessList.add(data);
+ }
+
+ // in case of file read/write/lock probe/system call
+ public void addEndAccessData(int pid, int tid, long fd, String filePath,
+ long endTime, long fileSize, int apiType, long errNo) {
+ for (int i = 0; i < fileAccessList.size(); i++) {
+ FileAccess data = fileAccessList.get(i);
+ if (data.getPid() == pid
+ && data.getTid() == tid
+ && data.getFd() == fd
+ && data.getApiType() == apiType
+ && data.getEndTime() <= 0){
+ data.setEndTime(endTime);
+ data.setFileSize(fileSize);
+ data.setErroNo(errNo);
+ FileDataManager.getInstance().getAccessDB().insert(data);
+ break;
+ }
+ }
+ // when failed search start time, dump endEvent.
+ }
+
+ public List<FileEvent> getFileEventList() {
+ return fileLogsQueue.poll();
+ }
+
+ public List<FileAccess> getFileAccessList() {
+ return fileAccessList;
+ }
+
+ public List<FileStatus> getFileStatusList() {
+ return fileStatusList;
+ }
+
+ public List<FileEvent> getFileApiList() {
+ return fileApiList;
+ }
+
+ private String createKey(int pid, int tid, long fd) {
+ StringBuffer key = new StringBuffer();
+ key.append(pid);
+ key.append(":");
+ key.append(tid);
+ if(fd != -1) {
+ key.append(":");
+ key.append(fd);
+ }
+ return key.toString();
+ }
+
+ // for the open log: probe only
+ private void addFileAccessor(String key, String filePath) {
+ if(!fileAccessorMap.containsKey(key)) {
+ fileAccessorMap.put(key, filePath);
+ } else {
- DA_LOG.error(" removeFileAccessor:" + key + "is not exist" );
++ Logger.error(" addFileAccessor:" + key + "is aleady exist" );
+ }
+ }
+
+ // for the close log: probe only
+ private void removeFileAccessor(String key) {
+ if(fileAccessorMap.containsKey(key)) {
+ fileAccessorMap.remove(key);
+ }else {
- DA_LOG.error("The key is not exist : " + key);
++ Logger.error(" removeFileAccessor:" + key + "is not exist" );
+ }
+ }
+
+ private String getFilePath(String key) {
+ String filePath = null;
+ if(fileAccessorMap.containsKey(key)) {
+ filePath = fileAccessorMap.get(key);
+ }else{
- DA_LOG.error("Couldn't get concurrent access!, key :"
++ Logger.error("The key is not exist : " + key);
+ }
+ return filePath;
+ }
+
+ /**
+ * Check if it is concurrent access
+ * @param concurrentKey
+ * @return
+ */
+ private boolean checkConcurrentAccess(String concurrentKey) {
+ int num = 0;
+ if(concurrentAccessNumMap.containsKey(concurrentKey)) {
+ num = concurrentAccessNumMap.get(concurrentKey);
+ }
+ concurrentAccessNumMap.put(concurrentKey, num+1);
+ if(num > 0) {
+ return true;
+ }else {
+ return false;
+ }
+ }
+
+ /**
+ * Remove concurrent read or write number
+ * @param concurrentKey
+ * @param isRead
+ */
+ private void removeConcurrentAccess(String concurrentKey) {
+ if (concurrentAccessNumMap.containsKey(concurrentKey)) {
+ int num = concurrentAccessNumMap.get(concurrentKey);
+ if (num != 0) {
+ concurrentAccessNumMap.put(concurrentKey, num - 1);
+ } // else, no need to update concurrent read num
+ } else {
- System.out.println("num:" + num);
++ Logger.error("Couldn't get concurrent access!, key :"
+ + concurrentKey);
+ }
+ }
+
+ private int getCurrentLockNum(String lockKey) {
+ int num = 0;
+ if(lockNumMap.containsKey(lockKey)) {
+ num = lockNumMap.get(lockKey);
+ lockNumMap.put(lockKey, num+1);
+ }
+ lockNumMap.put(lockKey, num+1);
- DA_LOG.error("Couldn't get current lock num!, key :" + lockKey);
+ return num;
+ }
+
+ private void removeLockNum(String lockKey) {
+ int num = 0;
+ if(lockNumMap.containsKey(lockKey)) {
+ num = lockNumMap.get(lockKey);
+ lockNumMap.put(lockKey, num-1);
+ } else {
++ Logger.error("Couldn't get current lock num!, key :" + lockKey);
+ }
+ }
+
+ private void addLockWaitingAccessor(int pid, int tid) {
+ HashSet<Object> set = new HashSet<Object>();
+ set.add(pid);
+ set.add(tid);
+ lockWaitingAccessor.add(set);
+ }
+
+ private boolean isLockWaitingAccessor(int pid, int tid) {
+ HashSet<Object> set = new HashSet<Object>();
+ set.add(pid);
+ set.add(tid);
+ if(lockWaitingAccessor.contains(set)) {
+ lockWaitingAccessor.remove(set);
+ return true;
+ }
+ return false;
+ }
+
+ private void checkFileAnalysisLimit() {
+ if ( (fileAccessList.size() > DALimit.MAX_FILE_ACCESS_COUNT
+ || fileStatusList.size() > DALimit.MAX_FILE_STATUS_COUNT)) {
+ ToolbarArea.getInstance().stopTrace();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ // display a dialog to alert heap memory warning
+ public void run() {
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
+ dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
+ + PathManager.DA_INSTALL_PATH
+ + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
+ dialog.open();
+ }
+ });
+ }
+ }
+
+
+ /**
+ * filtering out STDIN/STDOUT ops
+ * @param input
+ * @return
+ */
+ private boolean checkInvalidApiName(FileData input) {
+ String apiName = input.getApiName();
+ if (apiName.contains("print")
+ || apiName.contains("printf")
+ || apiName.contains("fdopen") // in case of OSP
+ || apiName.contains("putchar")
+ || apiName.contains("getchar")
+ || apiName.contains("putchar")
+ || apiName.contains("scanf")
+ || apiName.contains("gets")
+ || apiName.contains("puts")) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * filtering out "main" function call when it's OSP api
+ * @param input
+ * @return
+ */
+ private boolean isOpenMainLog(FileData input) {
+ String filePath = input.getFilePath();
+ if (filePath.contains(CommonConstants.SLASH)) {
+ String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
+ String strApiFilePath = new String(
+ splitApiFilePath[splitApiFilePath.length - 1].trim());
+ if (AnalyzerManager.getProject().getPackageID().equals(strApiFilePath)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void setFileAccessList(List<FileAccess> fileAccessList) {
+ this.fileAccessList = fileAccessList;
+ }
+
+ public void setFileStatusList(List<FileStatus> fileStatusList) {
+ this.fileStatusList = fileStatusList;
+ }
+
+ public void setFileApiList(List<FileEvent> fileApiList) {
+ this.fileApiList = fileApiList;
+ }
+
+}