コード例 #1
0
int	btParticlesDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, btScalar fixedTimeStep)
{
	startProfiling(timeStep);
	m_timeStep = timeStep;
	BT_PROFILE("stepSimulation");
//	printf("Step : %d\n", gStepNum);
	{
		BT_PROFILE("IntegrateMotion");
		runIntegrateMotionKernel();
	}
	{
		runComputeCellIdKernel();
	}
	{
		BT_PROFILE("SortHash");
		runSortHashKernel();
	}
	{
		BT_PROFILE("FindCellStart");
		runFindCellStartKernel();
	}
	{
		BT_PROFILE("CollideParticles");
		runCollideParticlesKernel();
	}
	gStepNum++;

#ifndef BT_NO_PROFILE
	CProfileManager::Increment_Frame_Counter();
#endif //BT_NO_PROFILE
	return 1;
}
コード例 #2
0
QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled()), engine->profiler, SLOT(startProfiling()));
    connect(this, SIGNAL(profilingEnabledWhileWaiting()),
            engine->profiler, SLOT(startProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()),
            engine->profiler, SLOT(stopProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QQmlProfilerData>)),
            this, SLOT(receiveData(QList<QQmlProfilerData>)));
}
コード例 #3
0
void	btContinuousDynamicsWorld::internalSingleStepSimulation( btScalar timeStep)
{
	
	startProfiling(timeStep);
	
	if(0 != m_internalPreTickCallback) {
		(*m_internalPreTickCallback)(this, timeStep);
	}


	///update aabbs information
	updateAabbs();
	//static int frame=0;
//	printf("frame %d\n",frame++);

	///apply gravity, predict motion
	predictUnconstraintMotion(timeStep);

	btDispatcherInfo& dispatchInfo = getDispatchInfo();

	dispatchInfo.m_timeStep = timeStep;
	dispatchInfo.m_stepCount = 0;
	dispatchInfo.m_debugDraw = getDebugDrawer();

	///perform collision detection
	performDiscreteCollisionDetection();

	calculateSimulationIslands();

	
	getSolverInfo().m_timeStep = timeStep;
	


	///solve contact and other joint constraints
	solveConstraints(getSolverInfo());
	
	///CallbackTriggers();
	calculateTimeOfImpacts(timeStep);

	btScalar toi = dispatchInfo.m_timeOfImpact;
//	if (toi < 1.f)
//		printf("toi = %f\n",toi);
	if (toi < 0.f)
		kdPrintf("toi = %f\n",toi);


	///integrate transforms
	integrateTransforms(timeStep * toi);

	///update vehicle simulation
	updateActions(timeStep);

	updateActivationState( timeStep );
	
	if(0 != m_internalTickCallback) {
		(*m_internalTickCallback)(this, timeStep);
	}
}
コード例 #4
0
void V8ProfilerAgentImpl::consoleProfile(const String& title)
{
    ASSERT(m_frontend && m_enabled);
    String id = nextProfileId();
    m_startedProfiles.append(ProfileDescriptor(id, title));
    startProfiling(id);
    m_frontend->consoleProfileStarted(id, currentDebugLocation(), title.isNull() ? 0 : &title);
}
コード例 #5
0
void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame* frame)
{
    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, frame);

    if (frame && !m_recordingProfile) {
        m_recordingProfile = true;
        startProfiling(frame, ASCIILiteral("Timeline EvaluateScript"));
    }
}
コード例 #6
0
void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, Frame* frame)
{
    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);

    if (frame && !m_recordingProfile) {
        m_recordingProfile = true;
        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"));
    }
}
コード例 #7
0
void InspectorTimelineAgent::willEvaluateScript(const String& url, int lineNumber, Frame& frame)
{
    pushCurrentRecord(TimelineRecordFactory::createEvaluateScriptData(url, lineNumber), TimelineRecordType::EvaluateScript, true, &frame);

    if (!m_callStackDepth) {
        ++m_callStackDepth;
        startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
    }
}
コード例 #8
0
void InspectorTimelineAgent::willCallFunction(const String& scriptName, int scriptLine, Frame* frame)
{
    pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);

    if (frame && !m_callStackDepth)
        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());

    ++m_callStackDepth;
}
コード例 #9
0
void V8ProfilerAgentImpl::consoleProfile(const String16& title)
{
    if (!m_enabled)
        return;
    String16 id = nextProfileId();
    m_startedProfiles.push_back(ProfileDescriptor(id, title));
    startProfiling(id);
    m_frontend.consoleProfileStarted(id, currentDebugLocation(m_session->debugger()), title);
}
コード例 #10
0
QT_BEGIN_NAMESPACE

QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::ExecutionEngine *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)));
    connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()), engine->profiler, SLOT(stopProfiling()),
            Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QV4::Profiling::FunctionCallProperties>,
                                               QList<QV4::Profiling::MemoryAllocationProperties>)),
            this, SLOT(receiveData(QList<QV4::Profiling::FunctionCallProperties>,
                                   QList<QV4::Profiling::MemoryAllocationProperties>)));
}
コード例 #11
0
void V8ProfilerAgentImpl::start(ErrorString* error)
{
    if (m_recordingCPUProfile)
        return;
    if (!m_enabled) {
        *error = "Profiler is not enabled";
        return;
    }
    m_recordingCPUProfile = true;
    m_frontendInitiatedProfileId = nextProfileId();
    startProfiling(m_frontendInitiatedProfileId);
    m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
}
コード例 #12
0
void InspectorProfilerAgent::start(ErrorString*)
{
    if (m_recordingCPUProfile)
        return;
    if (!enabled()) {
        enable(true);
    }
    m_recordingCPUProfile = true;
    String title = getCurrentUserInitiatedProfileName(true);
    startProfiling(title);
    addStartProfilingMessageToConsole(title, 0, String());
    toggleRecordButton(true);
    m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
}
コード例 #13
0
void InspectorProfilerAgent::start(ErrorString*)
{
    if (m_recordingCPUProfile)
        return;
    if (!enabled()) {
        enable(true);
        PageScriptDebugServer::shared().recompileAllJSFunctions(0);
    }
    m_recordingCPUProfile = true;
    String title = getCurrentUserInitiatedProfileName(true);
    startProfiling(title);
    addStartProfilingMessageToConsole(title, 0, 0, String());
    toggleRecordButton(true);
}
コード例 #14
0
void InspectorTimelineAgent::startFromConsole(JSC::ExecState* exec, const String &title)
{
    // Only allow recording of a profile if it is anonymous (empty title) or does not match
    // the title of an already recording profile.
    if (!title.isEmpty()) {
        for (const TimelineRecordEntry& record : m_pendingConsoleProfileRecords) {
            String recordTitle;
            record.data->getString(ASCIILiteral("title"), recordTitle);
            if (recordTitle == title)
                return;
        }
    }

    if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
        internalStart();

    startProfiling(exec, title, m_instrumentingAgents.inspectorEnvironment().executionStopwatch());

    m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
}
コード例 #15
0
void InspectorTimelineAgent::start(ErrorString&, const int* in_maxCallStackDepth) {
    if (m_enabled)
        return;

    if (in_maxCallStackDepth && *in_maxCallStackDepth > 0)
        m_maxCallStackDepth = *in_maxCallStackDepth;
    else
        m_maxCallStackDepth = 5;

    PassRefPtr<Stopwatch> stopwatch = m_globalObject.inspectorController().executionStopwatch();
    if (!stopwatch->isActive())
        stopwatch->start();

    if (m_frontendDispatcher)
        m_frontendDispatcher->recordingStarted(timestamp());

    startProfiling(m_globalObject.globalExec(), WTF::emptyString(), stopwatch);

    m_enabled = true;

    m_consoleRecordEntry = createRecordEntry(TimelineRecordFactory::createConsoleProfileData(WTF::emptyString()), TimelineRecordType::ConsoleProfile, true);
}
コード例 #16
0
ファイル: mal.c プロジェクト: jaiminpan/Monetdb
int mal_init(void){
#ifdef NEED_MT_LOCK_INIT
	MT_lock_init( &mal_contextLock, "mal_contextLock");
	MT_lock_init( &mal_namespaceLock, "mal_namespaceLock");
	MT_lock_init( &mal_remoteLock, "mal_remoteLock");
	MT_lock_init( &mal_profileLock, "mal_profileLock");
	MT_lock_init( &mal_copyLock, "mal_copyLock");
	MT_lock_init( &mal_delayLock, "mal_delayLock");
#endif
	/* "/2" is arbitrarily used / chosen, as on systems with
	 * hyper-threading enabled, using all hardware threads rather than
	 * "only" all physical cores does not necessarily yield a linear
	 * performance benefit */
	MT_sema_init( &mal_parallelism, (GDKnr_threads > 1 ? GDKnr_threads/2: 1), "mal_parallelism");

	tstAligned();
	MCinit();
	if (mdbInit()) 
		return -1;
	if (monet_memory == 0)
		monet_memory = MT_npages() * MT_pagesize();
	initNamespace();
	initParser();
	initHeartbeat();
	initResource();
#ifdef HAVE_JSONSTORE
	startHttpdaemon();
#endif
	RECYCLEinit();
	if( malBootstrap() == 0)
		return -1;
	/* set up the profiler if needed, output sent to console */
	/* Use the same shortcuts as stethoscope */
	if ( mal_trace && *mal_trace) {
		char *s;
		setFilterAll();
		openProfilerStream(mal_clients[0].fdout);
		for ( s= mal_trace; *s; s++)
		switch(*s){
		case 'a': activateCounter("aggregate");break;
		case 'b': activateCounter("rbytes");
				activateCounter("wbytes");break;
		case 'c': activateCounter("cpu");break;
		case 'e': activateCounter("event");break;
		case 'f': activateCounter("function");break;
		case 'i': activateCounter("pc");break;
		case 'm': activateCounter("memory");break;
		case 'p': activateCounter("process");break;
		case 'r': activateCounter("reads");break;
		case 's': activateCounter("stmt");break;
		case 't': activateCounter("ticks");break;
		case 'u': activateCounter("user");break;
		case 'w': activateCounter("writes");break;
		case 'y': activateCounter("type");break;
		case 'D': activateCounter("dot");break;
		case 'I': activateCounter("thread");break; 
		case 'T': activateCounter("time");break;
		case 'S': activateCounter("start");
		}
		startProfiling();
	} else mal_trace =0;
	return 0;
}
コード例 #17
0
ファイル: ai.cpp プロジェクト: BackupTheBerlios/wolfpack-svn
void AbstractAI::check()
{
#if defined(AIDEBUG)
	AbstractAction* oldaction = m_currentAction;
#endif

	startProfiling( PF_AICHECKFINDACTION );
	// If we have no current action or our action cant be executed, we must get a new one
	if ( !m_currentAction || ( m_currentAction && m_currentAction->preCondition() <= 0.0f ) )
	{
		std::vector<stActionNode> actions;
		std::vector<stActionNode>::iterator it;

		AbstractAction* action = NULL;
		for ( action = m_actions.first(); action; action = m_actions.next() )
		{
			actions.push_back( stActionNode( action->preCondition(), action ) );
		}
		std::sort( actions.begin(), actions.end(), ActionNodeComparePredicate() );

		it = actions.begin();
		while ( it != actions.end() && !m_currentAction )
		{
			if ( ( *it ).fuzzy > 0.0f )
				m_currentAction = ( *it ).action;
			++it;
		}
	}
	stopProfiling( PF_AICHECKFINDACTION );

	// Action is changing
#if defined(AIDEBUG)
	if ( m_currentAction && oldaction != m_currentAction )
	{
		QString message = QString( "[NEWACTION: %1]" ).arg( m_currentAction->name() );
		m_npc->talk( message );
	}
#endif

	m_npc->setAICheckTime( Server::instance()->time() + m_npc->wanderSpeed() );

	// Now we should have a current action set, else do nothing!
	startProfiling( PF_AICHECKEXECUTEACTION );
	if ( m_currentAction )
	{
		if ( !m_currentAction->isPassive() )
		{
			m_npc->setAICheckTime( Server::instance()->time() + m_npc->actionSpeed() );
		}

		m_currentAction->execute();

		// We must check the postcondition now and set the current action to NULL
		// if the action is finished (when it returns >= 1.0f)!
		float rnd = RandomNum( 0, 1000 ) / 1000.0f;
		if ( m_currentAction->postCondition() >= rnd )
		{
			// Action changing
#if defined(AIDEBUG)
			QString message = QString( "[ENDACTION: %1]" ).arg( m_currentAction->name() );
			m_npc->talk( message );
#endif

			m_currentAction = NULL;
		}
	}

	stopProfiling( PF_AICHECKEXECUTEACTION );
}
コード例 #18
0
static inline void startProfiling(Frame* frame, const String& title, RefPtr<Stopwatch>&& stopwatch)
{
    startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title, WTF::move(stopwatch));
}
コード例 #19
0
int	btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, btScalar fixedTimeStep)
{
	startProfiling(timeStep);

	BT_PROFILE("stepSimulation");

	int numSimulationSubSteps = 0;

	if (maxSubSteps)
	{
		//fixed timestep with interpolation
		m_localTime += timeStep;
		if (m_localTime >= fixedTimeStep)
		{
			numSimulationSubSteps = int( m_localTime / fixedTimeStep);
			m_localTime -= numSimulationSubSteps * fixedTimeStep;
		}
	} else
	{
		//variable timestep
		fixedTimeStep = timeStep;
		m_localTime = timeStep;
		if (btFuzzyZero(timeStep))
		{
			numSimulationSubSteps = 0;
			maxSubSteps = 0;
		} else
		{
			numSimulationSubSteps = 1;
			maxSubSteps = 1;
		}
	}

	//process some debugging flags
	if (getDebugDrawer())
	{
		btIDebugDraw* debugDrawer = getDebugDrawer ();
		gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0;
	}
	if (numSimulationSubSteps)
	{

		//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
		int clampedSimulationSteps = (numSimulationSubSteps > maxSubSteps)? maxSubSteps : numSimulationSubSteps;

		saveKinematicState(fixedTimeStep*clampedSimulationSteps);

		applyGravity();

		

		for (int i=0;i<clampedSimulationSteps;i++)
		{
			internalSingleStepSimulation(fixedTimeStep);
			synchronizeMotionStates();
		}

	} else
	{
		synchronizeMotionStates();
	}

	clearForces();

#ifndef BT_NO_PROFILE
	CProfileManager::Increment_Frame_Counter();
#endif //BT_NO_PROFILE
	
	return numSimulationSubSteps;
}