package org.tizen.dynamicanalyzer.ui.timeline.dlog;\r
\r
+import java.text.DateFormat;\r
+import java.text.ParseException;\r
+import java.text.SimpleDateFormat;\r
import java.util.ArrayList;\r
-import java.util.HashMap;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
import java.util.List;\r
-import java.util.Map;\r
import java.util.regex.Pattern;\r
\r
+import org.eclipse.swt.widgets.Display;\r
import org.tizen.dynamicanalyzer.common.Global;\r
import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;\r
import org.tizen.dynamicanalyzer.communicator.DeviceInfo;\r
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineTableView;\r
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
import org.tizen.sdblib.receiver.MultiLineReceiver;\r
import org.tizen.sdblib.util.StringUtil;\r
\r
\r
\r
static List<String> Dlogs = new ArrayList<String>();\r
+ \r
private static final Pattern pattern = Pattern.compile("\\d{2}-\\d{2}\\s(\\d{2}:\\d{2}:\\d{2}\\.?\\d*)\\+?\\d*\\s+" //time\r
- + "(V|D|I|W|E|F)/.*\\(\\s?" //tag\r
- + "(\\d+)\\):\\s" //pid\r
+ + "(\\d+)\\s+" //pid\r
+ + "(\\d+)\\s+" //tid\r
+ + "(V|D|I|W|E|F)\\s+" //level\r
+ + "(\\S+)\\s*\\:\\s+" //tag\r
+ "(.*)"); //message\r
+ \r
static boolean start = false;\r
static boolean dlogKill = false;\r
- \r
+ static String[] daStartTime = null;\r
public DADlogReceiver() {\r
// TODO Auto-generated constructor stub\r
}\r
\r
public boolean startDlog(){\r
\r
+ Pattern timeregex = Pattern.compile("\\S+\\s+" //day\r
+ + "\\S+\\s+" //month\r
+ + "\\d+\\s+" //date\r
+ + "(\\d{2}\\:\\d{2}\\:\\d{2})\\s+" //hour:min:sec\r
+ + ".*"); //year\r
+ \r
+ DeviceInfo curDev = Global.getCurrentDeviceInfo();\r
+ \r
Dlogs.clear();\r
dlogKill = false;\r
\r
- DeviceInfo curDev = Global.getCurrentDeviceInfo();\r
+ \r
if (curDev == null) {\r
return false;\r
}\r
\r
CommunicatorUtils.execShellCommand(curDev.getIDevice(),\r
- "/usr/bin/dlogutil -v time", new MultiLineReceiver() {\r
+ "date", new MultiLineReceiver() {\r
+ @Override\r
+ public void processNewLines(String[] appLines) {\r
+ for (int i = 0; i < appLines.length; i++) {\r
+ daStartTime = appLines;\r
+ }\r
+ }\r
+ });\r
+ \r
+ String[] TmpdaStartTime = daStartTime;\r
+ daStartTime = StringUtil.split(TmpdaStartTime[0], timeregex);\r
+\r
+ CommunicatorUtils.execShellCommand(curDev.getIDevice(),\r
+ "/usr/bin/dlogutil -c");\r
+ \r
+ CommunicatorUtils.execShellCommand(curDev.getIDevice(),\r
+ "/usr/bin/dlogutil -v threadtime", new MultiLineReceiver() {\r
@Override\r
public void processNewLines(String[] appLines) {\r
start = true;\r
if(dlogKill){\r
break;\r
}\r
+ /* Dlog don't show swap_start always...\r
+ if(appLines[i].contains("swap_start")){\r
+ daStartTime = StringUtil.split(appLines[i], StartTimepattern);\r
+ }\r
+ */\r
Dlogs.add(appLines[i]);\r
//System.out.println(appLines[i]);\r
}\r
String[] matches = StringUtil.split(Dlogs.get(i), pattern);\r
if(matches == null) continue;\r
DADlogData dlogData = new DADlogData();\r
- dlogData.setTime(matches[0]);\r
- dlogData.setTag(matches[1]);\r
- dlogData.setPid(matches[2]);\r
- dlogData.setMessage(matches[3]);\r
- dlogList.add(dlogData);\r
+ \r
+ \r
+ DateFormat formatter = new SimpleDateFormat("hh:mm:ss.SSS");\r
+ DateFormat formatter2 = new SimpleDateFormat("hh:mm:ss");\r
+ try {\r
+ Date date = formatter.parse(matches[0]);\r
+ Date DAdate = formatter2.parse(daStartTime[0]);\r
+ dlogData.setSyncTime(DAdate);\r
+ \r
+ int compare = date.compareTo(DAdate);\r
+ \r
+ if(compare < 0){\r
+ continue;\r
+ }\r
+ else{\r
+ long diffTime = date.getTime()*1000 - DAdate.getTime()*1000;\r
+ \r
+ //dlogData.setTime(matches[0]);\r
+ dlogData.setTime(Long.toString(diffTime));\r
+ dlogData.setPid(matches[1]);\r
+ dlogData.setTid(matches[2]);\r
+ dlogData.setLevel(matches[3]);\r
+ dlogData.setTag(matches[4]);\r
+ dlogData.setMessage(matches[5]);\r
+ dlogList.add(dlogData);\r
+ }\r
+ \r
+ } catch (ParseException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } \r
}\r
- \r
return dlogList;\r
}\r
\r
import java.util.Collections;\r
import java.util.List;\r
\r
+import org.eclipse.nebula.widgets.grid.Grid;\r
import org.eclipse.nebula.widgets.grid.GridItem;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.events.SelectionListener;\r
+import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.widgets.Composite;\r
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
-import org.tizen.dynamicanalyzer.common.DASelectionData;\r
import org.tizen.dynamicanalyzer.model.TableInput;\r
-import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionEntryDBTable;\r
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineTableView;\r
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;\r
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;\r
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;\r
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;\r
-import org.tizen.dynamicanalyzer.ui.widgets.table.DAWindowingTableComposite;\r
import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;\r
-import org.tizen.dynamicanalyzer.ui.widgets.table.WindowingTableColumnSizePackListener;\r
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;\r
-import org.tizen.sdblib.receiver.DlogReceiver;\r
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
+import org.tizen.dynamicanalyzer.utils.Formatter;\r
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;\r
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;\r
\r
public class DlogTable extends DATableComposite {\r
\r
- private String[] columnNames = {"Date & Time", "LogLevel", "Pid", "Message" };\r
- private String[] initcolumnNames = {"", "", "", "[After StopTrace, Show Dlogs]" };\r
- private int[] columnSizes = { 200, 100, 100, 1200};\r
- private int[] columnAlignment = { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };\r
- private boolean[] columnVisibility = { true, true, true, true };\r
- private int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE, \r
- AnalyzerConstants.SORT_TYPE_NONE,AnalyzerConstants.SORT_TYPE_NONE };\r
+ private String[] columnNames = {"Time", "Level", "Pid", "Tid", "Tag", "Message" }; //6col\r
+ private int[] columnSizes = { 80, 80, 80, 80, 300, 1200};\r
+ private int[] columnAlignment = { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };\r
+ private boolean[] columnVisibility = { true, true, true, true, true, true };\r
+ private int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NONE,\r
+ AnalyzerConstants.SORT_TYPE_NONE,AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NONE };\r
\r
private DADlogReceiver dlogRecv = new DADlogReceiver(); \r
+ private List<TableInput> tableClone = new ArrayList<TableInput>();\r
+ private static boolean isFilter = false;\r
+ private static List<DADlogData> dlogfilteredData = new ArrayList<DADlogData>();\r
\r
public DlogTable(Composite parent, int compStyle, int tableStyle) {\r
// TODO Auto-generated constructor stub\r
super(parent, compStyle, tableStyle);\r
\r
setSortTypes(sortTypes);\r
- setColumns(initcolumnNames);\r
+ setColumns(columnNames);\r
setColumnSize(columnSizes);\r
setColumnVisibility(columnVisibility);\r
setColumnAlignment(columnAlignment);\r
\r
//setDataType(FunctionEntryDBTable.COLUMN.START_TIME.index); \r
//setContextMenu(AnalyzerConstants.CONTEXT_TABLE_RANGE);\r
+ \r
+ table.addSelectionListener(new SelectionListener() {\r
+\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ GridItem[] ti = ((Grid) e.widget).getSelection();\r
+ if (null == ti || ti.length == 0) {\r
+ return;\r
+ }\r
+ int size = ti.length;\r
+ List<Object> startData = ((DATableDataFormat) ti[0].getData()).getData();\r
+ List<Object> endData = ((DATableDataFormat) ti[size - 1].getData()).getData();\r
+ long startTime = (Long) Long.parseLong((String) startData.get(0));\r
+ long endTime = (Long) Long.parseLong((String) endData.get(0));\r
+ DlogTimeMarker(startTime, endTime); \r
+ }\r
+\r
+ @Override\r
+ public void widgetDefaultSelected(SelectionEvent e) {\r
+ }\r
+ });\r
}\r
\r
@Override\r
protected List<TableInput> makeTableInput() {\r
- table.getColumn(0).setText(columnNames[0]);\r
- table.getColumn(1).setText(columnNames[1]);\r
- table.getColumn(2).setText(columnNames[2]);\r
- table.getColumn(3).setText(columnNames[3]);\r
\r
List<TableInput> output = new ArrayList<TableInput>();\r
List<DADlogData> dlogData = new ArrayList<DADlogData>();\r
\r
- if(dlogRecv.getDlogs()!=null){\r
+ if(isFilter){\r
+ dlogData = dlogfilteredData;\r
+ }\r
+ else if(dlogRecv.getDlogs()!=null){\r
dlogData = dlogRecv.parserDlogs();\r
}\r
else {\r
+ tableClone = output;\r
return output;\r
}\r
\r
List<String> text = new ArrayList<String>();\r
List<Object> tabledata = new ArrayList<Object>();\r
DATableDataFormat TableDataformat = new DATableDataFormat(seqnum++);\r
- \r
- text.add(data.getTime());\r
+ \r
+ String strTime = Formatter.toTimeFormat(data.getTime());\r
+ text.add(strTime);\r
tabledata.add(data.getTime());\r
\r
- text.add(data.getTag());\r
- tabledata.add(data.getTag());\r
+ text.add(data.getLevel());\r
+ tabledata.add(data.getLevel());\r
\r
text.add(data.getPid());\r
tabledata.add(data.getPid());\r
\r
+ text.add(data.getTid());\r
+ tabledata.add(data.getTid());\r
+ \r
+ text.add(data.getTag());\r
+ tabledata.add(data.getTag());\r
+ \r
text.add(data.getMessage());\r
tabledata.add(data.getMessage());\r
\r
TableDataformat.getData().add(tabledata.get(1));\r
TableDataformat.getData().add(tabledata.get(2));\r
TableDataformat.getData().add(tabledata.get(3));\r
+ TableDataformat.getData().add(tabledata.get(4));\r
+ TableDataformat.getData().add(tabledata.get(5));\r
\r
TableInput tableInput = new TableInput();\r
tableInput.setText(text); \r
\r
output.add(tableInput);\r
}\r
+ tableClone = output;\r
return output;\r
}\r
/*\r
}\r
table.update();\r
}\r
+ /// 0504 Success find me~!\r
+ /// 1. Add TextEditor for input filter Text \r
+ /// 2. Effect for selection\r
+ /// 3. cutting Table by filtering \r
+ private void filteringDlog(String input){\r
+ if(tableClone != null){\r
+ for(TableInput table : tableClone){\r
+ if(table.getText().get(4).contains(input)){\r
+ //private String time;\r
+ //private String pid;\r
+ //private String tid; \r
+ //private String level;\r
+ //private String tag;\r
+ //private String message;\r
+ //dlogfilteredData.add(0,dlogRecv.getDlogs());\r
+ System.out.println("============find me!!"+table.getText()+"==================");\r
+ }\r
+ }\r
+ }\r
+ }\r
\r
+ private void DlogTimeMarker(long startTime, long endTime){\r
+ TimelineChartView timeline =(TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());\r
+ DAChartBoard chartboard = (DAChartBoard)timeline.getControl();\r
+ \r
+ double startMarkerTime = startTime\r
+ / (TimelineConstants.MEGA_DOUBLE);\r
+ double endMarkerTime = endTime\r
+ / (TimelineConstants.MEGA_DOUBLE);\r
+ \r
+ chartboard.setTimelineMarkerStartTime(startMarkerTime);\r
+ chartboard.setTimelineMarkerEndTime(endMarkerTime);\r
+ ((DAChartPlotIntervalMarker) chartboard.getMarkers().get(\r
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(startTime,\r
+ endTime);\r
+ }\r
}\r