tomato/src/tox_netprof_ui.hpp
Green Sky db0dffafd9
Some checks are pending
ContinuousDelivery / linux-ubuntu (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousDelivery / windows (push) Waiting to run
ContinuousDelivery / windows-asan (push) Waiting to run
ContinuousDelivery / release (push) Blocked by required conditions
ContinuousIntegration / linux (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android]) (push) Waiting to run
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android]) (push) Waiting to run
ContinuousIntegration / macos (push) Waiting to run
ContinuousIntegration / windows (push) Waiting to run
add implot and start using it
2025-01-22 19:03:10 +01:00

54 lines
1.3 KiB
C++

#pragma once
#include "./tox_private_impl.hpp"
#include <cstdint>
#include <vector>
#include <map>
class ToxNetprofUI {
ToxPrivateImpl& _tpi;
bool _enabled {true};
bool _show_window_table {false};
bool _show_window_histo {false};
// table delta
std::map<uint8_t, uint64_t> _udp_ctx_prev;
std::map<uint8_t, uint64_t> _udp_crx_prev;
std::map<uint8_t, uint64_t> _udp_btx_prev;
std::map<uint8_t, uint64_t> _udp_brx_prev;
std::map<uint8_t, uint64_t> _tcp_ctx_prev;
std::map<uint8_t, uint64_t> _tcp_crx_prev;
std::map<uint8_t, uint64_t> _tcp_btx_prev;
std::map<uint8_t, uint64_t> _tcp_brx_prev;
// table heat
std::map<uint8_t, float> _udp_ctx_heat;
std::map<uint8_t, float> _udp_crx_heat;
std::map<uint8_t, float> _udp_btx_heat;
std::map<uint8_t, float> _udp_brx_heat;
std::map<uint8_t, float> _tcp_ctx_heat;
std::map<uint8_t, float> _tcp_crx_heat;
std::map<uint8_t, float> _tcp_btx_heat;
std::map<uint8_t, float> _tcp_brx_heat;
// histogram totals
uint64_t _udp_tbtx_prev;
uint64_t _udp_tbrx_prev;
std::vector<float> _udp_tbtx;
std::vector<float> _udp_tbrx;
float _udp_tbtx_avg {0.f};
float _udp_tbrx_avg {0.f};
const float _value_add_interval {1.f}; // every second
float _time_since_last_add {0.f};
public:
ToxNetprofUI(ToxPrivateImpl& tpi) : _tpi(tpi) {}
void tick(float time_delta);
float render(float time_delta);
};