开发者

Memory counter - Collision Detection Project

开发者 https://www.devze.com 2023-03-03 23:41 出处:网络
I thought I would ask the experts - see if you can help me :o) My son has written C++ code for Collision Detection using Brute Force and Octree algorithms.

I thought I would ask the experts - see if you can help me :o) My son has written C++ code for Collision Detection using Brute Force and Octree algorithms.

He has used Debug etc - and to collect stats on mem usage he has used windows & task manager - which have given him all the end results he has needed so far. The results are not yet as they were expect to be (that Octree would use more memory overall).

His tutor has suggested he checks memory once each is "initialised" and then plot at points through the test.

He was pointed in the direction of Valgrind .... but it looked uite complicated and becaus ehe has autism, he is worried that it might aff开发者_如何学运维ect his programmes :o)

Anyone suggest a simple way to grab the information on Memory if not also Frame Rate and CPU usage???

Any help gratefully received, as I know nothing so can't help him at all, except for typing this on here - as it's "social" environment he can't deal with it.

Thanks Rosalyn


For the memory leaks:

If you're on Windows, Visual C++ by Microsoft (the Express version is free) has a nice tool for debugging and is easy to setup with instructions can be found here; otherwise if you're on Linux, Valgrind is one of the standards. I have used the Visual C++ tool often and it's a nice verification that you have no memory leaks. Also, you can use it to enabled your programs to break on allocation numbers that you get from the memory leak log so it quickly points you to when and where the memory is getting assigned that leaks. Again, it's easy to implement (just a few header files and then a single function call where you want to dump the leaks at).

I have found the best way to implement the VC++ tool is to make the call to dump the memory leaks to the output window right before main returns a value. That way, you can catch the leaks of absolutely everything in your program. This works very well and I have used it for some advanced software.

For the framerate and CPU usage:

I usually use my own tools for benchmarking since they're not difficult to code once you learn the functions to call; this would usually require OS API calls, but I think Boost has that available and is cross-platform. There might be other tools out there that can track the process in the OS to get benchmarking data as well, but I'm not certain if they would be free or not.


It looks like you're running under a windows system. This isn't a programming solution, and you may have already tried it (so feel free to ignore), but if not, you should take a look at performance monitor (it's one of the tools that ships with windows). It'll let you track all sorts of useful stats about individual proceses and the system as a whole (cpu/commit size etc). It plots the results for you as a graph as the program is running and you can save the results off for future viewing.

On Windows 7, you get to it from here:

Control Panel\All Control Panel Items\Performance Information and Tools\Advanced Tools

Then Open Performance Monitor.

For older versions of windows, it used to be one of the administrative tools options.

0

精彩评论

暂无评论...
验证码 换一张
取 消