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


##########
src/couch/src/couch_debug.erl:
##########
@@ -335,6 +338,63 @@ 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 it as a 
first snapshot into 
+        `resource_hoggers_snapshot/1`. Then, periodically call 
`resource_hoggers_snapshot/1` and pass in
+        the previous snapshot.
+
+        Here is an example 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]),

Review Comment:
   You need to escape `~` as well.
   
   ```
   io:format(\"Snapshot ~~p/10~~n\", [I]),
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to