本文整理汇总了C++中PROFILE_START函数的典型用法代码示例。如果您正苦于以下问题:C++ PROFILE_START函数的具体用法?C++ PROFILE_START怎么用?C++ PROFILE_START使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROFILE_START函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PROFILE_START
//-----------------------------------------------------------------------------
bool Platform::dumpDirectories(const char *path, Vector<StringTableEntry> &directoryVector, S32 depth, bool noBasePath)
{
if (isCachePath(path))
{
PROFILE_START(dumpDirectories);
ResourceManager->initExcludedDirectories();
const S32 len = dStrlen(path)+1;
char newpath[len];
dSprintf(newpath, len, "%s", path);
if(newpath[len - 1] == '/')
newpath[len - 1] = '\0'; // cut off the trailing slash, if there is one
// Insert base path to follow what Windows does.
if ( !noBasePath )
directoryVector.push_back(StringTable->insert(newpath));
bool ret = recurseDumpDirectoriesCache(newpath, "", directoryVector, depth, noBasePath);
PROFILE_END();
return ret;
}
PROFILE_START(dumpDirectories);
ResourceManager->initExcludedDirectories();
bool ret = android_DumpDirectories(path, "", directoryVector, depth, noBasePath);
PROFILE_END();
return ret;
}
示例2: main
int main (int argc, char **argv)
{
struct sockaddr_in sa;
int rc, i;
if (argc != 2)
{
printf ("Usage: %s num-sockets", argv[0]);
return (0);
}
max_socks = atoi (argv[1]);
if (max_socks == 0)
{
printf ("Usage: %s num-sockets", argv[0]);
return (0);
}
setup();
socks = calloc (max_socks, sizeof(int));
assert (socks != NULL);
for (i = 0; i < max_socks; i++)
{
PROFILE_START ("socket");
socks[i] = socket (AF_INET, SOCK_STREAM, 0);
PROFILE_STOP();
if (socks[i] < 0)
{
perror ("socket");
max_socks = i;
break;
}
}
for (i = 0; i < max_socks; i++)
{
sa.sin_family = AF_INET;
sa.sin_port = htons (test_port);
sa.sin_addr.s_addr = INADDR_ANY;
PROFILE_START ("bind");
rc = bind (socks[i], (struct sockaddr*)&sa, sizeof(sa));
PROFILE_STOP();
if (rc < 0)
{
perror ("bind");
break;
}
}
for (i = 0; i < max_socks; i++)
{
PROFILE_START ("close_s");
close_s (socks[i]);
PROFILE_STOP();
}
free (socks);
return (0);
}
示例3: ENSURE
void TerrainRenderer::RenderTerrainShader(const CShaderDefines& context, ShadowMap* shadow, bool filtered)
{
ENSURE(m->phase == Phase_Render);
std::vector<CPatchRData*>& visiblePatches = filtered ? m->filteredPatches : m->visiblePatches;
std::vector<CDecalRData*>& visibleDecals = filtered ? m->filteredDecals : m->visibleDecals;
if (visiblePatches.empty() && visibleDecals.empty())
return;
// render the solid black sides of the map first
CShaderTechniquePtr techSolid = g_Renderer.GetShaderManager().LoadEffect(str_gui_solid);
techSolid->BeginPass();
CShaderProgramPtr shaderSolid = techSolid->GetShader();
shaderSolid->Uniform(str_transform, g_Renderer.GetViewCamera().GetViewProjection());
shaderSolid->Uniform(str_color, 0.0f, 0.0f, 0.0f, 1.0f);
PROFILE_START("render terrain sides");
for (size_t i = 0; i < visiblePatches.size(); ++i)
visiblePatches[i]->RenderSides(shaderSolid);
PROFILE_END("render terrain sides");
techSolid->EndPass();
PROFILE_START("render terrain base");
CPatchRData::RenderBases(visiblePatches, context, shadow);
PROFILE_END("render terrain base");
// no need to write to the depth buffer a second time
glDepthMask(0);
// render blend passes for each patch
PROFILE_START("render terrain blends");
CPatchRData::RenderBlends(visiblePatches, context, shadow, false);
PROFILE_END("render terrain blends");
PROFILE_START("render terrain decals");
CDecalRData::RenderDecals(visibleDecals, context, shadow, false);
PROFILE_END("render terrain decals");
// restore OpenGL state
g_Renderer.BindTexture(1, 0);
g_Renderer.BindTexture(2, 0);
g_Renderer.BindTexture(3, 0);
glDepthMask(1);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);
}
示例4: GetArraySize
void GroupOfPlanes::SearchMVs(MVGroupOfFrames *pSrcGOF, MVGroupOfFrames *pRefGOF,
SearchType searchType, int nSearchParam, int nPelSearch, int nLambda,
int lsad, int pnew, int plevel, bool global, int flags,
int *out, short *outfilebuf, int fieldShift, DCTClass * _DCT, int pzero, int pglobal, int badSAD, int badrange)
{
int i;
nFlags |= flags;
// write group's size
out[0] = GetArraySize();
// write validity : 1 in that case
out[1] = 1;
out += 2;
int fieldShiftCur = (nLevelCount - 1 == 0) ? fieldShift : 0; // may be non zero for finest level only
VECTOR globalMV; // create and init global motion vector as zero
globalMV.x = zeroMV.x;
globalMV.y = zeroMV.y;
globalMV.sad = zeroMV.sad;
if (!global)
pglobal = pzero;
int meanLumaChange = 0;
// Search the motion vectors, for the low details interpolations first
// Refining the search until we reach the highest detail interpolation.
// DebugPrintf("SearchMV level %i", nLevelCount-1);
planes[nLevelCount - 1]->SearchMVs(pSrcGOF->GetFrame(nLevelCount-1),
pRefGOF->GetFrame(nLevelCount-1),
searchType, nSearchParam, nLambda, lsad, pnew, plevel, flags,
out, &globalMV, outfilebuf, fieldShiftCur, _DCT, &meanLumaChange, divideExtra,
pzero, pglobal, badSAD, badrange);
out += planes[nLevelCount - 1]->GetArraySize(divideExtra);
for ( i = nLevelCount - 2; i >= 0; i-- )
{
int nSearchParamLevel = (i==0) ? nPelSearch : nSearchParam; // special case for finest level
PROFILE_START(MOTION_PROFILE_PREDICTION);
if (global)
{
planes[i+1]->EstimateGlobalMVDoubled(&globalMV); // get updated global MV (doubled)
// DebugPrintf("SearchMV globalMV %i, %i", globalMV.x, globalMV.y);
}
planes[i]->InterpolatePrediction(*(planes[i+1]));
PROFILE_STOP(MOTION_PROFILE_PREDICTION);
fieldShiftCur = (i == 0) ? fieldShift : 0; // may be non zero for finest level only
// DebugPrintf("SearchMV level %i", i);
planes[i]->SearchMVs(pSrcGOF->GetFrame(i), pRefGOF->GetFrame(i),
searchType, nSearchParamLevel, nLambda, lsad, pnew, plevel, flags,
out, &globalMV, outfilebuf, fieldShiftCur, _DCT, &meanLumaChange, divideExtra,
pzero, pglobal, badSAD, badrange);
out += planes[i]->GetArraySize(divideExtra);
}
}
示例5: TestFIA_IOLoadColourArrayData
static void
TestFIA_IOLoadColourArrayData(CuTest* tc)
{
FIBITMAP *dib1 = NULL, *dib2 = NULL;
FREE_IMAGE_TYPE type;
int bpp, err;
const char *file = "C:\\cup.tif";
dib1 = FIA_LoadFIBFromFile(file);
CuAssertTrue(tc, dib1 != NULL);
dib2 = FreeImage_AllocateT (FIT_BITMAP, FreeImage_GetWidth(dib1), FreeImage_GetHeight(dib1), 8, 0, 0, 0);
PROFILE_START("CopyColourBytesToFIBitmap");
for(int i=0; i < 1000; i++) {
//FIA_CopyColourBytesToFIBitmap (dib2, FreeImage_GetBits(dib1), 0, 1, COLOUR_ORDER_RGB);
FIA_CopyColourBytesTo8BitFIBitmap (dib2, FreeImage_GetBits(dib1), 24, FI_RGBA_RED, 0, 1);
}
PROFILE_STOP("CopyColourBytesToFIBitmap");
FIA_SaveFIBToFile (dib2, TEST_DATA_OUTPUT_DIR "/IO/save-colour-test.bmp", BIT8);
FreeImage_Unload(dib1);
FreeImage_Unload(dib2);
}
示例6: PROFILE_START
void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects )
{
// Let the objects batch their stuff.
PROFILE_START( SceneRenderState_prepRenderImages );
for( U32 i = 0; i < numObjects; ++ i )
{
SceneObject* object = objects[ i ];
object->prepRenderImage( this );
}
#ifdef TORQUE_EXPERIMENTAL_EC
U32 interfaceCount = RenderComponentInterface::all.size();
for (U32 i = 0; i < RenderComponentInterface::all.size(); i++)
{
Component* comp = dynamic_cast<Component*>(RenderComponentInterface::all[i]);
if (comp->isClientObject() && comp->isActive())
{
RenderComponentInterface::all[i]->prepRenderImage(this);
}
}
#endif
PROFILE_END();
// Render what the objects have batched.
getRenderPass()->renderPass( this );
}
示例7: PROFILE_START
// This function takes a lot of CPU, so make sure it's not called often! Don't call this function directly, use UpdateEnemy instead whenever possible.
CBaseEntity* AvHTurret::FindBestEnemy()
{
PROFILE_START()
CBaseEntity* theEntityList[100];
int theMaxRange = this->GetXYRange();
Vector delta = Vector(theMaxRange, theMaxRange, theMaxRange);
CBaseEntity* theCurrentEntity = NULL;
CBaseEntity* theBestPlayer = NULL;
CBaseEntity* theBestStructure = NULL;
float theCurrentEntityRange = 100000;
// Find only monsters/clients in box, NOT limited to PVS
int theCount = UTIL_EntitiesInBox(theEntityList, 100, this->pev->origin - delta, this->pev->origin + delta, FL_CLIENT | FL_MONSTER);
for(int i = 0; i < theCount; i++ )
{
theCurrentEntity = theEntityList[i];
if((theCurrentEntity != this) && theCurrentEntity->IsAlive())
{
// the looker will want to consider this entity
// don't check anything else about an entity that can't be seen, or an entity that you don't care about.
if(this->IRelationship(theCurrentEntity ) != R_NO && FInViewCone(theCurrentEntity) && !FBitSet(theCurrentEntity->pev->flags, FL_NOTARGET))
{
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theCurrentEntity);
if(!thePlayer || thePlayer->GetCanBeAffectedByEnemies())
{
if(this->GetIsValidTarget(theCurrentEntity))
{
// Find nearest enemy
float theRangeToTarget = VectorDistance2D(this->pev->origin, theCurrentEntity->pev->origin);
if(theRangeToTarget < theCurrentEntityRange)
{
// FVisible is expensive, so defer until necessary
if(!this->GetRequiresLOS() || FVisible(theCurrentEntity))
{
theCurrentEntityRange = theRangeToTarget;
if ( thePlayer )
{
theBestPlayer = theCurrentEntity;
}
else
{
theBestStructure = theCurrentEntity;
}
}
}
}
}
}
}
}
PROFILE_END(kAvHTurretFindBestEnemy);
return (theBestPlayer != NULL ) ? theBestPlayer : theBestStructure;
}
示例8: mrkthr_loop
/**
* Combined threads and events loop.
*
* The loop processes first threads (_prepare_cb), then events
* (ev_stat_cb, ev_io_cb). It sleeps until the earliest thread resume
* time, or an I/O event occurs.
*
*/
int
mrkthr_loop(void)
{
int res;
PROFILE_START(mrkthr_sched0_p);
res = ev_run(the_loop, 0);
PROFILE_STOP(mrkthr_sched0_p);
return res;
}
示例9: PROFILE_START
void SceneObject::setRenderTransform(const MatrixF& mat)
{
PROFILE_START(SceneObj_setRenderTransform);
mRenderObjToWorld = mRenderWorldToObj = mat;
mRenderWorldToObj.affineInverse();
AssertFatal(mObjBox.isValidBox(), "Bad object box!");
resetRenderWorldBox();
PROFILE_END();
}
示例10: PROFILE_START
void AtlasClipMapBatcher::sort()
{
PROFILE_START(AtlasClipMapBatcher_sort);
// Sort our elements. The other lists are already good to go, and there's
// no benefit to drawing them in a specific order as this pass (the first
// pass) will already set up the Z buffer.
for(S32 i=1; i<4; i++)
dQsort(mRenderList[i].address(),mRenderList[i].size(),sizeof(RenderNote*),cmpRenderNote);
PROFILE_END();
}
示例11: PROFILE_START
bool WindEmitter::findBest( const Point3F& cameraPos,
const VectorF& cameraDir,
F32 viewDistance,
U32 maxResults,
WindEmitterList* results )
{
PROFILE_START(WindEmitter_findBest);
// Build a sphere from the camera point.
SphereF cameraSphere;
cameraSphere.center = cameraPos;
cameraSphere.radius = viewDistance;
// Collect the active spheres within the camera space and score them.
WindEmitterList best;
WindEmitterList::iterator iter = smAllEmitters.begin();
for ( ; iter != smAllEmitters.end(); iter++ )
{
const SphereF& sphere = *(*iter);
// Skip any spheres outside of our camera range or that are disabled.
if ( !(*iter)->mEnabled || !cameraSphere.isIntersecting( sphere ) )
continue;
// Simple score calculation...
//
// score = ( radius / distance to camera ) * dot( cameraDir, vector from camera to sphere )
//
Point3F vect = sphere.center - cameraSphere.center;
F32 dist = vect.len();
(*iter)->mScore = dist * sphere.radius;
vect /= getMax( dist, 0.001f );
(*iter)->mScore *= mDot( vect, cameraDir );
best.push_back( *iter );
}
// Sort the results by score!
dQsort( best.address(), best.size(), sizeof(WindEmitter*), &WindEmitter::_sortByScore );
// Clip the results to the max requested.
if ( best.size() > maxResults )
best.setSize( maxResults );
// Merge the results and return.
results->merge( best );
PROFILE_END(); // WindEmitter_findBest
return best.size() > 0;
}
示例12: PROFILE_START
void GFXD3D9QueryFence::issue()
{
PROFILE_START( GFXD3D9QueryFence_issue );
// Create the query if we need to
if( mQuery == NULL )
{
HRESULT hRes = static_cast<GFXD3D9Device *>( mDevice )->getDevice()->CreateQuery( D3DQUERYTYPE_EVENT, &mQuery );
AssertFatal( hRes != D3DERR_NOTAVAILABLE, "Hardware does not support D3D9 Queries, this should be caught before this fence type is created" );
AssertISV( hRes != E_OUTOFMEMORY, "Out of memory" );
}
// Issue the query
mQuery->Issue( D3DISSUE_END );
PROFILE_END();
}
示例13: TestFIA_ErosionTest
static void
TestFIA_ErosionTest(CuTest* tc)
{
const char *file = TEST_DATA_DIR "\\morpholology_test.bmp";
FIBITMAP *dib1 = FIA_LoadFIBFromFile(file);
CuAssertTrue(tc, dib1 != NULL);
FIBITMAP *threshold_dib = FreeImage_Threshold(dib1, 20);
CuAssertTrue(tc, threshold_dib != NULL);
FIBITMAP *threshold_8bit_dib = FreeImage_ConvertTo8Bits(threshold_dib);
CuAssertTrue(tc, threshold_8bit_dib != NULL);
FIABITMAP *border_dib = FIA_SetBorder(threshold_8bit_dib, 2, 2
, BorderType_Constant, 0.0);
PROFILE_START("ErosionFilter");
FilterKernel kernel = FIA_NewKernel(2, 2, kernel_values, 1.0);
FIBITMAP* result_dib = FIA_BinaryErosion(border_dib, kernel);
CuAssertTrue(tc, result_dib != NULL);
PROFILE_STOP("ErosionFilter");
FIA_SaveFIBToFile(result_dib, TEST_DATA_OUTPUT_DIR "\\erosion_result.jpg", BIT24);
result_dib = FIA_BinaryInnerBorder(threshold_8bit_dib);
FIA_SimpleSaveFIBToFile(result_dib, TEST_DATA_OUTPUT_DIR "morphology/inner_border_result.bmp");
FreeImage_Unload(dib1);
FreeImage_Unload(threshold_dib);
FreeImage_Unload(threshold_8bit_dib);
FIA_Unload(border_dib);
FreeImage_Unload(result_dib);
}
示例14: cache_read
std::string cache_read() {
PROFILE_FUNC();
std::string data;
PROFILE_START(action_find); // Starts new action which will be inner to ACTION_READ
bool found = find_record();
PROFILE_STOP(action_find);
if (!found) {
PROFILE_BLOCK(load_from_disk);
data = read_from_disk();
put_into_cache(data);
return data; // Here all action guards are destructed and actions are correctly finished
}
data = load_from_cache();
return data;
}
示例15: TestFIA_HistogramTest
static void TestFIA_HistogramTest(CuTest* tc)
{
const char *file= TEST_DATA_DIR "drone-bee-greyscale.jpg";
FIBITMAP *dib = FIA_LoadFIBFromFile(file);
CuAssertTrue(tc, dib != NULL);
unsigned long hist[256];
PROFILE_START("FreeImageAlgorithms_Histogram");
if (FIA_Histogram(dib, 0, 255, 2, hist) == FIA_ERROR) {
CuFail(tc, "Failed");
}
PROFILE_STOP("FreeImageAlgorithms_Histogram");
FreeImage_Unload(dib);
}