Guus
Guus

Reputation: 51

c# 80% Cpu at once. Can't find where the bug is / (on a game server with 250 online)

Hello I made a game server in c# for a big online game. The only problem is that I get sometimes out of no where 90% cpu usage.

It also got stuck on that 90% when the bug is there it stays on the 90% for ever..

So my question is how can I find the code failure on a simple way because the server is huge. Are there any .net profilers good foor or something like that?

Upvotes: 1

Views: 195

Answers (1)

Blindy
Blindy

Reputation: 67489

It also got stuck on that 90% when the bug is there it stays on the 90% for ever

That's awesome! You just got handed the holy grail right there my friend!

Simply attach a debugger when it gets in that state and break. Chances are you'll break in the buggy code, if not keep running and breaking. You should get there really quick if it's using 90% of your CPU.

Alternatively run it through VS's profiler and zoom the graph in only the zone with extremely high sustained CPU usage, you'll get a list of functions that use the most time (assuming it's a CPU bound issue, if it's I/O I don't think it will show).

Upvotes: 1

Related Questions