@@ -182,6 +182,10 @@ static native void nativeRegisterCustomType(long store, int entityId, int proper
182
182
183
183
native long nativeValidate (long store , long pageLimit , boolean checkLeafLevel );
184
184
185
+ static native long nativeSysProcMeminfoKb (String key );
186
+
187
+ static native long nativeSysProcStatusKb (String key );
188
+
185
189
/** @return sync availability (0: none; 1: client; 2: server) */
186
190
static native int nativeGetSupportedSync ();
187
191
@@ -405,7 +409,6 @@ public static boolean isDatabaseOpen(Object context, @Nullable String dbNameOrNu
405
409
*/
406
410
public static boolean isDatabaseOpen (@ Nullable File baseDirectoryOrNull ,
407
411
@ Nullable String dbNameOrNull ) throws IOException {
408
-
409
412
File dbDir = BoxStoreBuilder .getDbDir (baseDirectoryOrNull , dbNameOrNull );
410
413
return isFileOpen (dbDir .getCanonicalPath ());
411
414
}
@@ -420,6 +423,43 @@ public static boolean isDatabaseOpen(File directory) throws IOException {
420
423
return isFileOpen (directory .getCanonicalPath ());
421
424
}
422
425
426
+ /**
427
+ * Linux only: extracts a kB value from /proc/meminfo (system wide memory information).
428
+ * A couple of interesting keys (from 'man proc'):
429
+ * - MemTotal: Total usable RAM (i.e., physical RAM minus a few reserved bits and the kernel binary code).
430
+ * - MemFree: The sum of LowFree+HighFree.
431
+ * - MemAvailable: An estimate of how much memory is available for starting new applications, without swapping.
432
+ *
433
+ * @param key The string identifying the wanted line from /proc/meminfo to extract a Kb value from. E.g. "MemTotal".
434
+ * @return Kb value or 0 on failure
435
+ */
436
+ @ Experimental
437
+ static long sysProcMeminfoKb (String key ) {
438
+ return nativeSysProcMeminfoKb (key );
439
+ }
440
+
441
+ /**
442
+ * Linux only: extracts a kB value from /proc/self/status (process specific information).
443
+ * A couple of interesting keys (from 'man proc'):
444
+ * - VmPeak: Peak virtual memory size.
445
+ * - VmSize: Virtual memory size.
446
+ * - VmHWM: Peak resident set size ("high water mark").
447
+ * - VmRSS: Resident set size. Note that the value here is the sum of RssAnon, RssFile, and RssShmem.
448
+ * - RssAnon: Size of resident anonymous memory. (since Linux 4.5).
449
+ * - RssFile: Size of resident file mappings. (since Linux 4.5).
450
+ * - RssShmem: Size of resident shared memory (includes System V shared memory, mappings from tmpfs(5),
451
+ * and shared anonymous mappings). (since Linux 4.5).
452
+ * - VmData, VmStk, VmExe: Size of data, stack, and text segments.
453
+ * - VmLib: Shared library code size.
454
+ *
455
+ * @param key The string identifying the wanted line from /proc/self/status to extract a Kb value from. E.g. "VmSize".
456
+ * @return Kb value or 0 on failure
457
+ */
458
+ @ Experimental
459
+ static long sysProcStatusKb (String key ) {
460
+ return nativeSysProcStatusKb (key );
461
+ }
462
+
423
463
/**
424
464
* The size in bytes occupied by the data file on disk.
425
465
*
0 commit comments