the inventive mechanism provides fast profiling and effective trace selection . the inventive mechanism partitions the work between hardware and software . the hardware automatically detects which code is executed very frequently , e . g . which code is hot code . the hardware also maintains the branch history information . when the hardware determines that a section or block of code is hot code , the hardware sends a signal to the software . the software then forms the trace from the hot code , and uses the branch history information in making branch predictions .