mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
clusterizer show server information in imgui. server can dispatch waiting jobs and some fixes
This commit is contained in:
58
srcs/class/Clusterizer/imgui.cpp
Normal file
58
srcs/class/Clusterizer/imgui.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* imgui.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/22 19:52:51 by tomoron #+# #+# */
|
||||
/* Updated: 2025/02/22 23:39:46 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "RT.hpp"
|
||||
|
||||
void Clusterizer::imguiJobStat(void)
|
||||
{
|
||||
ImGui::Text("jobs : ");
|
||||
ImGui::Text(" waiting : %lu", _jobs[WAITING].size());
|
||||
ImGui::Text(" in progress : %lu", _jobs[IN_PROGRESS].size());
|
||||
ImGui::Text(" done : %lu", _jobs[DONE].size());
|
||||
}
|
||||
|
||||
void Clusterizer::imguiClients(void)
|
||||
{
|
||||
std::string status;
|
||||
|
||||
ImGui::Text("clients : ");
|
||||
ImGui::BeginChild("clientList", ImVec2(0, 0), true, 0);
|
||||
for(auto it = _clients.begin();it != _clients.end(); it++)
|
||||
{
|
||||
if(!it->second.ready)
|
||||
status = "not ready";
|
||||
else if(it->second.ready && it->second.curJob)
|
||||
status = "working";
|
||||
else if(it->second.ready)
|
||||
status = "idle";
|
||||
|
||||
ImGui::Text("status : %s", status.c_str());
|
||||
if(it->second.curJob)
|
||||
ImGui::ProgressBar((float)it->second.progress / 100);
|
||||
if(std::next(it) != _clients.end())
|
||||
ImGui::Separator();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
void Clusterizer::imguiRender(void)
|
||||
{
|
||||
if(!_isServer)
|
||||
return ;
|
||||
|
||||
if (ImGui::CollapsingHeader("Clusterizer"))
|
||||
{
|
||||
imguiJobStat();
|
||||
ImGui::Separator();
|
||||
imguiClients();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user