# Limit CPU usage when building ports?



## bigtoque (Sep 12, 2011)

I'm updating Libreoffice, Firefox, and Thunderbird right now and it takes a LONG time to compile all of them. Unfortunately, when they are building, my system becomes somewhat unresponsive. 

Is it possible to limit CPU usage when building a port?


----------



## wblock@ (Sep 12, 2011)

You're not building them all at the same time, are you?

If you're using a terminal with antialiasing, try running the build in a disconnected sysutils/tmux session.  Antialiasing all that scrolling text can really slow down interactive response.


----------



## bigtoque (Sep 12, 2011)

After updating my ports tree, those were the only three that were out of date, so I just opened up a new terminal window (urxvt) and typed 
	
	



```
portupgrade -a
```


----------



## DutchDaemon (Sep 12, 2011)

Prefix command with [cmd=]nice -n 20[/cmd] and get it off your screen as much as possible, as  wblock said.


----------



## fonz (Sep 12, 2011)

bigtoque said:
			
		

> Is it possible to limit CPU usage when building a port?


Perhaps you mean this: login.conf(5)

Fonz


----------



## swallowtail_butterfly (Sep 12, 2011)

Unresponsive? My guess, it's either write bursts or memory thrashing during linking. So, try using IO scheduler (zio or gsched) to force system write *often* but in small amounts or tune VM to not swap out interactive apps.


----------



## jb_fvwm2 (Sep 12, 2011)

You can generally check how many dependencies there are for a port, then build smaller ones concurrently, or large ones sequentially.  Then, no worries about running out of time, one can have, say, thunderbird building in an xterm, 
	
	



```
killall -HUP Xorg
```
 to exit X, and either restart the build where it left off the next time one is in an xterm, or finish it at the console thusly 
	
	



```
cd /usr/ports/mail/thunderbird && make build
```
 (using some of the port upgrade tools will start the build anew though.)  sysutils/ttyload can notify you visually when
CPU usage is down enough to start other ports concurrently... possibly. (Assumes the browser you may be using during the builds does not itself use
a lot of CPU. )


----------

