Debug memory usage

pull/184/head
M66B 4 years ago
parent 28885332ad
commit c5a2517141

@ -31,6 +31,7 @@ import android.database.sqlite.SQLiteDatabaseCorruptException;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Debug;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.Menu;
@ -92,7 +93,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swAuthSasl;
private TextView tvProcessors;
private TextView tvMemoryClass;
private TextView tvStorageSpace;
private TextView tvMemoryUsage;
private TextView tvStorageUsage;
private TextView tvFingerprint;
private Button btnCharsets;
private Button btnCiphers;
@ -151,7 +153,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swAuthSasl = view.findViewById(R.id.swAuthSasl);
tvProcessors = view.findViewById(R.id.tvProcessors);
tvMemoryClass = view.findViewById(R.id.tvMemoryClass);
tvStorageSpace = view.findViewById(R.id.tvStorageSpace);
tvMemoryUsage = view.findViewById(R.id.tvMemoryUsage);
tvStorageUsage = view.findViewById(R.id.tvStorageUsage);
tvFingerprint = view.findViewById(R.id.tvFingerprint);
btnCharsets = view.findViewById(R.id.btnCharsets);
btnCiphers = view.findViewById(R.id.btnCiphers);
@ -590,7 +593,16 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvMemoryClass.setText(getString(R.string.title_advanced_memory_class,
class_mb + " MB", Helper.humanReadableByteCount(mi.totalMem)));
tvStorageSpace.setText(getString(R.string.title_advanced_storage_space,
Runtime rt = Runtime.getRuntime();
long hused = rt.totalMemory() - rt.freeMemory();
long hmax = rt.maxMemory();
long nheap = Debug.getNativeHeapAllocatedSize();
tvMemoryUsage.setText(getString(R.string.title_advanced_memory_usage,
Helper.humanReadableByteCount(hused),
Helper.humanReadableByteCount(hmax),
Helper.humanReadableByteCount(nheap)));
tvStorageUsage.setText(getString(R.string.title_advanced_storage_usage,
Helper.humanReadableByteCount(Helper.getAvailableStorageSpace()),
Helper.humanReadableByteCount(Helper.getTotalStorageSpace())));
tvFingerprint.setText(Helper.getFingerprint(getContext()));

@ -409,15 +409,25 @@
app:layout_constraintTop_toBottomOf="@id/tvProcessors" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvStorageSpace"
android:id="@+id/tvMemoryUsage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_advanced_storage_space"
android:text="@string/title_advanced_memory_class"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryClass" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvStorageUsage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/title_advanced_storage_usage"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoryUsage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvFingerprint"
android:layout_width="0dp"
@ -428,7 +438,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvStorageSpace" />
app:layout_constraintTop_toBottomOf="@id/tvStorageUsage" />
<Button
android:id="@+id/btnCharsets"
@ -454,6 +464,6 @@
android:id="@+id/grpDebug"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swAuthPlain,swAuthLogin,swAuthSasl,tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" />
app:constraint_referenced_ids="swAuthPlain,swAuthLogin,swAuthSasl,tvProcessors,tvMemoryClass,tvMemoryUsage,tvStorageUsage,tvFingerprint,btnCharsets,btnCiphers" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -494,7 +494,8 @@
<string name="title_advanced_more">More options</string>
<string name="title_advanced_processors" translatable="false">Processors: %1$d</string>
<string name="title_advanced_memory_class" translatable="false">Memory class: %1$s/%2$s</string>
<string name="title_advanced_storage_space" translatable="false">Storage space: %1$s/%2$s</string>
<string name="title_advanced_memory_usage" translatable="false">Memory usage: %1$s/%2$s Native: %3$s</string>
<string name="title_advanced_storage_usage" translatable="false">Storage space: %1$s/%2$s</string>
<string name="title_advanced_charsets" translatable="false">Charsets</string>
<string name="title_advanced_ciphers" translatable="false">Ciphers</string>

Loading…
Cancel
Save