mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Add convenience methods for tracing
This commit is contained in:
@@ -23,6 +23,8 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Debug;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -126,4 +128,22 @@ public abstract class UIHelper
|
|||||||
if(looper == Looper.getMainLooper())
|
if(looper == Looper.getMainLooper())
|
||||||
throw new RuntimeException("This method should never be called from the main thread");
|
throw new RuntimeException("This method should never be called from the main thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startTracing()
|
||||||
|
{
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.startMethodTracingSampling("Android/data/org.isoron.uhabits/perf",
|
||||||
|
32 * 1024 * 1024, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void stopTracing()
|
||||||
|
{
|
||||||
|
Debug.stopMethodTracing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user