Havok_2014-1-0_Pc_Xs_User_Guide(1.5.7-计时器)
来源:互联网 发布:易语言和java 编辑:程序博客网 时间:2024/06/03 13:46
计时器
为了收集计时器还有一些其他的事情要做。如果你想收集计时器并在VDB中显示它们,每个线程或SPU必须分配一个缓冲区给它来收集这些计时器。
{
...
// Allocate timer buffer for this thread(200K)
hkMonitorStream::getInstance().resize(200000);
// Create thread pool and job queue
// Specify that the thread pool shouldallocate buffers per thread for timer collection
hkCpuThreadPoolCinfo threadPoolCinfo;
threadPoolCinfo.m_timerBufferPerThreadAllocation= 200000;
hkThreadPool* threadPool = new hkCpuThreadPool( threadPoolCinfo );
// Create a physics world and register withqueue.
hkJobQueue jobQueue;
hkpWorld* physicsWorld = new hkpWorld(worldCinfo);
physicsWorld->registerWithJobQueue(&jobQueue );
// Setup the visual debugger. Just showingthe first line of this setup code,
// see ConsoleExampleMt demo for theremaining code to setup the VDB
hkpPhysicsContext* context = newhkpPhysicsContext();
while( simulating )
{
// Step the world using this thread, andall the threads or SPUs in the thread pool
physicsWorld->stepMultithreaded(&jobQueue, threadPool, timestep );
// Copy timer information from the threadpool to the VDB context, so it can be viewed by the
VDB
// This function also copies the timersfrom this thread.
context->syncTimers( threadPool );
vdb->step();
// After the VDB has been stepped, reset the timer streams in this thread and in the threads of
the thread pool
hkMonitorStream::getInstance().reset();
threadPool->clearTimerData();
}
}
为了从所有的线程收集计时器需要使用上面的代码片段。你必须确保空间是分配给计时器缓冲区,用VDB上下文同步的每一帧,VDB步之后重置。如果你这样做你将能够在VDB中以各种形式查看计时器信息,每个线程的基础上。注意,这段代码在CPU和SPU线程池都是相同的。如果使用SPU线程池,线程池类负责管理SPU的缓冲区和同步主内存。
1.5.7.1 在VDB中查看计时器
为了启用Havok性能监视器,首先打开Statistics Viewer(通过Viewers->Statistics菜单项),然后启用Stat Graph Overlay(通过View->Render State->Stat Graph Overlay
菜单项)。为了看到文本版本的性能监控,启用Perf Stats Summary从Windows菜单或Windows工具栏的'T'图标。一般来说,绿色代表集成, 蓝色代表碰撞检测,红色代表Stats Graph Overlay(统计图叠加)等。对于具体的细节将鼠标悬停在统计图叠加窗口。
- Havok_2014-1-0_Pc_Xs_User_Guide(1.5.7-计时器)
- Havok_2014-1-0_Pc_Xs_User_Guide(目录)
- Havok_2014-1-0_Pc_Xs_User_Guide(1.1.1-简介)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.3.1-碰撞过滤)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.5.1-Character Control)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.2.1-创建一个Physics2012对象)
- Havok_2014-1-0_Pc_Xs_User_Guide(1.1.2-基础系统)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.5.3-保存接触点)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.3.2-一般监听器)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.3.3-碰撞监听器)
- Havok_2014-1-0_Pc_Xs_User_Guide(3.1-Havok动画简介)
- Havok_2014-1-0_Pc_Xs_User_Guide(2.2.2-模拟仿真一个Physics2012世界)
- Havok_2014-1-0_Pc_Xs_Quickstart_Guide
- 7-1 Verilog 计时器
- vegas9.0合成计时器
- Windows学习心得【计时器1】
- C++-1、计时器
- VB-计时器程序设计1
- iOS不同传值方法的分享
- JSTL简单入门学习实例
- Linux中fork()函数知识详解
- java实现最小长方形, 判断一个数字中是否包含两个相同的子串, 取石子游戏.
- 内核通知链原理及机制
- Havok_2014-1-0_Pc_Xs_User_Guide(1.5.7-计时器)
- HDU 4265(Science!-二分网络流)
- hdu5387 Clock
- 键盘输入问题:输入错误左移一位,求原来输入的串
- Http的连接方式之HttpUrlConnection
- HDOJ 2048 神、上帝以及老天爷(错排公式)
- Bibtex 如何cite 不同格式
- leetcode 122: Best Time to Buy and Sell Stock II
- 高仿知乎日报(二)