From ad32568bc46c9860dd6e95656dd66d0dfa6d5c11 Mon Sep 17 00:00:00 2001 From: heeyoung Date: Thu, 18 Jun 2015 16:28:44 +0900 Subject: [PATCH] SYSCALL : add new message (SYSCALL_ENTRY/SYSCALL_EXIT) Change-Id: Ie05ee8a67045f089591278dc94661bdf802856b9 Signed-off-by: heeyoung --- .../tizen/dynamicanalyzer/protocol/Protocol.java | 6 + .../protocol/ProtocolConstants.java | 2 + .../dynamicanalyzer/swap/logparser/LogParser.java | 5 +- .../swap/logparser/MessageParser.java | 10 +- .../swap/model/data/LogDataFactory.java | 9 ++ .../swap/model/data/SyscallData.java | 144 +++++++++++++++++++++ 6 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SyscallData.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java index c905257..99504ac 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java @@ -57,11 +57,17 @@ public enum Protocol { tempMap.put(0x0007, "MSG_DATA_RECORD"); tempMap.put(0x0008, "MSG_FUNCTION_ENTRY"); tempMap.put(0x0009, "MSG_FUNCTION_EXIT"); + tempMap.put(0x000A, "MSG_SYSCALL_ENTRY"); + tempMap.put(0x000B, "MSG_SYSCALL_EXIT"); tempMap.put(0x0010, "MSG_CONTEXT_SWITCH_ENTRY"); tempMap.put(0x0011, "MSG_CONTEXT_SWITCH_EXIT"); tempMap.put(0x0012, "MSG_PROCESS_MAP"); tempMap.put(0x0013, "MSG_PROCESS_UNMAP"); tempMap.put(0x0014, "MSG_PROCESS_COMM"); + tempMap.put(0x0015, "MSG_WEB_FUNCTION_ENTRY"); + tempMap.put(0x0016, "MSG_WEB_FUNCTION_EXIT"); + tempMap.put(0x0019, "MSG_APP_STARTUP"); + tempMap.put(0x001A, "MSG_WEB_APP_STARTUP"); // data probe message id tempMap.put(0x0101, "MSG_PROBE_MIN"); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java index c72025e..9c80274 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java @@ -54,6 +54,8 @@ public class ProtocolConstants { public static final int MSG_DATA_RECORD = 0x0007; public static final int MSG_FUNCTION_ENTRY = 0x0008; public static final int MSG_FUNCTION_EXIT = 0x0009; + public static final int MSG_SYSCALL_ENTRY = 0x000A; + public static final int MSG_SYSCALL_EXIT = 0x000B; public static final int MSG_FILE_FUNCTION_ENTRY = 0x000C; public static final int MSG_FILE_FUNCTION_EXIT = 0x000D; public static final int MSG_CONTEXT_SWITCH_ENTRY = 0x0010; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/LogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/LogParser.java index 2f9b033..b775d1a 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/LogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/LogParser.java @@ -216,6 +216,10 @@ public class LogParser extends DataThread> { packLog(log, logPack); } break; + case ProtocolConstants.MSG_SYSCALL_ENTRY: // protocol 4.0 + case ProtocolConstants.MSG_SYSCALL_EXIT: // protocol 4.0 + // do nothing + break; case ProtocolConstants.MSG_WEB_FUNCTION_ENTRY: case ProtocolConstants.MSG_WEB_FUNCTION_EXIT: ret = processWebFunctionData((WebProfileData) log); @@ -230,7 +234,6 @@ public class LogParser extends DataThread> { packLog(log, logPack); } break; - case ProtocolConstants.MSG_DATA_SAMPLE: case ProtocolConstants.MSG_DATA_SYSTEM: case ProtocolConstants.MSG_DATA_RECORD: diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java index 68f18b9..5d61e09 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java @@ -204,13 +204,15 @@ public class MessageParser extends DataThread { case ProtocolConstants.MSG_CONTEXT_SWITCH_ENTRY: case ProtocolConstants.MSG_CONTEXT_SWITCH_EXIT: case ProtocolConstants.MSG_DATA_RECORD: - case ProtocolConstants.MSG_APP_STARTUP: - case ProtocolConstants.MSG_WEB_APP_STARTUP: - case ProtocolConstants.MSG_WEB_FUNCTION_ENTRY: - case ProtocolConstants.MSG_WEB_FUNCTION_EXIT: + case ProtocolConstants.MSG_APP_STARTUP: // protocol 4.0 + case ProtocolConstants.MSG_WEB_APP_STARTUP: // protocol 4.0 + case ProtocolConstants.MSG_WEB_FUNCTION_ENTRY: // protocol 4.0 + case ProtocolConstants.MSG_WEB_FUNCTION_EXIT: // protocol 4.0 case ProtocolConstants.MSG_FUNCTION_BODY: case ProtocolConstants.MSG_FILE_FUNCTION_ENTRY: // protocol 4.0 case ProtocolConstants.MSG_FILE_FUNCTION_EXIT: // protocol 4.0 + case ProtocolConstants.MSG_SYSCALL_ENTRY: // protocol 4.0 + case ProtocolConstants.MSG_SYSCALL_EXIT: // protocol 4.0 if (AnalyzerManager.isProcessInfoArrived()) { sendBuffer.add(log); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java index f3d54be..cd4ad90 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java @@ -44,6 +44,10 @@ public class LogDataFactory { // profiling sample log output = new ProfileData(); break; + case ProtocolConstants.MSG_SYSCALL_ENTRY: // protocol 4.0 + case ProtocolConstants.MSG_SYSCALL_EXIT: // protocol 4.0 + output = new SyscallData(); + break; case ProtocolConstants.MSG_FILE_FUNCTION_ENTRY: // protocol 4.0 case ProtocolConstants.MSG_FILE_FUNCTION_EXIT: // protocol 4.0 output = new FileSyscallData(); @@ -222,6 +226,11 @@ public class LogDataFactory { case ProtocolConstants.MSG_WEB_FUNCTION_EXIT: // protocol 4.0 formatName = "WebProfiling"; break; + case ProtocolConstants.MSG_SYSCALL_ENTRY: // protocol 4.0 + case ProtocolConstants.MSG_SYSCALL_EXIT: // protocol 4.0 + // syscall enter/exit + formatName = "Syscall"; + break; default: break; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SyscallData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SyscallData.java new file mode 100644 index 0000000..5f9db19 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SyscallData.java @@ -0,0 +1,144 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Heeyoung Hwang + * WooJin Jung + * + * 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 + * + */ +package org.tizen.dynamicanalyzer.swap.model.data; + +import org.tizen.dynamicanalyzer.model.DATime; +import org.tizen.dynamicanalyzer.protocol.ProtocolConstants; + +public class SyscallData extends LogData { + protected int pid = 0; // protocol 4.0 + protected int tid = 0; // protocol 4.0 + protected int probeType = 0; // protocol 4.0 + protected long pcAddr = 0; // protocol 4.0 + protected long callerPcAddr = 0; // protocol 4.0 + protected int cpuNum = 0; // protocol 4.0 + protected String args = null; // protocol 4.0 + protected String ret = null; // protocol 4.0 + + public SyscallData() { + } + + @Override + public SyscallData clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException(); + } + + @Override + protected boolean parse(DATime startTime) { + super.parse(startTime); + + // start of protocol 4.0 + switch (msgID) { + case ProtocolConstants.MSG_SYSCALL_ENTRY: + pid = getInt(); + tid = getInt(); + probeType = getInt(); + pcAddr = getLong(); + callerPcAddr = getLong(); + cpuNum = getInt(); + args = parseArgs(); + break; + case ProtocolConstants.MSG_SYSCALL_EXIT: + pid = getInt(); + tid = getInt(); + probeType = getInt(); + pcAddr = getLong(); + callerPcAddr = getLong(); + cpuNum = getInt(); + ret = parseReturn(); + break; + default: + break; + } + // end of protocol 4.0 + + return true; + } + + public int getPID() { + return pid; + } + + public void setPID(int pid) { + this.pid = pid; + } + + public int getTID() { + return tid; + } + + public void setTID(int tid) { + this.tid = tid; + } + + public int getProbeType() { + return probeType; + } + + public void setProbeType(int probeType) { + this.probeType = probeType; + } + + public long getPcAddr() { + return pcAddr; + } + + public void setPcAddr(long pcAddr) { + this.pcAddr = pcAddr; + } + + public long getCallerPcAddr() { + return callerPcAddr; + } + + public void setCallerPcAddr(long callerPcAddr) { + this.callerPcAddr = callerPcAddr; + } + + public int getCpuNum() { + return cpuNum; + } + + public void setCpuNum(int cpuNum) { + this.cpuNum = cpuNum; + } + + public String getArgs() { + return args; + } + + public void setArgs(String args) { + this.args = args; + } + + public String getRet() { + return ret; + } + + public void setRet(String ret) { + this.ret = ret; + } +} \ No newline at end of file -- 2.7.4