Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423109

Yay, performance monitoring

Sign in to follow this  
Evil Steve

122 views

Well it turns out that Telewest aren't coming till next Tuesday; my dad got the installation date wrong. So I got some proper sleep, then got coffee'd up, and got some coding done. And also, my bed is due to arrive on Friday. Yay!

So, I did a bit of work on the MMORPG client program for a change (not the editor). I changed my CD3DDevice class a little, so it buffers render states, and also allows you to chain up states like a stack. For example, to turn on alpha blending, draw something alpha blended, then put alpha blending back to it's original state, you use this code:
void Foo()
{
RenderState theState(D3DRS_ALPHABLENDENABLE,TRUE);

// Drawing code here
}
That's it. When the RenderState goes out of scope, it tells the device to put the state back to what it was. The constructor stores the current state (set by the device).

I also altered my Log() and DebugLog() function a little. Log() now gets the current directory when it's first called, so fopen() (Yes, C file I/O, I'm a horrible person) doesn't try to create "Log.txt" in a different directory if you change the current directory.
DebugLog() now checks the global variable g_bDebug, and calls Log() if it's true.

And I added real command line parsing. So a release mode app can be run with the -debug flag to enable extra logging information.

And, saving the best till last, I added a bunch of fun assembly instuctions and some Win32 functions to log the CPU speed and name, amount of RAM used and availiable and the OS. Because I intend to use sprite sheets a lot, I need to determine the best size for them. I was using the cards maximum texture size before, but I realised last night that that means my GeForce 4 with 128Mb of RAM is allocating 64MB textures. Which can't be a good thing.
So, I now check the amount of availaible texture memory, and use that as a best guess of how large to make the textures. If the ideal size is larger than the supported size, obviously it falls back to the largest supported size.
So now, when I run my app, I get all this fun stuff spewed out:
MAIN  : Application started at 20:58:26 on 20/09/2005
MAIN : Parsing comand line: ""
MAIN : Command line parsing complete
PERF : CPU ID: AMD Athlon(tm) XP 2600+ (AuthenticAMD)
PERF : CPU Features: FPU MMX 3DNow! Ex3DNow! SSE
PERF : CPU speed: ~1916MHz
PERF : Physical RAM: 192MB/511MB
PERF : OS: Windows 2000 Service Pack 4
RENDER: Creating D3D9 object... Done
RENDER: Listing 2 device adapters:
RENDER: * Adapter index 0 is called "NVIDIA Dualview"
RENDER: * Adapter index 1 is called "NVIDIA GeForce4 Ti 4400"
RENDER: Requesting device caps... Done
RENDER: Maximum texture size is 4096x4096
RENDER: Choosing backbuffer format... D3DFMT_X8R8G8B8
RENDER: Choosing texture format... D3DFMT_A8R8G8B8
RENDER: Choosing depth-stencil format... D3DFMT_D24S8
RENDER: Creating device... Done
MAIN : Render device reports ~226MB free for textures
MAIN : Chose texture size of 2048x2048 based on availiable video memory
RENDER: Shutting down D3D device... Done
PERF : Approximate FPS: 324.90
MAIN : Application shutting down at 20:58:33 on 20/09/2005
Isn't that exciting? And here's what you get without -debug (It's hard-coded just now, just so my friends don't need to run it with -debug when they test it):
MAIN  : Application started at 20:58:26 on 20/09/2005
MAIN : Parsing comand line: ""
MAIN : Command line parsing complete
MAIN : Chose texture size of 2048x2048 based on availiable video memory
MAIN : Application shutting down at 20:58:33 on 20/09/2005
Hooray!

I probably won't get much done tomorrow. I'm supposed to be meeting up with my friend (the one mentioned in my previous two entries). I picked her up from Rosyth (Fife) earlier tonight, and we were going to watch a bit of a [music] DVD here, then I was going to drop her off at her friends. But she had to be at her friends for 9ish, and we didn't get back to mine till 8:45, so we agreed to meet up tomorrow instead, and I dropped her of at her friends.
However, going by her track record, I might not meet her tomorrow at all, so we'll see.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!