Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# oscl_socket_stats.h

Go to the documentation of this file.

    00001
    00002
    00003 #ifndef OSCL_SOCKET_STATS_H_INCLUDED
    00004 #define OSCL_SOCKET_STATS_H_INCLUDED
    00005
    00009 #include "oscl_base.h"
    00010 #include "oscl_vector.h"
    00011 #include "oscl_mem.h"
    00012 #include "oscl_mutex.h"
    00013
    00014 enum TOsclSocketStatEvent
    00015 {
    00016     //Request/Method AO events
    00017     EOsclSocket_RequestAO_Success
    00018     , EOsclSocket_RequestAO_Canceled
    00019     , EOsclSocket_RequestAO_Error
    00020     , EOsclSocket_RequestAO_Timeout
    00021     //Server events
    00022     , EOsclSocket_ServRequestIssued
    00023     , EOsclSocket_ServPoll
    00024     , EOsclSocket_OS
    00025     , EOsclSocket_Readable
    00026     , EOsclSocket_Writable
    00027     , EOsclSocket_Except
    00028     , EOsclSocket_DataRecv
    00029     , EOsclSocket_DataSent
    00030     , EOsclSocket_ServRequestComplete
    00031     , EOsclSocket_ServRequestCancelIssued
    00032     //loop socket events
    00033     , EOsclSocketServ_LoopsockOk
    00034     , EOsclSocketServ_LoopsockError
    00035 };
    00036 static const char* const TPVSocketStatStr[] =
    00037 {
    00038     //Request/Method AO events
    00039     "AO_Success"
    00040     , "AO_Canceled"
    00041     , "AO_Error"
    00042     , "AO_Timeout"
    00043     //Server events
    00044     , "Serv_ReqIssued"
    00045     , "Serv_Poll"
    00046     , "Serv_OS_Op"
    00047     , "Serv_Readable"
    00048     , "Serv_Writeable"
    00049     , "Serv_Except!"
    00050     , "Serv_DataRecv'd"
    00051     , "Serv_DataSent"
    00052     , "Serv_ReqComplete"
    00053     , "Serv_ReqCancel"
    00054     //loop socket events
    00055     , "Loopsock_OK"
    00056     , "Loopsock_Err"
    00057 } ;
    00058
    00059 enum TOsclSocketServStatEvent
    00060 {
    00061     //select loop events
    00062     EOsclSocketServ_SelectNoActivity = 0
    00063     , EOsclSocketServ_SelectActivity
    00064     , EOsclSocketServ_SelectRescheduleAsap
    00065     , EOsclSocketServ_SelectReschedulePoll
    00066     , EOsclSocketServ_LastEvent
    00067 };
    00068 static const char* const TPVSocketServStatStr[] =
    00069 {
    00070     "Select_No"
    00071     , "Select_Yes"
    00072     , "Select_Resched_Asap"
    00073     , "Select_Resched_Poll"
    00074 } ;
    00075
    00076 #include "oscl_socket_tuneables.h"
    00077 #if(PV_OSCL_SOCKET_STATS_LOGGING)
    00078
    00079 class PVLogger;
    00080 class OsclSocketStatEventEntry
    00081 {
    00082     public:
    00083         OsclSocketStatEventEntry(TOsclSocketStatEvent aEvent, uint32 aTime, int32 aParam)
    00084                 : iEvent(aEvent)
    00085                 , iTicks(aTime)
    00086                 , iParam(aParam)
    00087         {}
    00088         TOsclSocketStatEvent iEvent;
    00089         uint32 iTicks;
    00090         int32 iParam;
    00091 };
    00092
    00093 #include "oscl_socket_types.h"
    00094
    00095 #define OsclSocketStats_NUM_ACTIVE_REQUESTS EPVSocket_Last
    00096
    00097 //Define the maximum number of polling events that will be logged.
    00098 //Additional poll events will be counted but not logged individually.
    00099 #define OsclSocketStats_MAX_POLL_EVENTS 100
    00100
    00101 class OsclSocketStats
    00102 {
    00103     public:
    00104         OsclSocketStats();
    00105         ~OsclSocketStats();
    00106         void ShowTuneables();
    00107         void Add(TPVSocketFxn, TOsclSocketStatEvent, int32 aParam = (-1));
    00108         void Log(TPVSocketFxn);
    00109         void Log();
    00110         void Clear(TPVSocketFxn);
    00111         void Construct(OsclAny* aContainer, OsclAny*aServ);
    00112         void LogAndDump();
    00113     private:
    00114         Oscl_Vector<OsclSocketStatEventEntry, OsclMemAllocator> iEvents[OsclSocketStats_NUM_ACTIVE_REQUESTS];
    00115         Oscl_Vector<OsclSocketStatEventEntry, OsclMemAllocator> iPollEvents[OsclSocketStats_NUM_ACTIVE_REQUESTS];
    00116         int32 iExcessPollEvents[OsclSocketStats_NUM_ACTIVE_REQUESTS];
    00117         int32 iLastCompletionTime[OsclSocketStats_NUM_ACTIVE_REQUESTS];
    00118         OsclThreadLock iLock;
    00119         char* iLogStr;
    00120         PVLogger* iLogger;
    00121         OsclAny* iSock;
    00122         OsclAny* iServ;
    00123 };
    00124
    00125 class OsclSocketServStats
    00126 {
    00127     public:
    00128         OsclSocketServStats();
    00129         ~OsclSocketServStats();
    00130         void Add(TOsclSocketServStatEvent);
    00131         void Construct(OsclAny*aServ);
    00132         void LogAndDump();
    00133     private:
    00134         void Log(TOsclSocketServStatEvent);
    00135         void Clear();
    00136         void ShowTuneables();
    00137         uint32 iEvents[EOsclSocketServ_LastEvent];
    00138         PVLogger* iLogger;
    00139         OsclAny* iServ;
    00140 };
    00141
    00142 #endif
    00143 #endif
    00144
    00145
    00146