The output is saved in the file you redirected stdout when you started eclipse in the command line using: printf "0x%x\n" 7067)ĭo a thread dump of the java process using kill -3, as in: kill -3 6974. Here's a sample of the output that identified my cpu-hungry thread: PID LWP STIME TIME %CPUĬonvert the thread id (in my case 7067) to hex 0x1b9b (e.g. Start eclipse from the command line and redirect output to a file so we can get a thread dumpĪllow it to settle for a bit, then get a listing of the cpu usage for each thread: ps -mo 'pid lwp stime time pcpu' -C java. I'm running Ubuntu 12.10 with STS based on eclipse Juno. I realize it's not likely that anyone else has this problem, but it might be useful to post how I investigated it. I had recently added quite a bit of files to a project and had forgotten about it. Various other ways of measuring the latency exist, but the above mentioned is a simple way of getting a measurement that is precise enough to know if your audio delay is really 60 ms larger than your visual delay.I was having the same problem today, and it turned out to be an indexing thread that was occupying the CPU. Then make the program trigger the output (could be a digital I/O or in simple terms showing something on the screen) - and then measure the amount of time before you see the audio in the signal (on the oscilloscope or in the audio track of the video recording). In simpler terms, you could use an iPhone with slo-mo video recording. If you have the equipment, you could use for example an oscilloscope with a trigger input. Therefore using it to measure response times in units of milliseconds is not going to be precise at all.Ī way of measuring it would be to use an audio recorder of some sort with known low latency combined with another type of output from the computer with known low-latency. this command in itself could take a (relatively) long while to actually play the audio. It's much more accurate because it removes the overhead of the CPU management and gives you a truly accurate elapsed time.įirst off - using echo -ne '\007' to play audio is not "low-latency" audio. This is why you need a device called an Audiometer that is a purpose built piece of hardware that measures the time between the two events - sound and keypress. If we subtract the top values from the bottom, we can get pretty close to how much time elapsed. When you hear the beep, press Enter!įrom this one, we can see that there was some overhead that caused the process to account for more time. The resolution of the time utility is not granular enough to measure the time elapsed to execute each command so we assume it happened "immediately." 812s difference between when I heard the beep and pressed Enter. In the above example it shows that the latency according to the computers "stopwatch", there was a. Sample Output: When you hear the beep, press Enter! So, in order of accuracy, Real is in the ballpark, User is pretty darn close, and Sys is dead on balls accurate, as far as the CPU is concerned. Sys - this is the time spent inside the kernel and is also the actual time spent by the CPU.įor more information on this see Real, User and Sys process time statistics.User - this is the time spent in the user space outside the kernel and is the actual CPU time spent executing the task.This accounts for all processes running at the time. Real - the time start to finish of the call measured if you had a stopwatch in hand.# generate a random number between 3 and 10 for seconds to wait for beepĮcho "When you hear the beep, press Enter!" I've created a basic bash script that will prompt the user to press Enter after waiting for a beep to occur after a random period. However, you can get fairly close in bash by using the time function. To be "more accurate" you'd need to write a program that could directly access the kernel so that you could evaluate the actual time between events - the beep and the keypress. You really cannot measure the latency "through" the OS because of the overhead of queuing and managing the processes.
0 Comments
Leave a Reply. |