To calculate the expected profit for choosing to run a miner/algo, autominer uses the formula: $profit = $price * $hashrate.
For $price, nicehash has this api
http://api.nicehash.com/api?method=stats.global.currentwhich reports the average price paid for each algorithm. Their api page says that the data is refreshed every 30 seconds.
autominer comes with a program called nicehash-aggregator which queries this api every 30 seconds and maintains trailing averages over the following time windows : 30 seconds, 1 minute, 5 minutes, 10 minutes, 1 hour, and 3 hours. Those trailing averages are written to disk.
When you run autominer, you can specify which trailing average to use (the default is the 10 minute average).
For $hashrate, autominer monitors the performance of the miner while it's running, and uses the average reported over the last 10 minutes in which that miner was run. The performance of the miner is typically determined by examining stdout (e.g. ccminer), but it varies by miner. For example, for sgminer, you have to query its local api (which is done every 10 seconds).
Periodically, autominer recalculates the expected profit of every miner/algo that it knows about, and selects the most profitable option. By default this happens every 5 minutes. If the new selection is different from the current selection, it stops the current miner, and launches a new miner.