Wendy Gibbons wrote:I guess as nobody has commented in 5 days the answer is no, nobody else cares
![]()
Paul Clapham wrote:There is no way to know whether the delay between your code asking for bytes and your code receiving bytes is caused by the operating system waiting to receive bytes for your code, or by the operating system paging out your code, or by the operating system delaying your code because it's serving a higher-priority thread, or any number of other reasons I haven't thought of.
Paul Clapham wrote:
Jiafan Zhou wrote:I don't totally agree with this. Usually the network read from the socket could be slow itself if reading from a large byte streams. I want to know what percentage of the idle item is occupied in the total read.
And since I don't know how long is the idle time, the idle time could be long as well. I want to know how long is the idle time and want to find out what and where generates this idle time.
Why would the length of the stream being read affect the idle time in any way?
As for what generates the idle time, it's the operating system waiting for packets to come over a network connection. It doesn't look like you really understand the relative speeds of computers versus networks, so you ought to get out your pencil and do a bit of arithmetic. How fast is your computer? Let's suppose you have a 4GB machine -- that means it does 4 billion operations per second. And how fast is your network? Let's suppose you have a 10MB network -- that means it transmits 10 million bytes per second. Think about this for a while so you get some idea of what's important and what's trivial.
Henry Wong wrote:
Jiafan Zhou wrote:Plus I don't think the (end - start) is the idle time, but it also includes the time of the actual read.
True, but keep in mind that the actual operation should be relatively fast compared to the idle time.
If this is *not* the case, then this measurement would serve little purpose.... ie. what would be the purpose of knowing that you have 10ms of idle time for an operation that takes a second? If the network / operating system is keeping up, meaning no queuing up somewhere, there isn't really a problem.
Rob Spoor wrote:You can use System.currentTimeMillis(). In pseudo code:
To get the idle time between each byte you would need non-buffered (so no BufferedInputStream) single byte reads using the read() method.
Rob Spoor wrote:You can use System.currentTimeMillis(). In pseudo code:
To get the idle time between each byte you would need non-buffered (so no BufferedInputStream) single byte reads using the read() method.