Libraryless. Click here for Pure Java version (450L/3K).
mainClassName LinuxProcessSizeDetector set flag Reparse. set flag LeanMode. set flag l_withoutReflection. set flag NoAutoGunzip. do not include function get. sbool linux_rssFixedForZGC_verbose; public static long linux_rssFixedForZGC() throws IOException { ret linux_rssFixedForZGC(processID_int()); } public static long linux_rssFixedForZGC(int pid) throws IOException { //if (!is64BitLinux()) fail("Not on 64 Bit Linux"); S range = null; new TreeMap<S, Long> rssByRange; Pattern patAddr = Pattern.compile("^([0-9a-f]{1,16})-"); temp BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("/proc/" + pid + "/smaps"))); S s; while ((s = in.readLine()) != null) { Matcher m = patAddr.matcher(s); S addr = m.find() ? m.group(1) : null; if (addr != null) { //print("Have address: " + addr); S cleanedAddr = longToHex(parseUnsignedHexLong(addr) & ~((1L << 42)-1)); range = takeFirst_string(6, cleanedAddr); continue; } // else print("Not range: " + s); S[] p = parseColonProperty_array(s); if (eqic(first(p), "rss")) { long size = Long.parseLong(beforeSpace(p[1])); if (size != 0) rssByRange.put(range, getOrCreate_long(rssByRange, range) + size); } } if (linux_rssFixedForZGC_verbose) for (Map.Entry<S, Long> e : rssByRange.entrySet()) { System.out.println("Address range " + rpad(e.getKey(), 16, 'x') + ": " + toK(e.getValue()) + " MB"); } Long min = null; for (S _range : ll("000004", "000008", "000010", "00007c")) { Long l = rssByRange.get(_range); if (l != null) min = min == null ? l : Math.min(min, l); } long total = 0; for (long l : rssByRange.values()) total += l; long guess = min == null ? total : total-min*3; ret guess*1024; }
Began life as a copy of #1025548
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025551 |
Snippet name: | linux_rssFixedForZGC for export |
Eternal ID of this version: | #1025551/23 |
Text MD5: | be16b57fdf9236cbb47ddffe915b7a50 |
Transpilation MD5: | 13ee2262983ef7eee2d2c35183df5562 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-03 13:31:19 |
Source code size: | 1857 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 277 / 518 |
Version history: | 22 change(s) |
Referenced in: | [show references] |