usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdun...@apache.org
Subject [2/2] usergrid git commit: Tweak heap status to return used heap, and changed endpoint to status/heap.
Date Mon, 25 Apr 2016 15:01:08 GMT
Tweak heap status to return used heap, and changed endpoint to status/heap.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/26959622
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/26959622
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/26959622

Branch: refs/heads/9f45130_app_cache_fix
Commit: 26959622ac6c5ef8d96488a7eae14ea9ab380bcb
Parents: 33cca21
Author: Mike Dunker <mdunker@apigee.com>
Authored: Thu Apr 21 11:07:08 2016 -0700
Committer: Mike Dunker <mdunker@apigee.com>
Committed: Mon Apr 25 08:00:17 2016 -0700

----------------------------------------------------------------------
 .../java/org/apache/usergrid/rest/RootResource.java   | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/26959622/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
index 9701105..b8abe54 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
@@ -249,22 +249,24 @@ public class RootResource extends AbstractContextResource implements
MetricProce
     }
 
     @GET
-    @Path("/status/memory")
+    @Path("/status/heap")
     @JSONP
     @Produces({MediaType.APPLICATION_JSON, "application/javascript"})
-    public ApiResponse getMemoryStats(){
+    public ApiResponse getHeapStats(){
 
         ApiResponse response = createApiResponse();
 
         ObjectNode node = JsonNodeFactory.instance.objectNode();
 
-        long heapSize = Runtime.getRuntime().totalMemory();
+        long heapAllocatedSize = Runtime.getRuntime().totalMemory();
         long heapMaxSize = Runtime.getRuntime().maxMemory();
         long heapFreeSize = Runtime.getRuntime().freeMemory();
+        long heapUsedSize = heapAllocatedSize - heapFreeSize;
 
-        node.put( "currentHeap", org.apache.usergrid.utils.StringUtils.readableByteSize(heapSize)
);
-        node.put( "maxHeap", org.apache.usergrid.utils.StringUtils.readableByteSize(heapMaxSize)
);
-        node.put( "freeHeap", org.apache.usergrid.utils.StringUtils.readableByteSize(heapFreeSize)
);
+        node.put( "used", org.apache.usergrid.utils.StringUtils.readableByteSize(heapUsedSize)
);
+        node.put( "free", org.apache.usergrid.utils.StringUtils.readableByteSize(heapFreeSize)
);
+        node.put( "allocated", org.apache.usergrid.utils.StringUtils.readableByteSize(heapAllocatedSize)
);
+        node.put( "max", org.apache.usergrid.utils.StringUtils.readableByteSize(heapMaxSize)
);
 
         response.setProperty( "status", node );
         return response;


Mime
View raw message