summaryrefslogtreecommitdiff
path: root/modules/multiplayer/editor
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-16 22:48:12 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-11-17 03:14:21 +0100
commit92ed27d8f66c207125f2fbb9a8c988863d54bf0d (patch)
treeea82269b6d0eb415c6673ced2b6d30a4e1d5997f /modules/multiplayer/editor
parent2846ea1ffafddfc447036b37d255f72cb278b677 (diff)
[MP] Improve network profiler.
Fix RPC profiler and add average RPC size. Improve bandwidth debugger to account for all multiplayer traffic (excluding the lower level peer transformations).
Diffstat (limited to 'modules/multiplayer/editor')
-rw-r--r--modules/multiplayer/editor/editor_network_profiler.cpp10
-rw-r--r--modules/multiplayer/editor/editor_network_profiler.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp
index a7e5b80b66..c78b32ed49 100644
--- a/modules/multiplayer/editor/editor_network_profiler.cpp
+++ b/modules/multiplayer/editor/editor_network_profiler.cpp
@@ -67,8 +67,8 @@ void EditorNetworkProfiler::_update_frame() {
}
node->set_text(0, E.value.node_path);
- node->set_text(1, E.value.incoming_rpc == 0 ? "-" : itos(E.value.incoming_rpc));
- node->set_text(2, E.value.outgoing_rpc == 0 ? "-" : itos(E.value.outgoing_rpc));
+ node->set_text(1, E.value.incoming_rpc == 0 ? "-" : vformat(TTR("%d (%s)"), E.value.incoming_rpc, String::humanize_size(E.value.incoming_size)));
+ node->set_text(2, E.value.outgoing_rpc == 0 ? "-" : vformat(TTR("%d (%s)"), E.value.outgoing_rpc, String::humanize_size(E.value.outgoing_size)));
}
}
@@ -99,6 +99,12 @@ void EditorNetworkProfiler::add_node_frame_data(const RPCNodeInfo p_frame) {
nodes_data[p_frame.node].incoming_rpc += p_frame.incoming_rpc;
nodes_data[p_frame.node].outgoing_rpc += p_frame.outgoing_rpc;
}
+ if (p_frame.incoming_rpc) {
+ nodes_data[p_frame.node].incoming_size = p_frame.incoming_size / p_frame.incoming_rpc;
+ }
+ if (p_frame.outgoing_rpc) {
+ nodes_data[p_frame.node].outgoing_size = p_frame.outgoing_size / p_frame.outgoing_rpc;
+ }
if (frame_delay->is_stopped()) {
frame_delay->set_wait_time(0.1);
diff --git a/modules/multiplayer/editor/editor_network_profiler.h b/modules/multiplayer/editor/editor_network_profiler.h
index 98d12e3c0a..65d08dcd56 100644
--- a/modules/multiplayer/editor/editor_network_profiler.h
+++ b/modules/multiplayer/editor/editor_network_profiler.h
@@ -66,7 +66,7 @@ protected:
static void _bind_methods();
public:
- void add_node_frame_data(const RPCNodeInfo p_frame);
+ void add_node_frame_data(RPCNodeInfo p_frame);
void set_bandwidth(int p_incoming, int p_outgoing);
bool is_profiling();