Skip to content

Commit 6eee931

Browse files
authored
[minibench] Add PSS data to result
Differential Revision: D70721477 Pull Request resolved: #8984
1 parent 73acde9 commit 6eee931

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

extension/benchmark/android/benchmark/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414

1515
defaultConfig {
1616
applicationId = "org.pytorch.minibench"
17-
minSdk = 28
18-
targetSdk = 33
17+
minSdk = 34
18+
targetSdk = 34
1919
versionCode = 1
2020
versionName = "1.0"
2121

extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench/BenchmarkActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.content.Intent;
1313
import android.os.AsyncTask;
1414
import android.os.Bundle;
15+
import android.os.Debug;
1516
import android.system.ErrnoException;
1617
import android.system.Os;
1718
import com.google.gson.Gson;
@@ -47,6 +48,8 @@ protected void onCreate(Bundle savedInstanceState) {
4748
int numIter = intent.getIntExtra("num_iter", 50);
4849
int numWarmupIter = intent.getIntExtra("num_warm_up_iter", 10);
4950

51+
long pssIdle = Debug.getPss();
52+
5053
// TODO: Format the string with a parsable format
5154
Stats stats = new Stats();
5255

@@ -103,6 +106,10 @@ protected void onPostExecute(Void aVoid) {
103106
0.0f));
104107
// Load status
105108
results.add(new BenchmarkMetric(benchmarkModel, "load_status", stats.errorCode, 0));
109+
// RAM PSS usage
110+
results.add(
111+
new BenchmarkMetric(
112+
benchmarkModel, "ram_pss_usage(mb)", (Debug.getPss() - pssIdle) / 1024, 0));
106113

107114
try (FileWriter writer = new FileWriter(getFilesDir() + "/benchmark_results.json")) {
108115
Gson gson = new Gson();

0 commit comments

Comments
 (0)