A general-purpose, low-overhead, customizable performance monitoring library with support for hardware performance counters