diff --git a/modules/net/dap_chain_node_rpc.c b/modules/net/dap_chain_node_rpc.c index e75392e81537373d218bcfe2966bd4d87b86f594..f35458d3800a8ce3c3bd25bc816c647dccdbe348 100644 --- a/modules/net/dap_chain_node_rpc.c +++ b/modules/net/dap_chain_node_rpc.c @@ -68,7 +68,7 @@ static void s_collect_cmd_stat_info(int16_t a_cmd_num, int64_t a_call_time) atomic_fetch_add(&(s_cmd_call_stat + a_cmd_num)->time, a_call_time); } -#ifdef UNIX +#ifdef linux /** * @brief get states info about current * @param a_arg - pointer to callback arg @@ -133,7 +133,7 @@ void dap_chain_node_rpc_init(dap_config_t *a_cfg) return; } if (l_role == RPC_ROLE_SERVER) { -#ifdef UNIX +#ifdef linux if (dap_proc_thread_timer_add(NULL, s_update_node_rpc_states_info, NULL, s_timer_update_states_info)) { log_it(L_ERROR, "Can't activate timer on node states update"); } else { @@ -141,7 +141,7 @@ void dap_chain_node_rpc_init(dap_config_t *a_cfg) dap_cli_server_statistic_callback_add(s_collect_cmd_stat_info); } #else - log_it(L_ERROR, "RPC server role avaible only on unix system"); + log_it(L_ERROR, "RPC server role avaible only on linux system"); #endif } } @@ -174,9 +174,14 @@ dap_string_t *dap_chain_node_rpc_states_info_read(dap_stream_node_addr_t a_addr) dap_nanotime_to_str_rfc822(l_ts, sizeof(l_ts), l_timestamp); dap_string_append_printf(l_ret, "Record timestamp: %s\nRecord version: %u\nNode addr: %s\n" - "Location: %s\nCli thread count: %u\nLinks count: %u\n", + "Location: %d\nCli thread count: %u\nLinks count: %u\n" + "Loads: %d %d %d\n" + "Procs: %u\nFree ram: %lu\nTotal ram: %lu\n", l_ts, l_node_info->version, l_node_addr_str, - l_node_info->location, l_node_info->cli_thread_count, l_node_info->links_count); + l_node_info->location, l_node_info->cli_thread_count, l_node_info->links_count, + l_node_info->sysinfo.loads[0], l_node_info->sysinfo.loads[1], l_node_info->sysinfo.loads[2], + l_node_info->sysinfo.procs, l_node_info->sysinfo.freeram, l_node_info->sysinfo.totalram + ); return l_ret; } diff --git a/modules/net/include/dap_chain_node_rpc.h b/modules/net/include/dap_chain_node_rpc.h index 7f2a86e7ca2db4e255de91c20292fd53537a2100..7fccec8654d6a56cd816ae371085280f918ee8b1 100644 --- a/modules/net/include/dap_chain_node_rpc.h +++ b/modules/net/include/dap_chain_node_rpc.h @@ -23,7 +23,7 @@ #include "dap_chain_node_cli_cmd.h" #include "dap_config.h" -#ifdef UNIX +#ifdef linux #include <sys/sysinfo.h> #else struct sysinfo { // temporary added to read @@ -65,6 +65,7 @@ typedef struct dap_chain_node_rpc_states_info { dap_chain_node_rpc_states_info_t *dap_chain_node_rpc_get_states_sort(size_t *a_count); bool dap_chain_node_rpc_is_my_node_authorized(); bool dap_chain_node_rpc_is_balancer_node(); + dap_string_t *dap_chain_node_rpc_states_info_read(dap_stream_node_addr_t a_addr); DAP_STATIC_INLINE size_t dap_chain_node_rpc_get_states_info_size(dap_chain_node_rpc_states_info_t *a_info) {