Пример #1
0
/******************************************************************************
 *           GetTickCount64       (KERNEL32.@)
 */
ULONGLONG WINAPI GetTickCount64(void)
{
    LARGE_INTEGER counter, frequency;

    NtQueryPerformanceCounter( &counter, &frequency );
    return counter.QuadPart * 1000 / frequency.QuadPart;
}
Пример #2
0
/****************************************************************************
 *		QueryPerformanceCounter (KERNEL32.@)
 */
BOOL WINAPI QueryPerformanceCounter (PLARGE_INTEGER counter)
{
   NTSTATUS status = NtQueryPerformanceCounter (counter, NULL);
   if (status)
      SetLastError (RtlNtStatusToDosError (status));
   return !status;
}
Пример #3
0
VOID EtInitializeDiskInformation(
    VOID
    )
{
    LARGE_INTEGER performanceCounter;

    EtDiskItemType = PhCreateObjectType(L"DiskItem", 0, EtpDiskItemDeleteProcedure);
    EtDiskHashtable = PhCreateHashtable(
        sizeof(PET_DISK_ITEM),
        EtpDiskHashtableEqualFunction,
        EtpDiskHashtableHashFunction,
        128
        );
    InitializeListHead(&EtDiskAgeListHead);

    PhInitializeFreeList(&EtDiskPacketFreeList, sizeof(ETP_DISK_PACKET), 64);
    RtlInitializeSListHead(&EtDiskPacketListHead);
    EtFileNameHashtable = PhCreateSimpleHashtable(128);

    NtQueryPerformanceCounter(&performanceCounter, &EtpPerformanceFrequency);

    EtDiskEnabled = TRUE;

    // Collect all existing file names.
    EtStartEtwRundown();

    PhRegisterCallback(
        &PhProcessesUpdatedEvent,
        ProcessesUpdatedCallback,
        NULL,
        &ProcessesUpdatedCallbackRegistration
        );
}
Пример #4
0
double GetPerformanceCounter()
{
    LARGE_INTEGER li;

    NtQueryPerformanceCounter(&li, NULL);

    return (double)li.QuadPart / PCFreq;
}
Пример #5
0
/****************************************************************************
 *		QueryPerformanceFrequency (KERNEL32.@)
 */
BOOL WINAPI QueryPerformanceFrequency (PLARGE_INTEGER frequency)
{
   LARGE_INTEGER counter;
   NTSTATUS status = NtQueryPerformanceCounter (&counter, frequency);
   if (status)
      SetLastError (RtlNtStatusToDosError (status));
   return !status;
}
Пример #6
0
VOID StartCounter()
{
    LARGE_INTEGER perfCount;
    LARGE_INTEGER frequency;

    NtQueryPerformanceCounter(&perfCount, &frequency);

    PCFreq = (double)frequency.QuadPart / 1000.0;;
}
ULONGLONG WINAPI KeQueryPerformanceCounter(LARGE_INTEGER *frequency)
{
    LARGE_INTEGER counter;

    TRACE("(%p)\n", frequency);

    NtQueryPerformanceCounter(&counter, frequency);
    return counter.QuadPart;
}
Пример #8
0
VOID
UpdateNodeInformation()
{
    UINT32 j;
    D3DKMT_QUERYSTATISTICS queryStatistics;
    UINT64 totalRunningTime;
    UINT64 systemRunningTime;
    LARGE_INTEGER performanceCounter;
    static BOOLEAN initialized = FALSE;

    //check if initialized
    if (!initialized)
    {
        D3DKMTInitialize();
        initialized = TRUE;
    }

    totalRunningTime = 0;
    systemRunningTime = 0;

    if (D3dkmt_GpuAdapter == NULL)
    {
        return;
    }

    for (j = 0; j < D3dkmt_GpuAdapter->NodeCount; j++)
    {
        memset(&queryStatistics, 0, sizeof(D3DKMT_QUERYSTATISTICS));

        queryStatistics.Type                = D3DKMT_QUERYSTATISTICS_NODE;
        queryStatistics.AdapterLuid         = D3dkmt_GpuAdapter->AdapterLuid;
        queryStatistics.QueryNode.NodeId    = j;

        if (NT_SUCCESS(D3DKMTQueryStatistics(&queryStatistics)))
        {
            UINT32 nodeIndex;

            nodeIndex = D3dkmt_GpuAdapter->FirstNodeIndex + j;

            PhUpdateDelta(
                &EtGpuNodesTotalRunningTimeDelta[nodeIndex],
                queryStatistics.QueryResult.NodeInformation.GlobalInformation.RunningTime.QuadPart
                );

            totalRunningTime += queryStatistics.QueryResult.NodeInformation.GlobalInformation.RunningTime.QuadPart;
            systemRunningTime += queryStatistics.QueryResult.NodeInformation.SystemInformation.RunningTime.QuadPart;
        }
    }

    NtQueryPerformanceCounter(&performanceCounter, &EtClockTotalRunningTimeFrequency);

    PhUpdateDelta(&EtClockTotalRunningTimeDelta, performanceCounter.QuadPart);
    PhUpdateDelta(&EtGpuTotalRunningTimeDelta, totalRunningTime);
    PhUpdateDelta(&EtGpuSystemRunningTimeDelta, systemRunningTime);
}
Пример #9
0
/*
 * @implemented
 */
BOOL
WINAPI
QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
{
    LARGE_INTEGER Count;
    NTSTATUS Status;

    Status = NtQueryPerformanceCounter(&Count, lpFrequency);
    if (!Count.QuadPart) Status = STATUS_NOT_IMPLEMENTED;
    
    if (!NT_SUCCESS(Status))
    {
        BaseSetLastNTError(Status);
        return FALSE;
    }

    return TRUE;
}
Пример #10
0
Файл: cpu.c Проект: bpowers/wine
/****************************************************************************
 *		QueryPerformanceFrequency (KERNEL32.@)
 *
 * Get the resolution of the performance counter.
 *
 * PARAMS
 *  frequency [O] Destination for the counter resolution
 *
 * RETURNS
 *  Success. TRUE. Frequency contains the resolution of the counter.
 *  Failure: FALSE.
 *
 * SEE ALSO
 *  See QueryPerformanceCounter.
 */
BOOL WINAPI QueryPerformanceFrequency(PLARGE_INTEGER frequency)
{
    LARGE_INTEGER counter;
    NtQueryPerformanceCounter( &counter, frequency );
    return TRUE;
}
Пример #11
0
Файл: cpu.c Проект: bpowers/wine
/****************************************************************************
 *		QueryPerformanceCounter (KERNEL32.@)
 *
 * Get the current value of the performance counter.
 * 
 * PARAMS
 *  counter [O] Destination for the current counter reading
 *
 * RETURNS
 *  Success: TRUE. counter contains the current reading
 *  Failure: FALSE.
 *
 * SEE ALSO
 *  See QueryPerformanceFrequency.
 */
BOOL WINAPI QueryPerformanceCounter(PLARGE_INTEGER counter)
{
    NtQueryPerformanceCounter( counter, NULL );
    return TRUE;
}
Пример #12
0
static VOID EtpUpdateNodeInformation(
	_In_opt_ PET_PROCESS_BLOCK Block
	)
{
	ULONG i;
	ULONG j;
	PETP_GPU_ADAPTER gpuAdapter;
	D3DKMT_QUERYSTATISTICS queryStatistics;
	ULONG64 totalRunningTime;
	ULONG64 systemRunningTime;

	if (Block && !Block->ProcessItem->QueryHandle)
		return;

	totalRunningTime = 0;
	systemRunningTime = 0;

	for (i = 0; i < EtpGpuAdapterList->Count; i++)
	{
		gpuAdapter = EtpGpuAdapterList->Items[i];

		for (j = 0; j < gpuAdapter->NodeCount; j++)
		{
			if (Block && !RtlCheckBit(&EtGpuNodeBitMap, gpuAdapter->FirstNodeIndex + j))
				continue;

			memset(&queryStatistics, 0, sizeof(D3DKMT_QUERYSTATISTICS));

			if (Block)
				queryStatistics.Type = D3DKMT_QUERYSTATISTICS_PROCESS_NODE;
			else
				queryStatistics.Type = D3DKMT_QUERYSTATISTICS_NODE;

			queryStatistics.AdapterLuid = gpuAdapter->AdapterLuid;

			if (Block)
			{
				queryStatistics.hProcess = Block->ProcessItem->QueryHandle;
				queryStatistics.QueryProcessNode.NodeId = j;
			}
			else
			{
				queryStatistics.QueryNode.NodeId = j;
			}

			if (NT_SUCCESS(D3DKMTQueryStatistics_I(&queryStatistics)))
			{
				if (Block)
				{
					totalRunningTime += queryStatistics.QueryResult.ProcessNodeInformation.RunningTime.QuadPart;
				}
				else
				{
					ULONG nodeIndex;

					nodeIndex = gpuAdapter->FirstNodeIndex + j;

					PhUpdateDelta(&EtGpuNodesTotalRunningTimeDelta[nodeIndex], queryStatistics.QueryResult.NodeInformation.GlobalInformation.RunningTime.QuadPart);

					if (RtlCheckBit(&EtGpuNodeBitMap, gpuAdapter->FirstNodeIndex + j))
					{
						totalRunningTime += queryStatistics.QueryResult.NodeInformation.GlobalInformation.RunningTime.QuadPart;
						systemRunningTime += queryStatistics.QueryResult.NodeInformation.SystemInformation.RunningTime.QuadPart;
					}
				}
			}
		}
	}

	if (Block)
	{
		PhUpdateDelta(&Block->GpuRunningTimeDelta, totalRunningTime);
	}
	else
	{
		LARGE_INTEGER performanceCounter;

		NtQueryPerformanceCounter(&performanceCounter, &EtClockTotalRunningTimeFrequency);
		PhUpdateDelta(&EtClockTotalRunningTimeDelta, performanceCounter.QuadPart);
		PhUpdateDelta(&EtGpuTotalRunningTimeDelta, totalRunningTime);
		PhUpdateDelta(&EtGpuSystemRunningTimeDelta, systemRunningTime);
	}
}