This is an automated email from the ASF dual-hosted git repository.

jiahuili430 pushed a commit to branch improve-couch-debug
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit c5c9cee749f82d6fc2236a82c6064e22810ddb82
Author: Jiahui Li <[email protected]>
AuthorDate: Wed May 14 14:33:08 2025 -0500

    Use `module_info(exports)` instead of hardcoding
    
    - Export `print_tree/2` as it's already documented in
      `couch_debug:help/1` function.
    - Add a new line after each resource hoggers snapshot table for
      better viewing.
---
 src/couch/src/couch_debug.erl | 29 +++++------------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/couch/src/couch_debug.erl b/src/couch/src/couch_debug.erl
index ff864210f..0e89bfaf0 100644
--- a/src/couch/src/couch_debug.erl
+++ b/src/couch/src/couch_debug.erl
@@ -57,7 +57,8 @@
 -export([
     print_table/2,
     print_report/1,
-    print_report_with_info_width/2
+    print_report_with_info_width/2,
+    print_tree/2
 ]).
 
 -type throw(_Reason) :: no_return().
@@ -75,29 +76,7 @@
 -spec help() -> [function_name()].
 
 help() ->
-    [
-        busy,
-        opened_files,
-        opened_files_by_regexp,
-        opened_files_contains,
-        process_name,
-        get_pid,
-        link_tree,
-        mapfold,
-        map,
-        fold,
-        linked_processes_info,
-        print_linked_processes,
-        memory_info,
-        print_table,
-        print_report,
-        print_report_with_info_width,
-        restart,
-        restart_busy,
-        dead_nodes,
-        ping_nodes,
-        node_events
-    ].
+    lists:uniq([F || {F, _A} <- couch_debug:module_info(exports)]).
 
 -spec help(Function :: function_name()) -> ok.
 %% erlfmt-ignore
@@ -768,6 +747,7 @@ info_size(InfoKV) ->
         {binary, BinInfos} -> lists:sum([S || {_, S, _} <- BinInfos]);
         {_, V} -> V
     end.
+
 resource_hoggers(MemoryInfo, InfoKey) ->
     KeyFun = fun
         ({_Pid, _Id, undefined}) -> undefined;
@@ -1007,6 +987,7 @@ print_table(Rows, TableSpec) ->
         end,
         Rows
     ),
+    io:format("~n", []),
     ok.
 
 print_report(Report) ->

Reply via email to