timeGetTime versus GetTickCount

I have a confession to make – I only just found out the difference between the Windows functions GetTickCount and timeGetTime.

I know what you’re thinking – I’m a game developer and I should know better than that. But I didn’t. And I’m sorry.

Continue reading

Posted in Investigative Reporting, Performance, Programming | Tagged , | 1 Comment

Energy Drinks: With None Of That Pesky Energy

Is it just me, or is it weird (and misleading) to have energy drinks that brag about how little energy they contain?

Continue reading

Posted in Drinks | Tagged , , | 5 Comments

Xperf for Excess CPU Consumption: WPA edition

Last year I wrote an article about how to use xperf to analyze a CPU bound program, using the xperfview UI. Since then the wpa UI has come out and replaced xperfview. This updated version of the article explains how to do the same analysis steps using wpa.

It’s an encouraging sign that this article is shorter and simpler than the original.

Continue reading

Posted in xperf | Tagged , , , | 4 Comments

Xperf Basics: Recording a Trace (the easy way)

Some time ago I wrote a long and detailed post about how to record traces using xperf. The steps needed to record a trace were daunting. However more recent versions of the Windows Performance Toolkit (WPT, the proper name for the xperf suite of tools) have made it a lot easier.

Continue reading

Posted in Performance, xperf | Tagged , , , | 13 Comments

Python Debugger Update

Many years and two jobs ago the company I was working for decided to use Python for game development – I talked about our experiences at the Game Developers Conference in 2002. We felt that the available Python debuggers (most of them in-process and prone to hanging) were inadequate, so we created our own, and open sourced it.

At my current job we use a lot of Python so I dusted off the debugger and updated the open source version. The updated version is up on source forge.

Continue reading

Posted in Programming | Tagged , , , | 3 Comments

Techniques for Zooming in Xperf Trace Viewers

Exploring an xperf trace involves a lot of zooming in. And zooming out. Zooming in to look at a problem area, then zooming out to see the context. Wash, rinse, repeat.

Zooming in is often done by selecting a region of interest and then using the context menu to zoom to that time range, but zooming out is less obvious. The two most convenient ways to zoom out are undocumented and undiscoverable.

Continue reading

Posted in xperf | Tagged , , , | 1 Comment

Stop using strncpy already!

I keep running into code that uses strcpy, sprintf, strncpy, _snprintf (Microsoft only), wcsncpy, swprintf, and morally equivalent functions. Please stop. There are alternatives which are far safer, and they actually require less typing.

The focus of this post is on fixed-size string buffers, but the technique applies to any type of fixed-length buffer. If you don’t use fixed-size buffers then this post is not relevant to you. Some people do use them, sometimes for valid reasons, and this post is for them.

Continue reading

Posted in Code Reliability | Tagged , , , , | 47 Comments