[MUD-Dev] Re: TECH: Distributed Muds

Kwon Ekstrom justice at softhome.net
Thu May 3 09:23:42 New Zealand Standard Time 2001


From: "Bruce" <bruce at puremagic.com>

> Another approach here, and one that I'm working on employing myself,
> is the use of things like CLOCK_PROCESS_CPUTIME_ID and
> CLOCK_THREAD_CPUTIME_ID with clock_gettime(), if your OS supports
> these things.  Linux with glibc 2.2 (not sure if there is a kernel

> I'm tying that into the task accounting code that is being added to
> Cold to help with monitoring what's going on at a much lower level
> within the driver.  (Think top-for-Cold.)  This'll likely be in the
> next Genesis release, whenever that happens.

> I don't know what type of info like this is available within Java
> (which is what you're using?), but for those of us in C/C++ or
> languages that interface cleanly with those, it is nice.

I don't know of a java equiv to either of these, although for OS's
that support it, you could feasibly write native code to handle it.  I
just checked the API, and I couldn't find a reference to CPU time,
what I've been doing is assigning a timestamp to the start of the
thread's main loop and allowing that to be retrieved for reference.
Should be accurate enough to let me know if there's a problem.

> On a related note, I haven't seen a nice way of determining the
> stack trace for a given thread.  I'd love to know how to do this.  I
> can walk a stack upwards given a jmp_buf, but what I really want to
> do here is be able to determine exactly what all of the threads in a
> running system are doing at any point in time.  This would obviously
> be platform-specific code, which is fine with me. :) Anyone done
> anything like this?

I don't know how to do this in C, with java, any exception stores the
stack trace from the line it was thrown on.  You can then output the
stack trace to a stream or a writer (I've written code to put the
trace into a string array so I can attach it to my logs for later
viewing online)

-- Kwon Ekstrom

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the MUD-Dev mailing list