Have you ever thought about this dynamic management view: sys.dm_exec_query_optimizer_info
Books online gives a very basic information:
Returns detailed statistics about the operation of the SQL Server query optimizer. You can use this view when tuning a workload to identify query optimization problems or improvements. For example, you can use the total number of optimizations, the elapsed time value, and the final cost value to compare the query optimizations of the current workload and any changes observed during the tuning process. Some counters provide data that is relevant only for SQL Server internal diagnostic use. These counters are marked as "Internal only."
Just got this nice post from Ben Nevarez! It explains not only the the phases of query optimization, but also about how the DMV works!
Have a look!