| Chunk |
|---|
| Conflicting content |
|---|
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; <<<<<<< HEAD ======= import java.io.PrintStream; >>>>>>> 41e99538638795e38b0a02711ceb572d67a779a3 import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; |
| Solution content |
|---|
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; |
| File |
|---|
| SamplingProfilerIntegration.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
* Starts the profiler if profiling is enabled.
*/
public static void start() {
<<<<<<< HEAD
if (!enabled) return;
SamplingProfiler.getInstance().start(samplingProfilerHz);
=======
if (!enabled) {
return;
}
ThreadGroup group = Thread.currentThread().getThreadGroup();
SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupTheadSet(group);
INSTANCE = new SamplingProfiler(4, threadSet);
INSTANCE.start(10);
>>>>>>> 41e99538638795e38b0a02711ceb572d67a779a3
}
/** |
| Solution content |
|---|
* Starts the profiler if profiling is enabled.
*/
public static void start() {
if (!enabled) {
return;
}
ThreadGroup group = Thread.currentThread().getThreadGroup();
SamplingProfiler.ThreadSet threadSet = SamplingProfiler.newThreadGroupTheadSet(group);
INSTANCE = new SamplingProfiler(4, threadSet);
INSTANCE.start(samplingProfilerHz);
}
/** |
| File |
|---|
| SamplingProfilerIntegration.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
/**
* Writes a snapshot if profiling is enabled.
*/
<<<<<<< HEAD
public static void writeSnapshot(final String processName, final PackageInfo packageInfo) {
if (!enabled) return;
=======
public static void writeSnapshot(final String name) {
if (!enabled) {
return;
}
>>>>>>> 41e99538638795e38b0a02711ceb572d67a779a3
/*
* If we're already writing a snapshot, don't bother enqueueing another |
| Solution content |
|---|
/**
* Writes a snapshot if profiling is enabled.
*/
public static void writeSnapshot(final String processName, final PackageInfo packageInfo) {
if (!enabled) {
return;
}
/*
* If we're already writing a snapshot, don't bother enqueueing another |
| File |
|---|
| SamplingProfilerIntegration.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| If statement |
| Method signature |
| Chunk |
|---|
| Conflicting content |
|---|
* Writes the zygote's snapshot to internal storage if profiling is enabled.
*/
public static void writeZygoteSnapshot() {
<<<<<<< HEAD
if (!enabled) return;
writeSnapshot("zygote", null);
}
/**
* pass in PackageInfo to retrieve various values for snapshot header
*/
private static void writeSnapshot(String dir, String processName, PackageInfo packageInfo) {
byte[] snapshot = SamplingProfiler.getInstance().snapshot();
if (snapshot == null) {
=======
if (!enabled) {
return;
}
String dir = "/data/zygote/snapshots";
new File(dir).mkdirs();
writeSnapshot(dir, "zygote");
INSTANCE.shutdown();
INSTANCE = null;
}
private static void writeSnapshot(String dir, String name) {
if (!enabled) {
>>>>>>> 41e99538638795e38b0a02711ceb572d67a779a3
return;
}
INSTANCE.stop(); |
| Solution content |
|---|
* Writes the zygote's snapshot to internal storage if profiling is enabled.
*/
public static void writeZygoteSnapshot() {
if (!enabled) {
return;
}
writeSnapshot("zygote", null);
INSTANCE.shutdown();
INSTANCE = null;
}
/**
* pass in PackageInfo to retrieve various values for snapshot header
*/
private static void writeSnapshot(String dir, String processName, PackageInfo packageInfo) {
if (!enabled) {
return;
}
INSTANCE.stop(); |
| File |
|---|
| SamplingProfilerIntegration.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| If statement |
| Method invocation |
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
* we capture two snapshots in rapid succession.
*/
long start = System.currentTimeMillis();
<<<<<<< HEAD
String name = processName.replaceAll(":", ".");
String path = dir + "/" + name + "-" +System.currentTimeMillis() + ".snapshot";
FileOutputStream out = null;
try {
out = new FileOutputStream(path);
generateSnapshotHeader(name, packageInfo, out);
out.write(snapshot);
} catch (IOException e) {
Log.e(TAG, "Error writing snapshot.", e);
} finally {
try {
if(out != null) {
out.close();
}
} catch (IOException ex) {
// let it go.
}
}
// set file readable to the world so that SamplingProfilerService
// can put it to dropbox
new File(path).setReadable(true, false);
long elapsed = System.currentTimeMillis() - start;
Log.i(TAG, "Wrote snapshot for " + name + " in " + elapsed + "ms.");
}
/**
* generate header for snapshots, with the following format (like http header):
*
* Version: |
| Solution content |
|---|
* we capture two snapshots in rapid succession.
*/
long start = System.currentTimeMillis();
String name = processName.replaceAll(":", ".");
String path = dir + "/" + name + "-" +System.currentTimeMillis() + ".snapshot";
PrintStream out = null;
try {
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);
INSTANCE.writeHprofData(out);
} finally {
out.close();
}
if (out.checkError()) {
Log.e(TAG, "Error writing snapshot.");
return;
}
// set file readable to the world so that SamplingProfilerService
// can put it to dropbox
new File(path).setReadable(true, false);
long elapsed = System.currentTimeMillis() - start;
Log.i(TAG, "Wrote snapshot for " + name + " in " + elapsed + "ms.");
}
/**
* generate header for snapshots, with the following format (like http header):
*
* Version: |
| File |
|---|
| SamplingProfilerIntegration.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| While statement |