start Debug Trace - Android App

Android examples for App:Log

Description

start Debug Trace

Demo Code


import java.util.Random;
import android.os.Debug;
import android.os.Debug.MemoryInfo;
import android.util.Log;

public class Main{
    private static final String TAG = "";
    public static boolean isMethodTrace = false;
    public static boolean isAllocCounting = false;
    public static int traceSize = 150000000;
    private static Random rand = new Random(System.currentTimeMillis());
    public static void startTrace() {
        if (isMethodTrace) {
            String str = "FlowEngine" + rand.nextInt();
            forcelog(TAG, "Starting method tracing (" + str + ")..");
            Debug.startMethodTracing(str, traceSize);
        }//from   ww w.ja  v  a2  s  .c  om
        if (isAllocCounting) {
            forcelog(TAG, "Starting alloc counting..");
            Debug.startAllocCounting();
        }
    }
    public static void forcelog(String tag, String msg) {
        Log.d(tag, msg);
    }
}

Related Tutorials