Show encoding time in plots

This commit is contained in:
Patrick Nicolas
2024-08-30 08:19:33 +02:00
parent 688bf2d263
commit bb22403f7e
5 changed files with 80 additions and 53 deletions
+55 -51
View File
@@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WiVRn 0.15\n" "Project-Id-Version: WiVRn 0.15\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-25 11:44+0200\n" "POT-Creation-Date: 2024-08-30 08:12+0200\n"
"PO-Revision-Date: 2024-05-20 13:00+0200\n" "PO-Revision-Date: 2024-05-20 13:00+0200\n"
"Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n" "Last-Translator: Guillaume Meunier <guillaume.meunier@centraliens.net>\n"
"Language: French\n" "Language: French\n"
@@ -10,39 +10,39 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: client/scenes/lobby.cpp:143 #: client/scenes/lobby.cpp:144
msgid "No supported swapchain format" msgid "No supported swapchain format"
msgstr "Aucun format de swapchain supporté" msgstr "Aucun format de swapchain supporté"
#: client/scenes/lobby.cpp:178 #: client/scenes/lobby.cpp:179
msgid "Incompatible WiVRn server: no protocol field in TXT" msgid "Incompatible WiVRn server: no protocol field in TXT"
msgstr "Serveur WiVRn incompatible : pas de champ protocol dans le TXT" msgstr "Serveur WiVRn incompatible : pas de champ protocol dans le TXT"
#: client/scenes/lobby.cpp:181 #: client/scenes/lobby.cpp:182
#, c++-format #, c++-format
msgid "Incompatible WiVRn server protocol (client: {}, server: {})" msgid "Incompatible WiVRn server protocol (client: {}, server: {})"
msgstr "" msgstr ""
"Version du protocole WiVRn du serveur incompatible (client: {}, serveur: {})" "Version du protocole WiVRn du serveur incompatible (client: {}, serveur: {})"
#: client/scenes/lobby.cpp:196 #: client/scenes/lobby.cpp:197
#, c++-format #, c++-format
msgid "Cannot resolve hostname: {}" msgid "Cannot resolve hostname: {}"
msgstr "Impossible de résoudre le nom: {}" msgstr "Impossible de résoudre le nom: {}"
#: client/scenes/lobby.cpp:235 #: client/scenes/lobby.cpp:236
#, c++-format #, c++-format
msgid "Cannot connect to {} ({}): {}" msgid "Cannot connect to {} ({}): {}"
msgstr "Impossible de se connecter à {} ({}): {}" msgstr "Impossible de se connecter à {} ({}): {}"
#: client/scenes/lobby.cpp:347 #: client/scenes/lobby.cpp:348
msgid "Waiting for connection" msgid "Waiting for connection"
msgstr "Attente de connexion" msgstr "Attente de connexion"
#: client/scenes/lobby_gui.cpp:84 #: client/scenes/lobby_gui.cpp:80
msgid "Video stream interrupted" msgid "Video stream interrupted"
msgstr "Flux vidéo interrompu" msgstr "Flux vidéo interrompu"
#: client/scenes/lobby_gui.cpp:86 #: client/scenes/lobby_gui.cpp:82
#, c++-format #, c++-format
msgid "" msgid ""
"Connection ready\n" "Connection ready\n"
@@ -51,32 +51,32 @@ msgstr ""
"Connexion prête\n" "Connexion prête\n"
"Démarrez une application VR sur {}" "Démarrez une application VR sur {}"
#: client/scenes/lobby_gui.cpp:101 #: client/scenes/lobby_gui.cpp:97
msgid "Close" msgid "Close"
msgstr "Fermer" msgstr "Fermer"
#: client/scenes/lobby_gui.cpp:103 #: client/scenes/lobby_gui.cpp:99
msgid "Cancel" msgid "Cancel"
msgstr "Annuler" msgstr "Annuler"
#: client/scenes/lobby_gui.cpp:108 #: client/scenes/lobby_gui.cpp:104
#, c++-format #, c++-format
msgid "Connection to {}" msgid "Connection to {}"
msgstr "Connexion à {}" msgstr "Connexion à {}"
#: client/scenes/lobby_gui.cpp:136 #: client/scenes/lobby_gui.cpp:132
msgid "Displayed name" msgid "Displayed name"
msgstr "Nom affiché" msgstr "Nom affiché"
#: client/scenes/lobby_gui.cpp:145 #: client/scenes/lobby_gui.cpp:141
msgid "Host name" msgid "Host name"
msgstr "Nom d'hôte" msgstr "Nom d'hôte"
#: client/scenes/lobby_gui.cpp:154 #: client/scenes/lobby_gui.cpp:150
msgid "Port" msgid "Port"
msgstr "Port" msgstr "Port"
#: client/scenes/lobby_gui.cpp:218 #: client/scenes/lobby_gui.cpp:214
msgid "" msgid ""
"Start a WiVRn server on your\n" "Start a WiVRn server on your\n"
"local network" "local network"
@@ -84,139 +84,143 @@ msgstr ""
"Démarrez un serveur WiVRn sur\n" "Démarrez un serveur WiVRn sur\n"
"le réseau local" "le réseau local"
#: client/scenes/lobby_gui.cpp:247 #: client/scenes/lobby_gui.cpp:243
msgid "Autoconnect" msgid "Autoconnect"
msgstr "Autoconnexion" msgstr "Autoconnexion"
#: client/scenes/lobby_gui.cpp:279 #: client/scenes/lobby_gui.cpp:275
msgid "Connect" msgid "Connect"
msgstr "Connexion" msgstr "Connexion"
#: client/scenes/lobby_gui.cpp:289 #: client/scenes/lobby_gui.cpp:285
msgid "Incompatible server version" msgid "Incompatible server version"
msgstr "Version du serveur incompatible" msgstr "Version du serveur incompatible"
#: client/scenes/lobby_gui.cpp:291 #: client/scenes/lobby_gui.cpp:287
msgid "Server not available" msgid "Server not available"
msgstr "Serveur non disponible" msgstr "Serveur non disponible"
#: client/scenes/lobby_gui.cpp:305 #: client/scenes/lobby_gui.cpp:301
msgid "Remove" msgid "Remove"
msgstr "Enlever" msgstr "Enlever"
#: client/scenes/lobby_gui.cpp:349 #: client/scenes/lobby_gui.cpp:346
msgid "Refresh rate" msgid "Refresh rate"
msgstr "Taux de rafraichissement" msgstr "Taux de rafraichissement"
#: client/scenes/lobby_gui.cpp:371 #: client/scenes/lobby_gui.cpp:368
msgid "Resolution scale" msgid "Resolution scale"
msgstr "Échelle" msgstr "Échelle"
#: client/scenes/lobby_gui.cpp:371 client/scenes/lobby_gui.cpp:375 #: client/scenes/lobby_gui.cpp:368 client/scenes/lobby_gui.cpp:372
#, c++-format #, c++-format
msgid "{} - {}x{} per eye" msgid "{} - {}x{} per eye"
msgstr "{} - {}x{} par œil" msgstr "{} - {}x{} par œil"
#: client/scenes/lobby_gui.cpp:386 #: client/scenes/lobby_gui.cpp:383
msgid "Enable microphone" msgid "Enable microphone"
msgstr "Activer le micro" msgstr "Activer le micro"
#: client/scenes/lobby_gui.cpp:414 #: client/scenes/lobby_gui.cpp:392
msgid "Enable video passthrough in lobby" msgid "Enable video passthrough in lobby"
msgstr "Activer la vue réelle dans l'accueil" msgstr "Activer la vue réelle dans l'accueil"
#: client/scenes/lobby_gui.cpp:422 #: client/scenes/lobby_gui.cpp:400
msgid "Show performance metrics" msgid "Show performance metrics"
msgstr "Afficher les métriques de performances" msgstr "Afficher les métriques de performances"
#: client/scenes/lobby_gui.cpp:426 #: client/scenes/lobby_gui.cpp:404
msgid "Overlay can be toggled by pressing both thumbsticks" msgid "Overlay can be toggled by pressing both thumbsticks"
msgstr "L'affichage peut être basculé en appuyant sur les deux joysticks" msgstr "L'affichage peut être basculé en appuyant sur les deux joysticks"
#: client/scenes/lobby_gui.cpp:456 client/scenes/lobby_gui.cpp:464 #: client/scenes/lobby_gui.cpp:434 client/scenes/lobby_gui.cpp:442
#: client/scenes/stream_stats.cpp:141 #: client/scenes/stream_stats.cpp:143
msgid "CPU time" msgid "CPU time"
msgstr "Temps CPU" msgstr "Temps CPU"
#: client/scenes/lobby_gui.cpp:460 #: client/scenes/lobby_gui.cpp:438
msgid "CPU time [ms]" msgid "CPU time [ms]"
msgstr "Temps CPU [ms]" msgstr "Temps CPU [ms]"
#: client/scenes/lobby_gui.cpp:470 client/scenes/lobby_gui.cpp:478 #: client/scenes/lobby_gui.cpp:448 client/scenes/lobby_gui.cpp:456
#: client/scenes/stream_stats.cpp:143 #: client/scenes/stream_stats.cpp:145
msgid "GPU time" msgid "GPU time"
msgstr "Temps GPU" msgstr "Temps GPU"
#: client/scenes/lobby_gui.cpp:474 #: client/scenes/lobby_gui.cpp:452
msgid "GPU time [ms]" msgid "GPU time [ms]"
msgstr "Temps GPU [ms]" msgstr "Temps GPU [ms]"
#: client/scenes/lobby_gui.cpp:502 client/scenes/lobby_gui.cpp:700 #: client/scenes/lobby_gui.cpp:480 client/scenes/lobby_gui.cpp:702
msgid "Licenses" msgid "Licenses"
msgstr "Licences" msgstr "Licences"
#: client/scenes/lobby_gui.cpp:690 #: client/scenes/lobby_gui.cpp:692
msgid "Server list" msgid "Server list"
msgstr "Serveurs" msgstr "Serveurs"
#: client/scenes/lobby_gui.cpp:693 #: client/scenes/lobby_gui.cpp:695
msgid "Settings" msgid "Settings"
msgstr "Paramètres" msgstr "Paramètres"
#: client/scenes/lobby_gui.cpp:697 #: client/scenes/lobby_gui.cpp:699
msgid "About" msgid "About"
msgstr "À propos" msgstr "À propos"
#: client/scenes/lobby_gui.cpp:703 #: client/scenes/lobby_gui.cpp:705
msgid "Exit" msgid "Exit"
msgstr "Quitter" msgstr "Quitter"
#: client/scenes/stream_stats.cpp:143 #: client/scenes/stream_stats.cpp:145
msgid "Reproject" msgid "Reproject"
msgstr "Reprojection" msgstr "Reprojection"
#: client/scenes/stream_stats.cpp:144 #: client/scenes/stream_stats.cpp:146
msgid "Blit" msgid "Blit"
msgstr "Copie" msgstr "Copie"
#: client/scenes/stream_stats.cpp:146 #: client/scenes/stream_stats.cpp:148
msgid "Download" msgid "Download"
msgstr "Téléchargement" msgstr "Téléchargement"
#: client/scenes/stream_stats.cpp:147 #: client/scenes/stream_stats.cpp:149
msgid "Upload" msgid "Upload"
msgstr "Téléversement" msgstr "Téléversement"
#: client/scenes/stream_stats.cpp:216 #: client/scenes/stream_stats.cpp:218
#, c++-format #, c++-format
msgid "Decoder {}" msgid "Decoder {}"
msgstr "Décodeur {}" msgstr "Décodeur {}"
#: client/scenes/stream_stats.cpp:228 #: client/scenes/stream_stats.cpp:230
msgid "Timings [ms]" msgid "Timings [ms]"
msgstr "Durées [ms]" msgstr "Durées [ms]"
#: client/scenes/stream_stats.cpp:273 #: client/scenes/stream_stats.cpp:285
msgid "Encode"
msgstr "Encodage"
#: client/scenes/stream_stats.cpp:286
msgid "Send" msgid "Send"
msgstr "Envoi" msgstr "Envoi"
#: client/scenes/stream_stats.cpp:274 #: client/scenes/stream_stats.cpp:287
msgid "Receive" msgid "Receive"
msgstr "Réception" msgstr "Réception"
#: client/scenes/stream_stats.cpp:275 #: client/scenes/stream_stats.cpp:288
msgid "Decode" msgid "Decode"
msgstr "Décodage" msgstr "Décodage"
#: client/scenes/stream_stats.cpp:276 #: client/scenes/stream_stats.cpp:289
msgid "Blitted" msgid "Blitted"
msgstr "Copie" msgstr "Copie"
#: client/scenes/stream_stats.cpp:277 #: client/scenes/stream_stats.cpp:290
msgid "Displayed" msgid "Displayed"
msgstr "Affichage" msgstr "Affichage"
#: client/scenes/stream_stats.cpp:293 #: client/scenes/stream_stats.cpp:306
#, c++-format #, c++-format
msgid "Estimated motion to photons latency: {}ms" msgid "Estimated motion to photons latency: {}ms"
msgstr "Latence mouvement à photons estimée: {}ms" msgstr "Latence mouvement à photons estimée: {}ms"
+2
View File
@@ -206,6 +206,8 @@ private:
struct decoder_metric struct decoder_metric
{ {
// All times are in seconds relative to encode_begin // All times are in seconds relative to encode_begin
float encode_begin;
float encode_end;
float send_begin; float send_begin;
float send_end; float send_end;
float received_first_packet; float received_first_packet;
+13
View File
@@ -110,6 +110,8 @@ void scenes::stream::accumulate_metrics(XrTime predicted_display_time, const std
metrics[metrics_offset] = decoder_metric{ metrics[metrics_offset] = decoder_metric{
// clang-format off // clang-format off
.encode_begin = (bh->timing_info.encode_begin - min_encode_begin) * 1e-9f,
.encode_end = (bh->timing_info.encode_end - min_encode_begin) * 1e-9f,
.send_begin = (bh->timing_info.send_begin - min_encode_begin) * 1e-9f, .send_begin = (bh->timing_info.send_begin - min_encode_begin) * 1e-9f,
.send_end = (bh->timing_info.send_end - min_encode_begin) * 1e-9f, .send_end = (bh->timing_info.send_end - min_encode_begin) * 1e-9f,
.received_first_packet = (bh->feedback.received_first_packet - min_encode_begin) * 1e-9f, .received_first_packet = (bh->feedback.received_first_packet - min_encode_begin) * 1e-9f,
@@ -229,6 +231,16 @@ XrCompositionLayerQuad scenes::stream::plot_performance_metrics(XrTime predicted
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0); ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
ImPlot::SetupAxesLimits(0, metrics.size() - 1, min_v * 1e3f, axis_scale[n] * 1e3f, ImGuiCond_Always); ImPlot::SetupAxesLimits(0, metrics.size() - 1, min_v * 1e3f, axis_scale[n] * 1e3f, ImGuiCond_Always);
getter_data getter_encode_begin{
.data = (uintptr_t) & (metrics.data()->encode_begin),
.stride = sizeof(decoder_metric),
.multiplier = 1e3f};
getter_data getter_encode_end{
.data = (uintptr_t) & (metrics.data()->encode_end),
.stride = sizeof(decoder_metric),
.multiplier = 1e3f};
getter_data getter_send_begin{ getter_data getter_send_begin{
.data = (uintptr_t) & (metrics.data()->send_begin), .data = (uintptr_t) & (metrics.data()->send_begin),
.stride = sizeof(decoder_metric), .stride = sizeof(decoder_metric),
@@ -270,6 +282,7 @@ XrCompositionLayerQuad scenes::stream::plot_performance_metrics(XrTime predicted
.multiplier = 1e3f}; .multiplier = 1e3f};
// clang-format off // clang-format off
ImPlot::PlotShadedG(_S("Encode"), getter, &getter_encode_begin, getter, &getter_encode_end, metrics.size());
ImPlot::PlotShadedG(_S("Send"), getter, &getter_send_begin, getter, &getter_send_end, metrics.size()); ImPlot::PlotShadedG(_S("Send"), getter, &getter_send_begin, getter, &getter_send_end, metrics.size());
ImPlot::PlotShadedG(_S("Receive"), getter, &getter_received_first_packet, getter, &getter_received_last_packet, metrics.size()); ImPlot::PlotShadedG(_S("Receive"), getter, &getter_received_first_packet, getter, &getter_received_last_packet, metrics.size());
ImPlot::PlotShadedG(_S("Decode"), getter, &getter_sent_to_decoder, getter, &getter_received_from_decoder, metrics.size()); ImPlot::PlotShadedG(_S("Decode"), getter, &getter_sent_to_decoder, getter, &getter_received_from_decoder, metrics.size());
+1
View File
@@ -327,6 +327,7 @@ public:
struct timing_info_t struct timing_info_t
{ {
XrTime encode_begin; XrTime encode_begin;
XrTime encode_end;
XrTime send_begin; XrTime send_begin;
XrTime send_end; XrTime send_end;
}; };
+9 -2
View File
@@ -187,7 +187,9 @@ void VideoEncoder::Encode(wivrn_session & cnx,
const char * extra = idr ? ",idr" : ",p"; const char * extra = idr ? ",idr" : ",p";
clock = cnx.get_offset(); clock = cnx.get_offset();
timing_info.encode_begin = clock.to_headset(os_monotonic_get_ns()); timing_info = {
.encode_begin = clock.to_headset(os_monotonic_get_ns()),
};
cnx.dump_time("encode_begin", frame_index, os_monotonic_get_ns(), stream_idx, extra); cnx.dump_time("encode_begin", frame_index, os_monotonic_get_ns(), stream_idx, extra);
// Prepare the video shard template // Prepare the video shard template
@@ -198,19 +200,24 @@ void VideoEncoder::Encode(wivrn_session & cnx,
shard.timing_info.reset(); shard.timing_info.reset();
auto data = encode(idr, target_timestamp); auto data = encode(idr, target_timestamp);
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx, extra);
if (data) if (data)
{ {
timing_info.encode_end = clock.to_headset(os_monotonic_get_ns());
assert(shared_sender); assert(shared_sender);
shared_sender->push(std::move(*data)); shared_sender->push(std::move(*data));
} }
cnx.dump_time("encode_end", frame_index, os_monotonic_get_ns(), stream_idx, extra);
} }
void VideoEncoder::SendData(std::span<uint8_t> data, bool end_of_frame) void VideoEncoder::SendData(std::span<uint8_t> data, bool end_of_frame)
{ {
std::lock_guard lock(mutex); std::lock_guard lock(mutex);
if (end_of_frame) if (end_of_frame)
{
timing_info.send_end = clock.to_headset(os_monotonic_get_ns()); timing_info.send_end = clock.to_headset(os_monotonic_get_ns());
if (not timing_info.encode_end)
timing_info.encode_end = timing_info.send_end;
}
if (video_dump) if (video_dump)
video_dump.write((char *)data.data(), data.size()); video_dump.write((char *)data.data(), data.size());
if (shard.shard_idx == 0) if (shard.shard_idx == 0)