当前位置: 首页>>代码示例>>Java>>正文


Java AllocationInfo类代码示例

本文整理汇总了Java中com.android.ddmlib.AllocationInfo的典型用法代码示例。如果您正苦于以下问题:Java AllocationInfo类的具体用法?Java AllocationInfo怎么用?Java AllocationInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AllocationInfo类属于com.android.ddmlib包,在下文中一共展示了AllocationInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testParsingOnOneAllocationWithStackTrace

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
public void testParsingOnOneAllocationWithStackTrace() throws IOException {
  ByteBuffer data = putAllocationInfo(new String[]{"path.Foo", "path.Bar", "path.Baz"}, new String[]{"foo", "bar", "baz"},
          new String[]{"Foo.java", "Bar.java"}, new int[][]{{64, 0, 1, 3}},
          new short[][][]{{{1, 1, 1, -1}, {2, 0, 1, 2000}, {0, 2, 0, 10}}});
  AllocationInfo[] info = AllocationsParser.parse(data);
  assertEquals(1, info.length);

  AllocationInfo alloc = info[0];
  checkEntry(1, "path.Bar", 64, 0, alloc);
  checkFirstTrace("path.Bar", "bar", alloc);

  StackTraceElement[] elems = alloc.getStackTrace();
  assertEquals(3, elems.length);

  checkStackFrame("path.Bar", "bar", "Bar.java", -1, elems[0]);
  checkStackFrame("path.Baz", "foo", "Bar.java", 2000, elems[1]);
  checkStackFrame("path.Foo", "baz", "Foo.java", 10, elems[2]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AllocationsParserTest.java

示例2: insert

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
public void insert(AllocationInfo alloc, int depth) {
  StackTraceElement[] stack = alloc.getStackTrace();
  if (depth < stack.length) {
    StackTraceElement element = stack[stack.length - 1 - depth];
    StackNode child = myChildrenMap.get(element);
    if (child == null) {
      child = new StackNode(element);
      myChildrenMap.put(element, child);
      addChild(child);
    }
    child.insert(alloc, depth + 1);
  }
  else {
    AllocNode allocNode = new AllocNode(alloc);
    addChild(allocNode);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StackSourceNode.java

示例3: insert

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
@Override
public void insert(@NotNull AllocationInfo alloc) {
  StackTraceElement[] trace = alloc.getStackTrace();
  String[] packages;
  if (trace.length > 0) {
    int match = 0;
    for (int i = 0; i < trace.length; i++) {
      if (myFilter.matcher(trace[i].getClassName()).matches()) {
        match = i;
        break;
      }
    }
    // TODO don't use the last trace, but use a user defined filter.
    String name = trace[match].getClassName();
    int ix = name.indexOf("$");
    name = ix >= 0 ? name.substring(0, ix) : name;
    packages = name.split("\\.");
  } else {
    packages = new String[] { "< Unknown >" };
  }
  insert(packages, alloc, 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PackageRootNode.java

示例4: getColumnText

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
@Override
public String getColumnText(Object element, int columnIndex) {
    if (element instanceof AllocationInfo) {
        AllocationInfo alloc = (AllocationInfo)element;
        switch (columnIndex) {
            case 0:
                return Integer.toString(alloc.getAllocNumber());
            case 1:
                return Integer.toString(alloc.getSize());
            case 2:
                return alloc.getAllocatedClass();
            case 3:
                return Short.toString(alloc.getThreadId());
            case 4:
                return alloc.getFirstTraceClassName();
            case 5:
                return alloc.getFirstTraceMethodName();
        }
    }

    return null;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:23,代码来源:AllocationPanel.java

示例5: getAllocationSelection

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
/**
 * Returns the current allocation selection or <code>null</code> if none is found.
 * If a {@link ISelection} object is specified, the first {@link AllocationInfo} from this
 * selection is returned, otherwise, the <code>ISelection</code> returned by
 * {@link TableViewer#getSelection()} is used.
 * @param selection the {@link ISelection} to use, or <code>null</code>
 */
private AllocationInfo getAllocationSelection(ISelection selection) {
    if (selection == null) {
        selection = mAllocationViewer.getSelection();
    }

    if (selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection = (IStructuredSelection)selection;
        Object object = structuredSelection.getFirstElement();
        if (object instanceof AllocationInfo) {
            return (AllocationInfo)object;
        }
    }

    return null;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:23,代码来源:AllocationPanel.java

示例6: getFilteredAllocations

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
private AllocationInfo[] getFilteredAllocations(AllocationInfo[] allocations,
        String filterText) {
    ArrayList<AllocationInfo> results = new ArrayList<AllocationInfo>();
    // Using default locale here such that the locale-specific c
    Locale locale = Locale.getDefault();
    filterText = filterText.toLowerCase(locale);
    boolean fullTrace = mTraceFilterCheck.getSelection();

    for (AllocationInfo info : allocations) {
        if (info.filter(filterText, fullTrace, locale)) {
            results.add(info);
        }
    }

    return results.toArray(new AllocationInfo[results.size()]);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:17,代码来源:AllocationPanel.java

示例7: testParsingOnOneAllocationWithoutStackTrace

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
public void testParsingOnOneAllocationWithoutStackTrace() throws IOException {
  ByteBuffer data =
          putAllocationInfo(new String[]{"path.Foo"}, new String[0], new String[0], new int[][]{{32, 4, 0, 0}}, new short[][][]{{}});
  AllocationInfo[] info = AllocationsParser.parse(data);
  assertEquals(1, info.length);

  AllocationInfo alloc = info[0];
  checkEntry(1, "path.Foo", 32, 4, alloc);
  checkFirstTrace(null, null, alloc);
  assertEquals(0, alloc.getStackTrace().length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AllocationsParserTest.java

示例8: testParsing

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
public void testParsing() throws IOException {
  ByteBuffer data = putAllocationInfo(new String[]{"path.Red", "path.Green", "path.Blue", "path.LightCanaryishGrey"},
          new String[]{"eatTiramisu", "failUnitTest", "watchCatVideos", "passGo", "collectFakeMoney", "findWaldo"},
          new String[]{"Red.java", "SomewhatBlue.java", "LightCanaryishGrey.java"},
          new int[][]{{128, 8, 0, 2}, {16, 8, 2, 1}, {42, 2, 1, 3}},
          new short[][][]{{{1, 0, 1, 100}, {2, 5, 1, -2}}, {{0, 1, 0, -1}}, {{3, 4, 2, 10001}, {0, 3, 0, 0}, {2, 2, 1, 16}}});
  AllocationInfo[] info = AllocationsParser.parse(data);
  assertEquals(3, info.length);

  AllocationInfo alloc1 = info[0];
  checkEntry(3, "path.Red", 128, 8, alloc1);
  checkFirstTrace("path.Green", "eatTiramisu", alloc1);

  StackTraceElement[] elems1 = alloc1.getStackTrace();
  assertEquals(2, elems1.length);

  checkStackFrame("path.Green", "eatTiramisu", "SomewhatBlue.java", 100, elems1[0]);
  checkStackFrame("path.Blue", "findWaldo", "SomewhatBlue.java", -2, elems1[1]);

  AllocationInfo alloc2 = info[1];
  checkEntry(2, "path.Blue", 16, 8, alloc2);
  checkFirstTrace("path.Red", "failUnitTest", alloc2);

  StackTraceElement[] elems2 = alloc2.getStackTrace();
  assertEquals(1, elems2.length);

  checkStackFrame("path.Red", "failUnitTest", "Red.java", -1, elems2[0]);

  AllocationInfo alloc3 = info[2];
  checkEntry(1, "path.Green", 42, 2, alloc3);
  checkFirstTrace("path.LightCanaryishGrey", "collectFakeMoney", alloc3);

  StackTraceElement[] elems3 = alloc3.getStackTrace();
  assertEquals(3, elems3.length);

  checkStackFrame("path.LightCanaryishGrey", "collectFakeMoney", "LightCanaryishGrey.java", 10001, elems3[0]);
  checkStackFrame("path.Red", "passGo", "Red.java", 0, elems3[1]);
  checkStackFrame("path.Blue", "watchCatVideos", "SomewhatBlue.java", 16, elems3[2]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AllocationsParserTest.java

示例9: generateTree

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
@NotNull
private MainTreeNode generateTree() {
  MainTreeNode tree = myGroupBy.create();
  for (AllocationInfo alloc : myAllocations) {
    tree.insert(alloc);
  }
  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AllocationsView.java

示例10: insert

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
@Override
public void insert(@NotNull AllocationInfo alloc) {
  short id = alloc.getThreadId();
  ThreadNode thread = myChildrenMap.get(id);
  if (thread == null) {
    thread = new ThreadNode(id);
    myChildrenMap.put(id, thread);
    addChild(thread);
  }
  thread.insert(alloc, 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:StackTraceNode.java

示例11: insert

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
public void insert(String[] packages, AllocationInfo alloc, int depth) {
  if (depth < packages.length) {
    String name = packages[depth];
    PackageNode node = myChildrenMap.get(name);
    if (node == null) {
      node = depth == packages.length - 1 ? new ClassNode(name) : new PackageNode(name);
      myChildrenMap.put(name, node);
      addChild(node);
    }
    node.insert(packages, alloc, depth + 1);
  } else {
    addChild(new AllocNode(alloc));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PackageNode.java

示例12: getElements

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof Client) {
        AllocationInfo[] allocs = ((Client)inputElement).getClientData().getAllocations();
        if (allocs != null) {
            if (mFilterText != null && mFilterText.length() > 0) {
                allocs = getFilteredAllocations(allocs, mFilterText);
            }
            Arrays.sort(allocs, mSorter);
            return allocs;
        }
    }

    return new Object[0];
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:16,代码来源:AllocationPanel.java

示例13: updateAllocationStackCall

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
/**
 * Updates the stack call of the currently selected thread.
 * <p/>
 * This <b>must</b> be called from the UI thread.
 */
private void updateAllocationStackCall() {
    Client client = getCurrentClient();
    if (client != null) {
        // get the current selection in the ThreadTable
        AllocationInfo selectedAlloc = getAllocationSelection(null);

        if (selectedAlloc != null) {
            updateAllocationStackTrace(selectedAlloc);
        } else {
            updateAllocationStackTrace(null);
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:19,代码来源:AllocationPanel.java

示例14: checkEntry

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
private static void checkEntry(int order, String className, int size, int thread, AllocationInfo alloc) {
  assertEquals(order, alloc.getAllocNumber());
  assertEquals(className, alloc.getAllocatedClass());
  assertEquals(size, alloc.getSize());
  assertEquals(thread, alloc.getThreadId());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AllocationsParserTest.java

示例15: checkFirstTrace

import com.android.ddmlib.AllocationInfo; //导入依赖的package包/类
private static void checkFirstTrace(String className, String methodName, AllocationInfo alloc) {
  assertEquals(className, alloc.getFirstTraceClassName());
  assertEquals(methodName, alloc.getFirstTraceMethodName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:AllocationsParserTest.java


注:本文中的com.android.ddmlib.AllocationInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。