am e2be3416: Merge "Don\'t call broken+deprecated SamplingProfiler.writeHprofData" into honeycomb
* commit 'e2be3416f2851a5bc482ad103c771f212e88ef20': Don't call broken+deprecated SamplingProfiler.writeHprofData
This commit is contained in:
@@ -16,22 +16,21 @@
|
|||||||
|
|
||||||
package com.android.internal.os;
|
package com.android.internal.os;
|
||||||
|
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.util.Log;
|
||||||
import dalvik.system.SamplingProfiler;
|
import dalvik.system.SamplingProfiler;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import android.content.pm.PackageInfo;
|
import libcore.io.IoUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.os.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integrates the framework with Dalvik's sampling profiler.
|
* Integrates the framework with Dalvik's sampling profiler.
|
||||||
@@ -162,19 +161,16 @@ public class SamplingProfilerIntegration {
|
|||||||
PrintStream out = null;
|
PrintStream out = null;
|
||||||
try {
|
try {
|
||||||
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path)));
|
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path)));
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Could not open " + path + ":" + e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
generateSnapshotHeader(name, packageInfo, out);
|
generateSnapshotHeader(name, packageInfo, out);
|
||||||
INSTANCE.writeHprofData(out);
|
new SamplingProfiler.AsciiHprofWriter(INSTANCE.getHprofData(), out).write();
|
||||||
} finally {
|
if (out.checkError()) {
|
||||||
out.close();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
if (out.checkError()) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Error writing snapshot.");
|
Log.e(TAG, "Error writing snapshot to " + path, e);
|
||||||
return;
|
return;
|
||||||
|
} finally {
|
||||||
|
IoUtils.closeQuietly(out);
|
||||||
}
|
}
|
||||||
// set file readable to the world so that SamplingProfilerService
|
// set file readable to the world so that SamplingProfilerService
|
||||||
// can put it to dropbox
|
// can put it to dropbox
|
||||||
|
|||||||
Reference in New Issue
Block a user