1. A dynamic binary rewriter (DBR) framework comprising: a hardware performance monitor contained within a processor, the hardware performance monitor sampling one or more client processes; a DBR service, the DBR service executing as a separate process, the DBR service configured to: aggregate samples from the hardware performance monitor; perform region selection to identify a frequently executed code section in the one or more client processes; optimize the selected region; and generate replacement code for the selected region, wherein the replacement code is functionally equivalent to original code of the selected region; and a DBR agent, the DBR agent executing within the one or more client processes, the DBR agent patching the one or more client processes to use the replacement code.