Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


[java] thread usage monitor


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   -  Reputation: 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

Sponsor:

#2 Moe   Crossbones+   -  Reputation: 1248

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   -  Reputation: 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   -  Reputation: 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   -  Reputation: 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.



PARTNERS