ID:162532
 
I'm kind of confused as to some of the data I get from profiling my code.

The Self CPU field, is that how much CPU usage a proc itself gets from the CPU?

And then the total CPU field, is this how much of the CPU was being used by the entire server with all it's procs?

So why does each proc show a different Total CPU time?

Also what unit of measure is being used to calculate the Real time field?


Finally, what is up with some of the contradictory results I get from this? I have one proc that consistently drives my CPU crazy if I abuse it in just the right way, and I can see it on the task manager where the CPU usage spikes up to about 90%. And yet when I go to profile the code, the proc is showing 0.047% self cpu usage, and about 6% total CPU usage. However, this proc's purpose is entirely graphical in nature. Is it possible the proc pretty much only sees a performance problem client-side, and a headless server will handle it's computation pretty well?

Also what is the average box supposed to tell me, the average amount of CPU usage per proc instance? Seems kind of useless because everything simpy comes out to 0.000
Obs wrote:
I'm kind of confused as to some of the data I get from profiling my code.

The Self CPU field, is that how much CPU usage a proc itself gets from the CPU?

It's how much time the proc takes to run, in seconds.

And then the total CPU field, is this how much of the CPU was being used by the entire server with all it's procs?

No, it's how much time was taken by the proc and all other procs it called.

Also what unit of measure is being used to calculate the Real time field?

The same as the others: seconds.

Finally, what is up with some of the contradictory results I get from this? I have one proc that consistently drives my CPU crazy if I abuse it in just the right way, and I can see it on the task manager where the CPU usage spikes up to about 90%. And yet when I go to profile the code, the proc is showing 0.047% self cpu usage, and about 6% total CPU usage. However, this proc's purpose is entirely graphical in nature. Is it possible the proc pretty much only sees a performance problem client-side, and a headless server will handle it's computation pretty well?

In the profiler you're looking at seconds, not percentage. That means the proc took, in total, about 6 seconds to execute when you factor in all the procs it called in turn.

Also what is the average box supposed to tell me, the average amount of CPU usage per proc instance? Seems kind of useless because everything simpy comes out to 0.000

By this point it should be clear that's average time per call. You get the same figure by dividing the time by the number of calls.

Lummox JR
In response to Lummox JR
There is no way this can all be correct...

If a proc is giving me a realtime of 1772526848 seconds, that's about 56 years.

There is no way the proc took 56 years to execute.

TotalCPU and Self CPU could possibly be seconds, but I'm still skeptical because of the above. Is there a documentation for the profiler?
In response to Obs
The profiler counts spawned() off procedures. Real Time also includes time spent sleep()ing. For example:

mob/verb/test()
for(var/v = 1 to 10000)
spawn() something()

proc/something()
sleep(100)


This takes, in reality, a little over 10 seconds to run. However, the Real Time is over 100,000.
In response to Garthor
So how could I accurately profile procedures with a lot of spawning and sleeping?
In response to Obs
Self CPU tells you how many seconds the proc is taking, Total CPU tells you how many seconds the proc and all the procs it calls are taking, Real Time is the same as Total CPU, but it includes any sleep()s.
In response to Obs
Obs wrote:
There is no way this can all be correct...

If a proc is giving me a realtime of 1772526848 seconds, that's about 56 years.

There is no way the proc took 56 years to execute.

TotalCPU and Self CPU could possibly be seconds, but I'm still skeptical because of the above. Is there a documentation for the profiler?

That long time you see is an anomaly; it's an error, not a real value. Sometimes realtime can't be measured and that's what you see as a result. I do not yet know why.

Lummox JR