iilyak commented on code in PR #3985:
URL: https://github.com/apache/couchdb/pull/3985#discussion_r877457402


##########
src/couch/src/couch_debug.erl:
##########
@@ -335,6 +338,50 @@ help(print_tree) ->
           - TableSpec: List of either {Value} or {Width, Align, Value}
             where Align is either left/center/right.
 
+        ---
+    ", []);
+help(resource_hoggers) ->
+    io:format("
+        resource_hoggers(MemoryInfo, InfoKey)
+        --------------------------------
+
+        Prints the top processes hogging resources along with the value 
associated with InfoKey.
+          - MemoryInfo: Data map containing values for a set of InfoKeys
+            (same structure returned by memory_info)
+          - InfoKey: Desired key to obtain value for. The supported keys are
+            binary, dictionary, heap_size, links, memory, message_queue_len, 
monitored_by,
+            monitors, stack_size, and total_heap_size
+
+        ---
+    ", []);
+help(resource_hoggers_snapshot) ->
+    io:format("
+        resource_hoggers_snapshot(MemoryInfo)
+        resource_hoggers_snapshot(PreviousSnapshot)
+        --------------------------------
+
+        Prints a snapshot of the top processes hogging resources.
+          - MemoryInfo: Data map containing values for a set of InfoKeys
+            (same structure returned by memory_info)
+          - PreviousSnapshot: Previous snapshot of resource hoggers
+
+        An example workflow is to call `memory_info(Pids)` and pass this into 
`resource_hoggers_snapshot/1` along 

Review Comment:
   An example workflow is to call `memory_info(Pids)` and pass it as a first 
snapshot into `resource_hoggers_snapshot/1`. Then periodically call 
`resource_hoggers_snapshot/1` passing previous snapshot.
   
   Here is one possible use case.
   
   ```
   S0 = couch_debug:memory_info(erlang:processes()).
   Summary = lists:foldl(fun(I, S) -> 
       timer:sleep(1000), 
       io:format("Snapshot ~p/10~n", [I]),
       couch_debug:resource_hoggers_snapshot(S) 
   end, S0, lists:seq(1, 10)).
   couch_debug:analyze_resource_hoggers(Summary, 10).
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to