import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.nl.ReplayEditLabels;
import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.model.DATime;
import org.tizen.dynamicanalyzer.swap.model.RecordEventObject;
import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
private int insertDBRid = 0;
private int insertkeySequence = 1;
- private int insertSecTimeSequence = 0;
-
- private long preMouseUpTime = 0;
private static ReplayEditDialogDataManager instance = null;
private ReplayData replayDBData = null;
ReplayData dbData) {
int size = dbData.getRecordEvent().size();
for (int i = 0; i < size; i++) {
+
RecordEventObject reo = dbData.getRecordEvent().get(i);
+ long time = getTimeValue(reo.getEventTime().getSec(), reo
+ .getEventTime().getNano());
+ DATime daTime = getDATimeValue(time);
+ System.out.println(i + " : " + time + " sec : " + daTime.getSec()
+ + " nano : " + daTime.getNano());
+
if (reo.getEventType() == 0) { // event end log
continue;
}
private void cleanInsertData() {
insertDBRid = 0;
insertkeySequence = 1;
- insertSecTimeSequence = 0;
- preMouseUpTime = 0;
}
private void insertDBData(boolean isSave, String dbPath) {
return strPoint;
}
- private long getEventNanoTime(long time) {
- int startSec = AnalyzerManager.getProject().getProfileStartTime()
- .getSec();
- int startNano = AnalyzerManager.getProject().getProfileStartTime()
- .getNano();
- long startTime = startSec / 1000000 + startNano / 1000;
-
- long mouseEventSec = (startSec + insertSecTimeSequence);
- long mouseDelaytime = time - startTime;
- if (mouseDelaytime == 0) {
- return startNano;
- }
- if ((time - startTime) < 1) {
- return startNano;
- }
- long mouseDelaySec = (mouseEventSec - startSec) * 1000000;
- long mouseEventNano = ((mouseDelaytime - mouseDelaySec) * 1000)
- + startNano;
- return mouseEventNano;
- }
-
- private String getSecTime() {
- int startSec = AnalyzerManager.getProject().getProfileStartTime()
- .getSec();
- long mouseDownEventSec = (startSec + insertSecTimeSequence);
- return Long.toString(mouseDownEventSec);
- }
-
- private String getMouseDownNanoTime(List<String> item) {
- String itemMouseDownTime = getDBTime(item
- .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- long downTime = Long.parseLong(itemMouseDownTime);
- if (preMouseUpTime > 0 && downTime - preMouseUpTime > 1000000) {
- long delayTime = (downTime - preMouseUpTime) / 1000000;
- insertSecTimeSequence += delayTime;
- }
-
- long mouseDownEventNano = getEventNanoTime(downTime);
- while (mouseDownEventNano > 1000000000) {
- insertSecTimeSequence++;
- mouseDownEventNano = getEventNanoTime(downTime);
- }
-
- return Long.toString(mouseDownEventNano);
+ public long getTimeValue(long sec, long nano) {
+ DATime startTime = AnalyzerManager.getProject().getProfileStartTime();
+ long startSec = startTime.getSec();
+ long startNano = startTime.getNano();
+ long resultSec = sec - startSec;
+ long resultNano = nano - startNano;
+ long time = resultSec * 1000000 + resultNano / 1000;
+ return time;
}
- private String getMouseUpNanoTime(List<String> item) {
- String itemMouseDownTime = getDBTime(item
- .get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
- String itemMouseUpTime = getDBTime(item
- .get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
- long downTime = Long.parseLong(itemMouseDownTime);
- long upTime = Long.parseLong(itemMouseUpTime);
-
- if (upTime - downTime > 1000000) {
- long delayTime = (downTime - downTime) / 1000000;
- insertSecTimeSequence += delayTime;
+ private DATime getDATimeValue(long time) {
+ DATime startTime = AnalyzerManager.getProject().getProfileStartTime();
+ long startSec = startTime.getSec();
+ long startNano = startTime.getNano();
+ long secTime = startSec;
+ long nanoTime = 0;
+ long resultSec = (secTime - startSec);
+ nanoTime = ((time - (resultSec * 1000000)) * 1000) + startNano;
+ while (nanoTime > 1000000000) {
+ secTime++;
+ resultSec = (secTime - startSec);
+ nanoTime = ((time - (resultSec * 1000000)) * 1000) + startNano;
}
-
- long mouseUpEventNano = getEventNanoTime(upTime);
- while (mouseUpEventNano > 1000000000) {
- insertSecTimeSequence++;
- mouseUpEventNano = getEventNanoTime(upTime);
- }
-
- preMouseUpTime = upTime;
- return Long.toString(mouseUpEventNano);
+ DATime resultTime = new DATime();
+ resultTime.setSec((int) secTime);
+ resultTime.setNano((int) nanoTime);
+ return resultTime;
}
private String getKeyValue(List<String> item) {
.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
String itemMouseUpTime = getDBTime(item
.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
- String mouseDownNanoTime = getMouseDownNanoTime(item);
- String mouseUpNanoTime = getMouseUpNanoTime(item);
+ DATime mouseDownTime = getDATimeValue(Long.parseLong(itemMouseDownTime));
+ DATime mouseUpTime = getDATimeValue(Long.parseLong(itemMouseUpTime));
String itemValue1 = getKeyValue(item);
- int sec = Integer.parseInt(getSecTime());
List<List<String>> dbKeyDataList = new ArrayList<List<String>>();
for (int i = 0; i < 4; i++) {
List<String> keyData = new ArrayList<String>();
if (i == 0) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("1");
keyData.add(Integer.toString(KEY));
keyData.add(itemValue1);
keyData.add("1");
} else if (i == 1) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseUpTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("1");
keyData.add("0");
keyData.add("0");
keyData.add("0");
} else if (i == 2) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseUpTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
+ keyData.add(Long.toString(mouseUpTime.getSec()));
+ keyData.add(Long.toString(mouseUpTime.getNano()));
keyData.add("1");
keyData.add(Integer.toString(KEY));
keyData.add(itemValue1);
keyData.add("0");
} else if (i == 3) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseUpTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
+ keyData.add(Long.toString(mouseUpTime.getSec()));
+ keyData.add(Long.toString(mouseUpTime.getNano()));
keyData.add("1");
keyData.add("0");
keyData.add("0");
.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
String itemMouseUpTime = getDBTime(item
.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
- String mouseDownNanoTime = getMouseDownNanoTime(item);
- String mouseUpNanoTime = getMouseUpNanoTime(item);
+ DATime mouseDownTime = getDATimeValue(Long.parseLong(itemMouseDownTime));
+ DATime mouseUpTime = getDATimeValue(Long.parseLong(itemMouseUpTime));
String itemValue1 = item.get(EVENT_VALUE1_TABLE_INDEX);
String itemValue2 = item.get(EVENT_VALUE2_TABLE_INDEX);
- int sec = Integer.parseInt(getSecTime());
List<List<String>> dbKeyDataList = new ArrayList<List<String>>();
for (int i = 0; i < 7; i++) {
List<String> keyData = new ArrayList<String>();
if (i == 0) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("0");
keyData.add(Integer.toString(TOUCH));
keyData.add(Integer
.toString(TOUCH_EVENT_CODE_MOUSED_DOWN_START));
keyData.add(Integer.toString(insertkeySequence++));
} else if (i == 1) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("0");
keyData.add(Integer.toString(TOUCH));
keyData.add(Integer.toString(TOUCH_EVENT_CODE_SECOND_ITEM));
keyData.add(Integer.toString(TOUCH_EVENT_VALUE_SECOND_ITEM));
} else if (i == 2) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("0");
keyData.add(Integer.toString(TOUCH));
keyData.add(Integer.toString(TOUCH_EVENT_CODE_X));
keyData.add(getDBPoint(itemValue1));
} else if (i == 3) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("0");
keyData.add(Integer.toString(TOUCH));
keyData.add(Integer.toString(TOUCH_EVENT_CODE_Y));
keyData.add(getDBPoint(itemValue2));
} else if (i == 4) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(8815));
keyData.add(itemMouseDownTime);
- keyData.add(getSecTime());
- keyData.add(mouseDownNanoTime);
+ keyData.add(Long.toString(mouseDownTime.getSec()));
+ keyData.add(Long.toString(mouseDownTime.getNano()));
keyData.add("0");
keyData.add("0");
keyData.add("0");
keyData.add("0");
} else if (i == 5) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(9164));
keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
+ keyData.add(Long.toString(mouseUpTime.getSec()));
+ keyData.add(Long.toString(mouseUpTime.getNano()));
keyData.add("0");
keyData.add(Integer.toString(TOUCH));
keyData.add(Integer.toString(TOUCH_EVENT_CODE_MOUSED_UP_START));
keyData.add("-1");
} else if (i == 6) {
- keyData.add(Integer.toString(sec + insertDBRid++));
+ keyData.add(Integer.toString(mouseDownTime.getSec()
+ + insertDBRid++));
keyData.add(Integer.toString(MESSAGE_ID));
keyData.add(Integer.toString(9164));
keyData.add(itemMouseUpTime);
- keyData.add(getSecTime());
- keyData.add(mouseUpNanoTime);
+ keyData.add(Long.toString(mouseUpTime.getSec()));
+ keyData.add(Long.toString(mouseUpTime.getNano()));
keyData.add("0");
keyData.add("0");
keyData.add("0");