bool UpdateEstats()

in ctsPerf/ctsEstats.h [963:1051]


        bool UpdateEstats() noexcept try
        {
            auto accessDenied = false;
            ++m_tableCounter;
            try
            {
                // IPv4
                RefreshIPv4Data();
                auto* const pIpv4TcpTable = reinterpret_cast<PMIB_TCPTABLE>(&m_tcpTable[0]);
                for (auto count = 0ul; count < pIpv4TcpTable->dwNumEntries; ++count)
                {
                    auto* const tableEntry = &pIpv4TcpTable->table[count];
                    if (tableEntry->dwState == MIB_TCP_STATE_LISTEN ||
                        tableEntry->dwState == MIB_TCP_STATE_TIME_WAIT ||
                        tableEntry->dwState == MIB_TCP_STATE_DELETE_TCB)
                    {
                        continue;
                    }

                    try
                    {
                        UpdateDataPoints(m_synOptsData, tableEntry);
                        UpdateDataPoints(m_byteTrackingData, tableEntry);
                        UpdateDataPoints(m_pathInfoData, tableEntry);
                        UpdateDataPoints(m_localReceiveWindowData, tableEntry);
                        UpdateDataPoints(m_remoteReceiveWindowData, tableEntry);
                        UpdateDataPoints(m_senderCongestionData, tableEntry);
                    }
                    catch (...)
                    {
                        if (HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) == wil::ResultFromCaughtException())
                        {
                            accessDenied = true;
                            throw;
                        }
                    }
                }

                // IPv6
                RefreshIPv6Data();
                auto* const pIpv6TcpTable = reinterpret_cast<PMIB_TCP6TABLE>(&m_tcpTable[0]);
                for (auto count = 0ul; count < pIpv6TcpTable->dwNumEntries; ++count)
                {
                    auto* const tableEntry = &pIpv6TcpTable->table[count];
                    if (tableEntry->State == MIB_TCP_STATE_LISTEN ||
                        tableEntry->State == MIB_TCP_STATE_TIME_WAIT ||
                        tableEntry->State == MIB_TCP_STATE_DELETE_TCB)
                    {
                        continue;
                    }

                    try
                    {
                        UpdateDataPoints(m_synOptsData, tableEntry);
                        UpdateDataPoints(m_byteTrackingData, tableEntry);
                        UpdateDataPoints(m_pathInfoData, tableEntry);
                        UpdateDataPoints(m_localReceiveWindowData, tableEntry);
                        UpdateDataPoints(m_remoteReceiveWindowData, tableEntry);
                        UpdateDataPoints(m_senderCongestionData, tableEntry);
                    }
                    catch (...)
                    {
                        if (HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) == wil::ResultFromCaughtException())
                        {
                            accessDenied = true;
                            throw;
                        }
                    }
                }

                RemoveStaleDataPoints();
            }
            catch (const wil::ResultException& e)
            {
                wprintf(L"ctsEstats::UpdateEstats exception: %hs\n", e.what());
            }
            catch (const std::exception& e)
            {
                wprintf(L"ctsEstats::UpdateEstats exception: %hs\n", e.what());
            }

            if (!accessDenied)
            {
                // schedule timer from this moment
                ScheduleTimer();
            }

            return !accessDenied;
        }