Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add infrastructure to monitor the VT IOP loading progress #533

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

martonmiklos
Copy link
Contributor

Describe your changes

Added counters to being able to monitor the VT IOP download progress (which is usually done in several smaller chunks)

How has this been tested?

Built AgIsoVT with this version of stack and tested the IOP load indicators.

@martonmiklos martonmiklos force-pushed the add_iop_load_indication branch 2 times, most recently from a16446a to 4af0534 Compare January 11, 2025 23:20
@martonmiklos martonmiklos force-pushed the add_iop_load_indication branch from 4af0534 to 0a6d623 Compare January 11, 2025 23:39
Copy link
Member

@GwnDaan GwnDaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice that you are working on this feature! It has a lot of added value in the VT

My 2 cents are as followed: I think you have everything to determine the things you are looking for. Adding extra class variables might be a bit overkill and perhaps a bit more risky. I've attached two suggestions for the functions how they can be without using the other added variables. I'm curious to hear what you think

Comment on lines +138 to +162
float VirtualTerminalServerManagedWorkingSet::iop_load_percentage() const
{
if (iopSize == 0)
{
return 0.0f;
}

auto totalTransferredSize = transferredIopSize;
if (totalTransferredSize < iopSize)
{
// if IOP transfer is not completed check if there is an ongoing IOP transfer to us
auto sessions = CANNetworkManager::CANNetwork.get_active_transport_protocol_sessions(0);
for (const auto &session : sessions)
{
if (session->get_source()->get_address() == get_control_function()->get_address() &&
(static_cast<std::uint32_t>(CANLibParameterGroupNumber::ECUtoVirtualTerminal) == session->get_parameter_group_number()))
{
totalTransferredSize += session->get_total_bytes_transferred();
break;
}
}
}

return (totalTransferredSize / static_cast<float>(iopSize)) * 100.0f;
}
Copy link
Member

@GwnDaan GwnDaan Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float VirtualTerminalServerManagedWorkingSet::iop_load_percentage() const
{
if (iopSize == 0)
{
return 0.0f;
}
auto totalTransferredSize = transferredIopSize;
if (totalTransferredSize < iopSize)
{
// if IOP transfer is not completed check if there is an ongoing IOP transfer to us
auto sessions = CANNetworkManager::CANNetwork.get_active_transport_protocol_sessions(0);
for (const auto &session : sessions)
{
if (session->get_source()->get_address() == get_control_function()->get_address() &&
(static_cast<std::uint32_t>(CANLibParameterGroupNumber::ECUtoVirtualTerminal) == session->get_parameter_group_number()))
{
totalTransferredSize += session->get_total_bytes_transferred();
break;
}
}
}
return (totalTransferredSize / static_cast<float>(iopSize)) * 100.0f;
}
float VirtualTerminalServerManagedWorkingSet::iop_load_percentage() const
{
if (processingState != ObjectPoolProcessingThreadState::None)
{
return 100.0f;
}
// if IOP transfer is not completed check if there is an ongoing IOP transfer to us
auto sessions = CANNetworkManager::CANNetwork.get_active_transport_protocol_sessions(0);
for (const auto &session : sessions)
{
if (session->get_source()->get_address() == get_control_function()->get_address() &&
(static_cast<std::uint32_t>(CANLibParameterGroupNumber::ECUtoVirtualTerminal) == session->get_parameter_group_number()) &&
(session->get_total_bytes_transferred() >= 1) &&
(session->get_data().get_byte(0) == static_cast<std::uint8_t>(VirtualTerminalBase::Function::ObjectPoolTransferMessage)))
{
return session->get_percentage_bytes_transferred();
}
}
return 0.0f;
}

Comment on lines +211 to +214
bool VirtualTerminalServerManagedWorkingSet::is_object_pool_transfer_in_progress() const
{
return objectPoolTransferInProgress;
}
Copy link
Member

@GwnDaan GwnDaan Jan 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool VirtualTerminalServerManagedWorkingSet::is_object_pool_transfer_in_progress() const
{
return objectPoolTransferInProgress;
}
bool VirtualTerminalServerManagedWorkingSet::is_object_pool_transfer_in_progress() const
{
return iop_load_percentage() != 0.0f;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants