コード例 #1
0
ファイル: WorkItemQueueManager.cpp プロジェクト: hoangt/dptf
void WorkItemQueueManager::enqueueImmediateWorkItemAndReturn(WorkItem* workItem, UIntN priority)
{
    EsifMutexHelper esifMutexHelper(&m_mutex);
    esifMutexHelper.lock();

    if (canEnqueueImmediateWorkItem(workItem))
    {
        ImmediateWorkItem* immediateWorkItem = new ImmediateWorkItem(workItem, priority);

        try
        {
            m_immediateQueue->enqueue(immediateWorkItem);
        }
        catch (std::exception ex)
        {
            DELETE_MEMORY_TC(immediateWorkItem);
            throw;
        }
    }
    else
    {
        DELETE_MEMORY_TC(workItem);
        throw dptf_exception("Failed to enqueue work item.  Enqueueing has been disabled.");
    }

    esifMutexHelper.unlock();
}
コード例 #2
0
DomainCoreControl_001::~DomainCoreControl_001(void)
{
    DELETE_MEMORY_TC(m_coreControlStaticCaps);
    DELETE_MEMORY_TC(m_coreControlDynamicCaps);
    DELETE_MEMORY_TC(m_coreControlLpoPreference);
    DELETE_MEMORY_TC(m_coreControlStatus);
}
コード例 #3
0
ファイル: WorkItemQueueManager.cpp プロジェクト: hoangt/dptf
void WorkItemQueueManager::deleteAllObjects(void)
{
    // Do not acquire mutex for this function.
    DELETE_MEMORY_TC(m_workItemQueueThread);
    DELETE_MEMORY_TC(m_deferredQueue);
    DELETE_MEMORY_TC(m_immediateQueue);
    DELETE_MEMORY_TC(m_workItemQueueSemaphore);
    DELETE_MEMORY_TC(m_workItemStatistics);
}
コード例 #4
0
void DomainCoreControl_001::clearCachedData(void)
{
    // Do not delete m_coreControlStatus.  We can't read this from ESIF.  We store it whenever it is 'set' and return
    // the value when requested.

    DELETE_MEMORY_TC(m_coreControlStaticCaps);
    DELETE_MEMORY_TC(m_coreControlDynamicCaps);
    DELETE_MEMORY_TC(m_coreControlLpoPreference);
}
コード例 #5
0
ファイル: WorkItemQueueThread.cpp プロジェクト: 01org/dptf
WorkItemQueueThread::~WorkItemQueueThread(void)
{
	m_destroyThread = true;

	m_workItemQueueSemaphore->signal();
	m_workItemQueueThreadExitSemaphore->wait();

	DELETE_MEMORY_TC(m_workItemQueueThreadHandle);
	DELETE_MEMORY_TC(m_workItemQueueThreadExitSemaphore);
}
コード例 #6
0
void DomainPowerControl_001::setPowerControl(UIntN participantIndex, UIntN domainIndex, const PowerControlStatusSet& powerControlStatusSet)
{
    validatePowerControlStatus(powerControlStatusSet, domainIndex);
    programPowerControl(powerControlStatusSet, domainIndex);
    DELETE_MEMORY_TC(m_powerControlStatusSet);
    m_powerControlStatusSet = new PowerControlStatusSet(powerControlStatusSet);
}
コード例 #7
0
ファイル: WorkItemQueueManager.cpp プロジェクト: hoangt/dptf
void WorkItemQueueManager::enqueueDeferredWorkItem(WorkItem* workItem, UInt64 numMilliSecUntilExecution)
{
    EsifMutexHelper esifMutexHelper(&m_mutex);
    esifMutexHelper.lock();

    if (m_enqueueingEnabled == true)
    {
        DeferredWorkItem* deferredWorkItem = new DeferredWorkItem(workItem, numMilliSecUntilExecution);

        try
        {
            m_deferredQueue->enqueue(deferredWorkItem);
        }
        catch (std::exception ex)
        {
            DELETE_MEMORY_TC(deferredWorkItem);
            throw;
        }
    }
    else
    {
        delete workItem;
        throw dptf_exception("Failed to enqueue work item.  Enqueueing has been disabled.");
    }

    esifMutexHelper.unlock();
}
コード例 #8
0
void DomainConfigTdpControl_001::checkHWConfigTdpSupport(std::vector<ConfigTdpControl> controls, UIntN domainIndex)
{
    m_configTdpLevelsAvailable = getLevelCount(domainIndex);
    m_configTdpLock = isLockBitSet(domainIndex);

    UIntN currentTdpControl = //ulTdpControl NOT index...
        getParticipantServices()->primitiveExecuteGetAsUInt32(
            esif_primitive_type::GET_PROC_CTDP_CURRENT_SETTING,
            domainIndex);

    // Determine the index...
    Bool controlIdFound = false;
    for (UIntN i = 0; i < controls.size(); i++)
    {
        if (currentTdpControl == controls.at(i).getControlId())
        {
            DELETE_MEMORY_TC(m_configTdpControlStatus);
            m_configTdpControlStatus = new ConfigTdpControlStatus(i);
            controlIdFound = true;
        }
    }

    if (controlIdFound == false)
    {
        throw dptf_exception("cTDP control not found in set.");
    }
}
コード例 #9
0
UIntN ImmediateWorkItemQueue::removeIfMatches(const WorkItemMatchCriteria& matchCriteria)
{
    EsifMutexHelper esifMutexHelper(&m_mutex);
    esifMutexHelper.lock();

    UIntN numRemoved = 0;

    auto it = m_queue.begin();
    while (it != m_queue.end())
    {
        if ((*it)->matches(matchCriteria) == true)
        {
            DELETE_MEMORY_TC(*it);
            it = m_queue.erase(it);
            numRemoved++;
        }
        else
        {
            it++;
        }
    }

    esifMutexHelper.unlock();

    return numRemoved;
}
コード例 #10
0
void DomainCoreControl_001::createCoreControlLpoPreferenceIfNeeded(UIntN domainIndex)
{
    if (m_coreControlLpoPreference == nullptr)
    {
        Bool useDefault = false;
        UInt32 dataLength = 0;
        DptfMemory binaryData(Constants::DefaultBufferSize);

        try
        {
            m_participantServicesInterface->primitiveExecuteGet(
                esif_primitive_type::GET_PROC_CURRENT_LOGICAL_PROCESSOR_OFFLINING,
                ESIF_DATA_BINARY,
                binaryData,
                binaryData.getSize(),
                &dataLength,
                domainIndex);
        }
        catch (...)
        {
            m_participantServicesInterface->writeMessageWarning(
                ParticipantMessage(FLF, "CLPO not found.  Using defaults."));
            useDefault = true;
        }

        if (useDefault == false)
        {
            try
            {
                m_coreControlLpoPreference = BinaryParse::processorClpoObject(dataLength, binaryData);
            }
            catch (...)
            {
                m_participantServicesInterface->writeMessageWarning(
                    ParticipantMessage(FLF, "Could not parse CLPO data.  Using defaults."));
                DELETE_MEMORY_TC(m_coreControlLpoPreference);
                useDefault = true;
            }
        }

        if (useDefault == true)
        {
            m_coreControlLpoPreference = new CoreControlLpoPreference(true, 0, Percentage(.50),
                CoreControlOffliningMode::Smt, CoreControlOffliningMode::Core);
        }

        binaryData.deallocate();
    }
}
コード例 #11
0
ファイル: WorkItemQueueThread.cpp プロジェクト: 01org/dptf
void WorkItemQueueThread::processImmediateQueue(void)
{
	ImmediateWorkItem* immediateWorkItem = m_immediateQueue->dequeue();

	while (immediateWorkItem != nullptr)
	{
		// FrameworkEvent::Type eventType = immediateWorkItem->getFrameworkEventType();

#ifdef INCLUDE_WORK_ITEM_STATISTICS
		try
		{
			immediateWorkItem->setWorkItemExecutionStartTime();
		}
		catch (...)
		{
		}
#endif

		try
		{
			immediateWorkItem->execute();
		}
		catch (...)
		{
		}

		try
		{
			m_participantManager->clearAllParticipantCachedData();
		}
		catch (...)
		{
		}

#ifdef INCLUDE_WORK_ITEM_STATISTICS
		try
		{
			m_workItemStatistics->incrementImmediateTotals(immediateWorkItem);
		}
		catch (...)
		{
		}
#endif

		DELETE_MEMORY_TC(immediateWorkItem);

		immediateWorkItem = m_immediateQueue->dequeue();
	}
}
コード例 #12
0
ファイル: WorkItemQueueManager.cpp プロジェクト: hoangt/dptf
void WorkItemQueueManager::enqueueImmediateWorkItemAndWait(WorkItem* workItem, UIntN priority)
{
    if (isWorkItemThread() == true)
    {
        // This is in place to prevent a deadlock.  Keep in mind that we run a single thread to process work items.
        // There are conditions where a work item is running (on a work item thread) and it submits another work item
        // and waits for the return.  In that case we have an automatic deadlock without this special processing
        // in place.  When this happens we just treat it like a function call and execute the work item directly
        // and return.  Without this in place the work item would just sit in the queue and never execute since
        // the thread is being held by the currently running work item.
        workItem->execute();
        delete workItem;
    }
    else
    {
        EsifSemaphore semaphore;

        EsifMutexHelper esifMutexHelper(&m_mutex);
        esifMutexHelper.lock();

        if (canEnqueueImmediateWorkItem(workItem))
        {
            ImmediateWorkItem* immediateWorkItem = new ImmediateWorkItem(workItem, priority);
            immediateWorkItem->signalAtCompletion(&semaphore);

            try
            {
                m_immediateQueue->enqueue(immediateWorkItem);
            }
            catch (std::exception ex)
            {
                DELETE_MEMORY_TC(immediateWorkItem);
                throw;
            }
        }
        else
        {
            delete workItem;
            throw dptf_exception("Failed to enqueue work item.  Enqueueing has been disabled.");
        }

        esifMutexHelper.unlock();

        semaphore.wait();
    }
}
コード例 #13
0
ファイル: WorkItemQueueThread.cpp プロジェクト: 01org/dptf
void WorkItemQueueThread::executeThread(void)
{
	// This is running on a separate thread and processes all work items until
	// the destructor is executed

	m_workItemQueueThreadId = new EsifThreadId();

	while (m_destroyThread == false)
	{
		processImmediateQueue();
		m_workItemQueueSemaphore->wait();
	}

	DELETE_MEMORY_TC(m_workItemQueueThreadId);

	m_workItemQueueThreadExitSemaphore->signal();
}
コード例 #14
0
void DomainCoreControl_001::setActiveCoreControl(UIntN participantIndex, UIntN domainIndex,
    const CoreControlStatus& coreControlStatus)
{
    verifyCoreControlStatus(domainIndex, coreControlStatus);
    createCoreControlStaticCapsIfNeeded(domainIndex);
    UIntN totalCores = m_coreControlStaticCaps->getTotalLogicalProcessors();
    UIntN totalOfflineCoreRequest = totalCores - coreControlStatus.getNumActiveLogicalProcessors();

    m_participantServicesInterface->primitiveExecuteSetAsUInt32(
        esif_primitive_type::SET_PROC_NUMBER_OFFLINE_CORES,
        totalOfflineCoreRequest,
        domainIndex);

    // Refresh the status
    DELETE_MEMORY_TC(m_coreControlStatus);
    m_coreControlStatus = new CoreControlStatus(coreControlStatus.getNumActiveLogicalProcessors());
}
コード例 #15
0
ファイル: ParticipantManager.cpp プロジェクト: hoangt/dptf
void ParticipantManager::destroyParticipant(UIntN participantIndex)
{
    if ((participantIndex < m_participant.size()) && (m_participant[participantIndex] != nullptr))
    {
        try
        {
            m_participant[participantIndex]->destroyParticipant();
        }
        catch (...)
        {
            ManagerMessage message = ManagerMessage(m_dptfManager, FLF, "Failed while trying to destroy participant.");
            message.addMessage("Participant Index", participantIndex);
            m_dptfManager->getEsifServices()->writeMessageError(message);
        }

        DELETE_MEMORY_TC(m_participant[participantIndex]);
    }
}
コード例 #16
0
DisplayControlStatus DomainDisplayControl_001::getDisplayControlStatus(UIntN participantIndex, UIntN domainIndex)
{
    if (m_currentDisplayControlIndex == Constants::Invalid)
    {
        checkAndCreateControlStructures(domainIndex);

        // FIXME : This primitive will return the brightness after ALS setting has been applied!

        Percentage brightnessPercentage = m_participantServicesInterface->primitiveExecuteGetAsPercentage(
            esif_primitive_type::GET_DISPLAY_BRIGHTNESS_SOFT, domainIndex);

        m_currentDisplayControlIndex = m_displayControlSet->getControlIndex(brightnessPercentage);

        DELETE_MEMORY_TC(m_displayControlStatus);
        m_displayControlStatus = new DisplayControlStatus(m_currentDisplayControlIndex);
    }

    return *m_displayControlStatus;
}
コード例 #17
0
void DomainConfigTdpControl_001::setConfigTdpControl(UIntN participantIndex, UIntN domainIndex,
    UIntN configTdpControlIndex)
{
    checkAndCreateControlStructures(domainIndex);

    // If any of the lock bits are set, we cannot program cTDP
    if (m_configTdpLock)
    {
        getParticipantServices()->writeMessageWarning(
            ParticipantMessage(FLF, "cTDP set level ignored, lock bit is set!"));
        return;
    }

    // Bounds checking
    verifyConfigTdpControlIndex(configTdpControlIndex);

    getParticipantServices()->primitiveExecuteSetAsUInt32(
        esif_primitive_type::SET_PROC_CTDP_CONTROL,
        (UInt32)(*m_configTdpControlSet)[configTdpControlIndex].getControlId(), // This is what 7.x does
        domainIndex);

    getParticipantServices()->primitiveExecuteSetAsUInt32(
        esif_primitive_type::SET_PROC_TURBO_ACTIVATION_RATIO,
        (UInt32)((*m_configTdpControlSet)[configTdpControlIndex].getTdpRatio() - 1), // This is what 7.x does
        domainIndex);

    // Then BIOS
    getParticipantServices()->primitiveExecuteSetAsUInt32(
        esif_primitive_type::SET_CTDP_POINT,
        configTdpControlIndex,
        domainIndex);

    // Refresh the status
    DELETE_MEMORY_TC(m_configTdpControlStatus);
    m_configTdpControlStatus = new ConfigTdpControlStatus(configTdpControlIndex);
}
コード例 #18
0
void DomainDisplayControl_001::setDisplayControl(UIntN participantIndex, UIntN domainIndex,
    UIntN displayControlIndex, Bool isOverridable)
{
    checkAndCreateControlStructures(domainIndex);

    if (displayControlIndex == m_currentDisplayControlIndex)
    {
        m_participantServicesInterface->writeMessageDebug(
            ParticipantMessage(FLF, "Requested limit = current limit.  Ignoring."));
        return;
    }

    verifyDisplayControlIndex(displayControlIndex);

    Percentage newBrightness = (*m_displayControlSet)[m_currentDisplayControlIndex].getBrightness();

    if (isOverridable == true)
    {
        m_participantServicesInterface->primitiveExecuteSetAsPercentage(
            esif_primitive_type::SET_DISPLAY_BRIGHTNESS_SOFT,
            newBrightness,
            domainIndex);
    }
    else
    {
        m_participantServicesInterface->primitiveExecuteSetAsPercentage(
            esif_primitive_type::SET_DISPLAY_BRIGHTNESS_HARD,
            newBrightness,
            domainIndex);
    }

    // Refresh the status
    m_currentDisplayControlIndex = displayControlIndex;
    DELETE_MEMORY_TC(m_displayControlStatus);
    m_displayControlStatus = new DisplayControlStatus(m_currentDisplayControlIndex);
}
コード例 #19
0
void DomainPowerControl_001::clearCachedData(void)
{
    DELETE_MEMORY_TC(m_powerControlDynamicCaps);
}
コード例 #20
0
ファイル: DptfManager.cpp プロジェクト: hoangt/dptf
void DptfManager::deleteEsifServices(void)
{
    DELETE_MEMORY_TC(m_esifServices);
}
コード例 #21
0
ファイル: DeferredWorkItem.cpp プロジェクト: LjdCN/dptf
DeferredWorkItem::~DeferredWorkItem(void)
{
    DELETE_MEMORY_TC(m_workItem);
}
コード例 #22
0
void DomainConfigTdpControl_001::clearCachedData(void)
{
    DELETE_MEMORY_TC(m_configTdpControlSet);
    DELETE_MEMORY_TC(m_configTdpControlDynamicCaps);
    DELETE_MEMORY_TC(m_configTdpControlStatus);
}
コード例 #23
0
ファイル: DptfManager.cpp プロジェクト: hoangt/dptf
void DptfManager::deleteIndexContainer(void)
{
    DELETE_MEMORY_TC(m_indexContainer);
}
コード例 #24
0
ファイル: DptfStatus.cpp プロジェクト: 01org/dptf
DptfStatus::~DptfStatus()
{
	DELETE_MEMORY_TC(m_participantStatusMap);
}
コード例 #25
0
ファイル: DptfManager.cpp プロジェクト: hoangt/dptf
void DptfManager::deleteParticipantManager(void)
{
    DELETE_MEMORY_TC(m_participantManager);
}
コード例 #26
0
DomainDisplayControl_001::~DomainDisplayControl_001(void)
{
    DELETE_MEMORY_TC(m_displayControlDynamicCaps);
    DELETE_MEMORY_TC(m_displayControlSet);
    DELETE_MEMORY_TC(m_displayControlStatus);
}
コード例 #27
0
ファイル: UniqueIdGenerator.cpp プロジェクト: LjdCN/dptf
void UniqueIdGenerator::destroy(void)
{
    DELETE_MEMORY_TC(uniqueIdGenerator);
}
コード例 #28
0
DomainPowerControl_001::~DomainPowerControl_001(void)
{
    DELETE_MEMORY_TC(m_powerControlStatusSet);
    DELETE_MEMORY_TC(m_powerControlDynamicCaps);
}
コード例 #29
0
ファイル: PassivePolicyInterface.cpp プロジェクト: 01org/dptf
dptf_export void DestroyPolicyInstance(PolicyInterface* policy)
{
	DELETE_MEMORY_TC(policy);
}
コード例 #30
0
ファイル: UnifiedDomain.cpp プロジェクト: hoangt/dptf
UnifiedDomain::~UnifiedDomain(void)
{
    // destroy all objects created in the constructor
    DELETE_MEMORY_TC(m_activeControl);
    DELETE_MEMORY_TC(m_configTdpControl);
    DELETE_MEMORY_TC(m_coreControl);
    DELETE_MEMORY_TC(m_displayControl);
    DELETE_MEMORY_TC(m_performanceControl);
    DELETE_MEMORY_TC(m_pixelClockControl);
    DELETE_MEMORY_TC(m_pixelClockStatus);
    DELETE_MEMORY_TC(m_powerControl);
    DELETE_MEMORY_TC(m_powerStatus);
    DELETE_MEMORY_TC(m_domainPriority);
    DELETE_MEMORY_TC(m_rfProfileControl);
    DELETE_MEMORY_TC(m_rfProfileStatus);
    DELETE_MEMORY_TC(m_temperature);
    DELETE_MEMORY_TC(m_utilization);
}