database: Clean up profiling code in DatabaseBase