Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1017c9c2 authored by Eric Holk's avatar Eric Holk
Browse files

Add acquire/release wake lock benchmark

Change-Id: Iae151d18a80f5acfdd205d9af1d2ee677153b8db
parent 3e4452b2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -91,4 +91,6 @@

    </application>

    <uses-permission android:name="android.permission.WAKE_LOCK" />

</manifest>
+10 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.AsyncTask;
import android.os.PowerManager;

/**
 * An interface for running benchmarks and collecting results. Used so we can have both an
@@ -167,6 +168,13 @@ class SystemServerBenchmarks {
        benchmarks.addBenchmark("getPackageIntentForSender", () -> {
            pi.getCreatorPackage();
        });

        PowerManager pwr = (PowerManager) parent.getSystemService(Context.POWER_SERVICE);
        PowerManager.WakeLock wl = pwr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "benchmark tag");
        benchmarks.addBenchmark("WakeLock Acquire/Release", () -> {
            wl.acquire();
            wl.release();
        });
    }

    /**