JonMagon / KDiskMark

A simple open-source disk benchmark tool for Linux distros
GNU General Public License v3.0
1.04k stars 43 forks source link

Android Support #142

Open mokurin000 opened 7 months ago

mokurin000 commented 7 months ago

As far as I know, Qt supports Android natively

execute fio

To call binary on TargetSdk >= 29, Android 10, we need call JNI to get our library path, then execute [lib_path]/libfio.so e.g. This is a future-proof method^0. by one line of java^2,

getContext().getApplicationInfo().nativeLibraryDir;

First, in AndroidManifest.xml:

android:extractNativeLibs = "true"

(This is already set by Qt I think)

Then, in lib/ARCH/, we place libfio.so

fio for android can be build with either NDK-clang or musl

But this means we need to repackage KDiskMark when updates it's fio binary, and users may not update/select their fio executable. With TargetSdk set to 28 (like termux), everything will be easy and great

performance issues

Additionally, after SDCardFS deprecation, I/O performance on android is largely degraded. FUSE Passthrough, which was introduced in Android 12, is yet experimental on 5.4+ android common kernel KDiskMark should optionally requires root to avoid multilayer buffering

Lastly, neither posixaio, nor libaio or io_uring is avaliable on Android. posixaio: not provided by bionic, musl implements this though, thread-pool based I/O is certainly behaves poor libaio: no upstream android support, existing android ports are unmaintained io_uring: disabled by Google for Security reason^3

By the way, the test files should be placed under KDiskMark app home, as the internal storage may not support the O_DIRECT flag