http://graphics.stanford.edu/~mdfisher/GPUView.html

安装包位置:包含在windows sdk内

You can download GPUView as part of the Windows 7 SDK. After installing the SDK you will need to go to C:\Program Files\Microsoft SDKs\Windows\v7.0\bin and run either wpt_x64.msi or wpt_x86.msi. This will install the Windows Performance Toolkit which contains GPUView.

以下是优化4k采集卡时的一些经验。

1. 使用log.cmd 文件启动抓包,根据参数可以抓取不同的等级的记录,一般使用轻量级的抓包即可。结束时同样运行此文件。

2. capture render内进行lockrect 和 updatesurface均会触发dx内的lock操作,由内核 ->dxruntime->内核。updatesurface会连续触发两次lock行为。

3. gpuview会记录 系统的整体运行状况,包括:所有进程内的线程行为,大部分是与d3d资源相关的操作,不相关的行为会被忽略。

4. 一般会在数据更新线程和渲染线程内执行d3d相关行为,如何做好这两部分优化,会影响整体程序的渲染行为。

5. 渲染线程会将数据提交到graphic的cpu queue内等待被执行,queue内的buffer最好在下次执行渲染时处理完,否则会发生数据包堆积,影响后续处理。gpu的hardware queue内的堆积一般不会太高。

6. 启用vsync可以辅助查看渲染和更新的间隔gpuview 使用经验

7. cpu queue内的堆积gpuview 使用经验

8. 驱动线程一般会运行在system进程下面,系统内核驱动线程运行在这个下面,本次调试采集卡某些线程出现了会出现较高的cpu占用。

9. 采集卡的更新线程一般会在ksproxy.ax内调用,注意相连的更新时间间隔

10. cpu一般会在idle进程中显示不同核的运行状态,每个核均有自己的颜色辨别。若此段为空白,则cpu正被其他任务占用。

gpuview 使用经验

11. 线程执行时均标有线程的优先级,下图就是15。

此外我们还可以设置进程的优先级,线程优先级,指定线程使用特定的cpu核。

DWORD dwRet = GetPriorityClass(GetCurrentProcess());
     BOOL bRet = SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
     DWORD dwThreadPriority;
     dwThreadPriority = GetThreadPriority(GetCurrentThread());
     if (dwThreadPriority != THREAD_BASE_PRIORITY_MIN) {
         SetThreadPriority(GetCurrentThread(), THREAD_BASE_PRIORITY_MIN);
     }
     SetThreadAffinityMask(GetCurrentThread(), dwCpuPaire[m_iCurrentIndex%12]);*/
    DWORD dwThreadPriority;
    dwThreadPriority = GetThreadPriority(GetCurrentThread());
    if (dwThreadPriority != THREAD_BASE_PRIORITY_LOWRT) {
        SetThreadPriority(GetCurrentThread(), THREAD_BASE_PRIORITY_LOWRT);
    }gpuview 使用经验

12. event list可以帮助我们指定线程id,查看特定的事件,有好多不同的过滤条件,起始、结束时间等等。

gpuview 使用经验

相关文章: