Example usage for android.os Debug dumpHprofData

List of usage examples for android.os Debug dumpHprofData

Introduction

In this page you can find the example usage for android.os Debug dumpHprofData.

Prototype

public static void dumpHprofData(String fileName) throws IOException 

Source Link

Document

Dump "hprof" data to the specified file.

Usage

From source file:Main.java

public static void dumpHprof(String path) {
    try {// w  w  w.  ja va2  s .  c o  m
        String name = getDate() + OOM_SUFFIX;
        path = path + File.separator + name;
        File file = path != null ? new File(path) : null;
        if (!file.getParentFile().exists())
            file.getParentFile().mkdirs();
        Debug.dumpHprofData(path);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:com.anysoftkeyboard.ui.dev.DeveloperUtils.java

public static File createMemoryDump() throws IOException, UnsupportedOperationException {
    File extFolder = Environment.getExternalStorageDirectory();
    File target = new File(extFolder, ASK_MEM_DUMP_FILENAME);
    target.delete();//  w  ww .j  a  v a 2s .c  om
    Debug.dumpHprofData(target.getAbsolutePath());
    return target;
}