Condividi tramite


PPHYSICAL_COUNTER_OVERFLOW_HANDLER funzione di callback (ntddk.h)

Il PPHYSICAL_COUNTER_OVERFLOW_HANDLER viene implementato dal driver client per gestire i overflow dei contatori acquisiti tramite la routine HalAllocateHardwareCounters .

Sintassi

PPHYSICAL_COUNTER_OVERFLOW_HANDLER PphysicalCounterOverflowHandler;

void PphysicalCounterOverflowHandler(
  ULONGLONG OverflowBits,
  HANDLE OwningHandle
)
{...}

Parametri

OverflowBits

Fornisce una bitmap che descrive i contatori overflow.

OwningHandle

Fornisce l'handle corrispondente alla risorsa impostata sui contatori di overflowing a cui appartengono.

Valore restituito

nessuno

Osservazioni

Registrare l'implementazione di questa funzione di callback chiamando HalAllocateHardwareCounters con una struttura di tipo PHYSICAL_COUNTER_RESOURCE_LIST. Nella PHYSICAL_COUNTER_RESOURCE_LIST fornire una struttura di tipo PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR che specifica un PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE di ResourceTypeOverflow.

Ecco un prototipo di esempio per un gestore overflow:

VOID
PmuAwareOverflowHandler (
    _In_ ULONGLONG OverflowStatus,
    _In_ HANDLE OwningHandle
    )

/*++

Routine Description:

    This routine is the PMU Overflow Handler for a sharing driver.

Arguments:

    OverflowStatus - The counters which have overflowed.

    OwningHandle - The handle owning the counters.

Return Value:

    None.

--*/
{
}

Per registrare il gestore overflow, usare il codice simile al seguente:

VOID
CreateOverflowDescriptor (
    _Inout_ PPHYSICAL_COUNTER_RESOURCE_LIST CounterResourceList,
    _In_ ULONG DescriptorIndex
    )
{

    CounterResourceList->Descriptors[DescriptorIndex].Type = ResourceTypeOverflow;
    CounterResourceList->Descriptors[DescriptorIndex].u.OverflowHandler = PmuAwareOverflowHandler;
}

Questo callback viene chiamato in IRQL = PROFILE_LEVEL. Ciò significa che deve essere sempre residente in memoria. Il callback deve restituire il più rapidamente possibile e non tentare di eseguire alcuna delle operazioni seguenti.

  • Acquisire o rilasciare blocchi di spin.

  • Pool con pagina di accesso non bloccato in memoria

  • Chiamare una routine paginabile.

Il callback non deve gestire la cancellazione di registri overflow perché verrà gestito da HAL.

Requisiti

Requisito Valore
Piattaforma di destinazione Windows
Intestazione ntddk.h
IRQL PROFILE_LEVEL