]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Util.java
Allow tab-separated columnized logging of memory use
[simantics/platform.git] / bundles / org.simantics.nativemem / src / org / simantics / nativemem / internal / Util.java
index fcfb07f18503b6bb97f7d70202c3bc5a4d77d51f..666537630c2a09c142941c8dc8b051ac8d078185 100644 (file)
@@ -16,8 +16,14 @@ package org.simantics.nativemem.internal;
  */
 public class Util {
 
-    public static double toMb(long bytes) {
-        return (double) bytes / 1048576.0;
+    public static final String NL = String.format("%n");
+
+    public static long toMb(long numBytes) {
+        return (numBytes + (512 * 1024)) / (1024 * 1024);
+    }
+
+    public static long toKb(long numBytes) {
+        return (numBytes + 512) / 1024;
     }
 
 }
\ No newline at end of file