Jump to content

View more

Image of the Day

I've done more tweaks to my color palette selector. #gamedev #screenshotsaturday #madewithunity https://t.co/aJXrC4ruRg
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[java] thread usage monitor

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 Hitman   Members   

122
Like
Likes
Like

Posted 02 June 2000 - 05:30 AM

I am developing a multi-threaded game server. I would like to be able to monitor the amount of time that the server is idle. Anyone have any ideas on a good way of implementing this without noticeably affecting the performance of the server? Hitman

#2 Moe   Members   

1256
Like
Likes
Like

Posted 02 June 2000 - 06:32 AM

i don''t know if i can help any but,

couldn''t you check how many users are on the server every 5 minutes (or so). then, if there is no-one on the server get the system time. if the player check says that there are some players on the server, then get the system time again and subtract the later time from the first time. it would only be accurate to 4 minutes in 59 seconds, but not that it is that necessary (or is it?)

#3 Hitman   Members   

122
Like
Likes
Like

Posted 03 June 2000 - 04:18 AM

I guess I should have been a little more clear. This is not going to be a connection oriented server. it will be mor like a web server (at least in the way it handles connections. A client will make a connection, the server will start a thread, process the request, then the connection will be dropped. All of this will only take milliseconds. What I want to know is how much of the servers time is sitting idle, and how m uch is taken up by these different threads. The only way I can figure to do this is to make an OS call, but of course then I lose my platform independence. Can anyone think of a purely java way of doing this?

Hitman

#4 Jim_Ross   Members   

122
Like
Likes
Like

Posted 04 June 2000 - 05:08 AM

If you use a resource pool for your threads it should be easy to have a class that reports on the usage of threads. Everytime a thread is requested, mark it with a current time, then check it on its return.

#5 Hitman   Members   

122
Like
Likes
Like

Posted 04 June 2000 - 11:55 AM

quote:
Original post by Jim_Ross

If you use a resource pool for your threads it should be easy to have a class that reports on the usage of threads. Everytime a thread is requested, mark it with a current time, then check it on its return.


Hmmm....now why didn''t I think of that. I already have a resource pool to save having to new a thread everytime you need one. It should be straight forward to modify the checkin/checkout method to also keep track of time.

Thanks again,
Hitman




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.