VirtualBox

Changeset 20454 in vbox


Ignore:
Timestamp:
Jun 10, 2009 3:59:34 AM (15 years ago)
Author:
vboxsync
Message:

NAT: several counters in DrvNAT +interface for unify NAT counter's managment

Location:
trunk/src/VBox/Devices/Network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r20387 r20454  
    5454 */
    5555#define VBOX_NAT_DELAY_HACK
    56 
    57 
     56#ifdef VBOX_WITH_STATISTICS
     57# define COUNTING_COUTER(name, dsc) \
     58extern "C" void slirp_counting_counter_##name##_reset(PNATState pData); \
     59extern "C" void slirp_counting_counter_##name##_inc(PNATState pData); \
     60extern "C" void slirp_counting_counter_##name##_add(PNATState pData, int val);
     61/* @todo think abaout it */
     62# define PROFILE_COUNTER(name, dsc)
     63# include "Network/slirp/counters.h"
     64# undef COUNTING_COUTER
     65# undef PROFILE_COUNTER
     66# define DRVNAT_COUNTER_RESET(pData, name) \
     67    slirp_counting_counter_##name##_reset(pData)
     68# define DRVNAT_COUNTER_INC(pData, name) \
     69    slirp_counting_counter_##name##_inc(pData)
     70# define DRVNAT_COUNTER_ADD(pData, name, val) \
     71    slirp_counting_counter_##name##_add(pData, (val))
     72#else
     73#define DRVNAT_COUNTER_RESET(name) do{}while(0)
     74#define DRVNAT_COUNTER_INC(name) do{}while(0)
     75#define DRVNAT_COUNTER_ADD(name) do{}while(0)
     76#endif
    5877/*******************************************************************************
    5978*   Structures and Typedefs                                                    *
     
    475494    Log2(("slirp_output: pu8Buf=%p cb=%#x (pThis=%p)\n%.*Rhxd\n", pu8Buf, cb, pThis, cb, pu8Buf));
    476495
     496    DRVNAT_COUNTER_RESET(pThis->pNATState, DrvNAT_package_drop);
     497    DRVNAT_COUNTER_RESET(pThis->pNATState, DrvNAT_package_sent);
    477498    Assert(pThis);
    478499
     
    485506        Log2(("pItem:%p %.Rhxd\n", pItem, pItem->pu8Buf));
    486507        PDMQueueInsert(pThis->pSendQueue, &pItem->Core);
     508        DRVNAT_COUNTER_INC(pThis->pNATState, DrvNAT_package_sent);
    487509        return;
    488510    }
     
    497519        cDroppedPackets = 0;
    498520    }
     521    DRVNAT_COUNTER_INC(pThis->pNATState, DrvNAT_package_drop);
    499522    RTMemFree((void *)pu8Buf);
    500523}
  • trunk/src/VBox/Devices/Network/slirp/counters.h

    r20453 r20454  
    6969PROFILE_COUNTER(TCP_reassamble, "TCP::reasamble");
    7070PROFILE_COUNTER(TCP_input, "TCP::input");
     71
     72COUNTING_COUTER(DrvNAT_package_sent, "counting package sent via PDM queue");
     73COUNTING_COUTER(DrvNAT_package_drop, "counting package drops by PDM queue");
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r20424 r20454  
    18881888    tcp_sndspace = kilobytes * _1K;
    18891889}
     1890
     1891
     1892#define COUNTING_COUTER(name, dsc) \
     1893void slirp_counting_counter_##name##_reset(PNATState pData) \
     1894{                                                           \
     1895    SLIRP_COUNTER_RESET(name);                              \
     1896}                                                           \
     1897void slirp_counting_counter_##name##_inc(PNATState pData)   \
     1898{                                                           \
     1899    SLIRP_COUNTER_INC(name);                                \
     1900}                                                           \
     1901void slirp_counting_counter_##name##_add(PNATState pData,int val)   \
     1902{                                                           \
     1903    SLIRP_COUNTER_ADD(name, val);                           \
     1904}
     1905/* @todo think abaout it */
     1906#define PROFILE_COUNTER(name, dsc)
     1907#include "counters.h"
     1908#undef COUNTING_COUTER
     1909#undef PROFILE_COUNTER
     1910
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette