VBoxDispProfile.h revision b9e12f78cf07f58665c0e0b2b0abba1ce7f02a5d
/* $Id$ */
/** @file
* VBoxVideo Display D3D User mode dll
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBoxDispProfile_h__
#define ___VBoxDispProfile_h__
#include "VBoxDispD3DCmn.h"
#define VBOXDISPPROFILE_MAX_SETSIZE 512
#define VBOXDISPPROFILE_GET_TIME_NANO() RTTimeNanoTS()
#define VBOXDISPPROFILE_GET_TIME_MILLI() RTTimeMilliTS()
#define VBOXDISPPROFILE_DUMP(_m) do {\
LOGREL_EXACT(_m); \
} while (0)
{
m_cCalls(0),
m_cTime(0),
{}
VBoxDispProfileEntry(const char *pName) :
m_cCalls(0),
m_cTime(0),
{}
{
++m_cCalls;
}
void reset()
{
m_cCalls = 0;
m_cTime = 0;
}
{
return m_cTime;
}
uint32_t getNumCalls() const
{
return m_cCalls;
}
const char* getName() const
{
return m_pName;
}
{
// VBOXDISPPROFILE_DUMP((pDevice, "Entry '%s': calls(%d), time: nanos(%I64u), micros(%I64u), millis(%I64u)\n",
// m_pName, m_cCalls,
// m_cTime, m_cTime/1000, m_cTime/1000000));
}
const char * m_pName;
};
{
VBoxDispProfileSet(const char *pName) :
m_cEntries(0),
m_cIterations(0),
{
}
m_cEntries(0),
m_cIterations(0),
m_pName("global")
{
}
{
{
++m_cEntries;
return entry;
}
return NULL;
}
{
{
return entry;
++m_cEntries;
return entry;
}
return NULL;
}
{
return ++m_cIterations;
}
uint32_t getNumIterations() const
{
return m_cIterations;
}
uint32_t getNumEntries() const
{
return m_cEntries;
}
#define VBOXDISPPROFILESET_FOREACHENTRY(_op) \
{ \
_op \
} \
++e; \
} \
} \
void resetEntries()
{
}
void reset()
{
m_cEntries = 0;
}
{
uint64_t cEntriesTime = 0;
VBOXDISPPROFILE_DUMP((">>>> '%s' [0x%p]: Start of VBox Disp Dump: num entries(%d), et(%u), tt(%u) >>>>>", m_pName, pvObj, m_cEntries,
VBOXDISPPROFILE_DUMP(("Name\tCalls\tNanos\tMicros\tMillis\tentries_quota\ttotal_quota"));
if (m_Entries[i].getNumCalls())
}
const char * m_pName;
};
{
{
}
{
if (!m_bDisable)
{
logStep();
}
}
void disable()
{
m_bDisable = TRUE;
}
void logAndDisable()
{
logStep();
disable();
}
void logStep()
{
}
T *m_pEntry;
};
{
{
}
{
}
{
term();
}
void term()
{
if (m_Data.mpaPeriods)
{
}
{
}
{
}
}
/* to be called in case fps counter was created with default constructor */
{
if (cPeriods)
{
}
}
void ReportFrame()
{
{
}
m_Data.mCurTimeUsed = 0;
}
{
}
{
}
double GetFps()
{
return ((double)1000000000.0) / GetEveragePeriod();
}
double GetCps()
{
}
double GetTimeProcPercent()
{
}
{
}
struct
{
} m_Data;
};
#define VBOXDISPPROFILE_FUNCTION_LOGGER_DISABLE_CURRENT() do { \
} while (0)
#define VBOXDISPPROFILE_FUNCTION_LOGGER_LOG_AND_DISABLE_CURRENT() do { \
} while (0)
# define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p) \
VBoxDispProfileScopeLogger<VBoxDispProfileEntry> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry);
#else
# error "VBOXDISPPROFILE_FUNCTION_LOGGER_INDEX_GEN should be fedined!"
# endif
# define VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p) \
VBoxDispProfileScopeLogger<VBoxDispProfileEntry> __vboxDispProfileFunctionLogger(__pVBoxDispProfileEntry);
#endif
#define VBOXDISPPROFILE_STATISTIC_LOGGER_DISABLE_CURRENT() do { \
} while (0)
#define VBOXDISPPROFILE_STATISTIC_LOGGER_LOG_AND_DISABLE_CURRENT() do { \
} while (0)
#define VBOXDISPPROFILE_STATISTIC_LOGGER_DEFINE(_p) \
//#define VBOXDISPPROFILE_FUNCTION_PROLOGUE(_p) \
// VBOXDISPPROFILE_FUNCTION_LOGGER_DEFINE(_p)
#endif /* #ifndef ___VBoxDispProfile_h__ */