AMDTResult tpCollectImpl::tpStopThreadProfile() { AMDTResult retVal = AMDT_STATUS_OK; ULONG status = ERROR_SUCCESS; //if (!tpIsProfileInitialized()) //{ // retVal = AMDT_ERROR_PROFILE_NOT_CONFIGURED; //} if (!tpIsProfileRunning()) { retVal = AMDT_ERROR_PROFILE_NOT_STARTED; } PEVENT_TRACE_PROPERTIES pSessionProperties = m_pSessionProperties; bool isCollectCStack = m_callstack; if (NULL == pSessionProperties) { retVal = AMDT_ERROR_INTERNAL; } //fprintf(stderr, "tpStopThreadProfile .. retVal(%lx), state(%u)\n", retVal, m_tpState); if (AMDT_STATUS_OK == retVal) { // To disable stack tracing, call this function with InformationClass set to TraceStackTracingInfo // and InformationLength set to 0 if (isCollectCStack) { status = TraceSetInformation(m_sessionHandle, TraceStackTracingInfo, NULL, 0); fprintf(stderr, "Disable stack tracing - TraceSetInformation() status(%lu)\n", status); } status = ControlTrace(m_sessionHandle, KERNEL_LOGGER_NAME, pSessionProperties, EVENT_TRACE_CONTROL_STOP); //fprintf(stderr, "ControlTrace(stop) status(%lu)\n", status); if (ERROR_SUCCESS != status) { // FIXME: what to do if it fails fprintf(stderr, "ControlTrace(stop) failed with %lu\n", status); } // TODO: set this only is top succeeds m_tpState = AMDT_THREAD_PROFILE_STATE_UNINITIALIZED; status = tpClear(); } return status; } // tpStopThreadProfile
int tpInit(TP_STRUCT * tp) { tp->cycleTime = 0.0; tp->vLimit = 0.0; tp->vScale = 1.0; tp->aMax = 0.0; tp->vMax = 0.0; tp->ini_maxvel = 0.0; tp->wMax = 0.0; tp->wDotMax = 0.0; ZERO_EMC_POSE(tp->currentPos); return tpClear(tp); }