Wednesday, August 30, 2017

VBoxClient high CPU usage issue



Having virtualbox version 5.0.6 r103037 I've faced with high CPU usage issue by VirtualBox instance with Ubuntu 14.04.

I've checked the CPU usage by top command and found that most of CPU periodically was used by
/usr/bin/VBoxClient --draganddrop. This process wasn't in the top of the list constantly, it appeared in the top periodically, kind of every second second for a while. However, due to this behavior CPU was very hot and I didn't like the noise of the coolers, besides it undermined the overall performance of the system.

I've looked for solution on different forums, stackoverflow and most of them claimed that this should be the issue with disabled HardwareAcceleration, but it was enabled in my case. Some people said that their problem was solved by reinstalling VboxGuestAdditions, but it didn't look like the case.

Then I've found article https://www.virtualbox.org/wiki/DnDDebug which described the problems with DragAndDrop feature. After that I decided simply to turn it off and look whether something would change:



To my surprise /usr/bin/VBoxClient --draganddrop process immediately stopped consuming a lot of CPU and issue was fixed.








Monday, August 28, 2017

Useful linux commands

Grep files with specified extension in directory recursively:
grep -R --include \*.h --include \*.cpp "Bar::foo()" ~/repo/

Display size of files/directories in current directory including hidden files and sort them by size increasing:
find . -maxdepth 1 -exec du -sh "{}" \; | sort -h

Update existing symbolic link path:
ln -sfn <directory_or_file> <symbolic_link>

Print only list of files in current directory and sort them by name:
ls -p | grep -v / | sort

Monitor virtual memory usage:
watch -n 5 free -m

Redirect to stderr and stdout to file:
./application  &>file


Run command multiple times:

for i in {1..10}; do command; done
Checkout changed files
 
git diff --name-only HEAD~ | xargs git checkout HEAD~ --