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


Java Debug.dumpHprofData方法代码示例

本文整理汇总了Java中android.os.Debug.dumpHprofData方法的典型用法代码示例。如果您正苦于以下问题:Java Debug.dumpHprofData方法的具体用法?Java Debug.dumpHprofData怎么用?Java Debug.dumpHprofData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Debug的用法示例。


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

示例1: dumpHeap

import android.os.Debug; //导入方法依赖的package包/类
public File dumpHeap() {
    if (!LeakCanaryInternals.isExternalStorageWritable()) {
        Log.d(TAG, "Could not dump heap, external storage not mounted.");
    }
    File heapDumpFile = getHeapDumpFile();
    if (heapDumpFile.exists()) {
        Log.d(TAG, "Could not dump heap, previous analysis still is in progress.");
        return NO_DUMP;
    }
    FutureResult<Toast> waitingForToast = new FutureResult();
    showToast(waitingForToast);
    if (waitingForToast.wait(5, TimeUnit.SECONDS)) {
        Toast toast = (Toast) waitingForToast.get();
        try {
            Debug.dumpHprofData(heapDumpFile.getAbsolutePath());
            cancelToast(toast);
            return heapDumpFile;
        } catch (IOException e) {
            cleanup();
            Log.e(TAG, "Could not perform heap dump", e);
            return NO_DUMP;
        }
    }
    Log.d(TAG, "Did not dump heap, too much time waiting for Toast.");
    return NO_DUMP;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:AndroidHeapDumper.java

示例2: dumpHeap

import android.os.Debug; //导入方法依赖的package包/类
public static void dumpHeap(String filename) {
	try {
		Debug.dumpHprofData(filename);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:9,代码来源:HeapDump.java

示例3: dumpHeap

import android.os.Debug; //导入方法依赖的package包/类
@Override
public File dumpHeap() {
   if (!isExternalStorageWritable()) {
     Log.d(TAG, "Could not dump heap, external storage not mounted.");
   }
   File heapDumpFile = getHeapDumpFile();
   if (heapDumpFile.exists()) {
     Log.d(TAG, "Could not dump heap, previous analysis still is in progress.");
     // Heap analysis in progress, let's not put too much pressure on the device.
     return null;
   }
   try {
     Debug.dumpHprofData(heapDumpFile.getAbsolutePath());
     return heapDumpFile;
   } catch (IOException e) {
     cleanup();
     Log.e(TAG, "Could not perform heap dump", e);
     // Abort heap dump
     return null;
   }
 }
 
开发者ID:hehonghui,项目名称:leakcanary-for-eclipse,代码行数:22,代码来源:AndroidHeapDumper.java

示例4: writeHprof

import android.os.Debug; //导入方法依赖的package包/类
private void writeHprof(File outputPath) throws DumpException {
  try {
    // Test that we can write here.  dumpHprofData appears to hang if it cannot write
    // to the target location on ART.
    truncateAndDeleteFile(outputPath);
    Debug.dumpHprofData(outputPath.getAbsolutePath());
  } catch (IOException e) {
    throw new DumpException("Failure writing to " + outputPath + ": " + e.getMessage());
  }
}
 
开发者ID:Laisly,项目名称:weex,代码行数:11,代码来源:HprofDumperPlugin.java

示例5: dumpHeap

import android.os.Debug; //导入方法依赖的package包/类
public static void dumpHeap(String filename) {
    try {
        Debug.dumpHprofData(filename);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
开发者ID:CvvT,项目名称:AppTroy,代码行数:9,代码来源:HeapDump.java

示例6: dumpHeap

import android.os.Debug; //导入方法依赖的package包/类
@SuppressWarnings("ReferenceEquality") // Explicitly checking for named null.
@Override public File dumpHeap() {
  File heapDumpFile = leakDirectoryProvider.newHeapDumpFile();

  if (heapDumpFile == RETRY_LATER) {
    return RETRY_LATER;
  }

  FutureResult<Toast> waitingForToast = new FutureResult<>();
  showToast(waitingForToast);

  if (!waitingForToast.wait(5, SECONDS)) {
    CanaryLog.d("Did not dump heap, too much time waiting for Toast.");
    return RETRY_LATER;
  }

  Toast toast = waitingForToast.get();
  try {
    Debug.dumpHprofData(heapDumpFile.getAbsolutePath());
    cancelToast(toast);
    return heapDumpFile;
  } catch (Exception e) {
    CanaryLog.d(e, "Could not dump heap");
    // Abort heap dump
    return RETRY_LATER;
  }
}
 
开发者ID:square,项目名称:leakcanary,代码行数:28,代码来源:AndroidHeapDumper.java

示例7: uncaughtException

import android.os.Debug; //导入方法依赖的package包/类
@Override
public void uncaughtException(Thread thread, Throwable ex) {
	try {
		File dir = ctx.getExternalCacheDir();
		if (dir == null || !dir.canWrite())
			dir = ctx.getCacheDir();
		String fileName = generateCrashName(ex.getMessage());
		File log = new File(dir, fileName + ".log");
		log.setReadable(true, false);

		PrintWriter writer = new PrintWriter(log);
		printAppInfo(writer);

		writer.println();
		writer.println("Exception for crash --------");
		writer.println("Exception in thread- " + thread.getName() + "-" + thread.getId());
		ex.printStackTrace(writer);

		printDeviceInformation(ctx, writer);
		printThreadStack(writer);
		printLogcat(writer);
		writer.close();

		File hdump = null;
		if (ex instanceof OutOfMemoryError) {
			hdump = new File(dir, fileName + ".hprof");
			hdump.setReadable(true, false);
			try {
				Debug.dumpHprofData(hdump.getAbsolutePath());
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
				hdump = null;
			}
		}
		sendCrashReport(ctx, "Crash report for " + appName, log, hdump);
	} catch (Throwable e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	// hand over to the default handler
	if (defaultHandler != null)
		defaultHandler.uncaughtException(thread, ex);
}
 
开发者ID:ROKOLabs,项目名称:ROKO.Stickers-Android,代码行数:45,代码来源:CrashMonitor.java


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