# Path: ANNarchy/generator/Profile/ProfileTemplate.py



from ANNarchy.core import Global
from .ProfileGenerator import ProfileGenerator
from .ProfileTemplate import papi_profile_template, papi_profile_header
        annotate the update neuron code
        """
        prof_begin = papi_profile_template['update_neuron']['before'] % {'name': pop.name}
        prof_end = papi_profile_template['update_neuron']['after'] % {'name': pop.name}

        prof_code = """
        // first run, measuring average time
        %(prof_begin)s
%(code)s
        %(prof_end)s
""" % {'code': code,
       'prof_begin': prof_begin,
       'prof_end': prof_end
       }
        return prof_code

    def _generate_header(self):
        """
        generate Profiling.h
        """
        config_xml = """
        _out_file << "  <config>" << std::endl;
        _out_file << "    <paradigm>%(paradigm)s</paradigm>" << std::endl;
        _out_file << "    <num_threads>%(num_threads)s</num_threads>" << std::endl;
        _out_file << "  </config>" << std::endl;
        """ % {
            'paradigm': Global.config["paradigm"],
            'num_threads': Global.config["num_threads"]
        }
        config = Global.config["paradigm"] + '_'  + str(Global.config["num_threads"]) + 'threads'

# Path: ANNarchy/generator/Profile/ProfileTemplate.py



# Path: ANNarchy/generator/Profile/PAPIProfile.py
from ANNarchy.core import Global
from .ProfileGenerator import ProfileGenerator
from .ProfileTemplate import papi_profile_template, papi_profile_header

        annotate the update neuron code
        """
        prof_begin = papi_profile_template['update_neuron']['before'] % {'name': pop.name}
        prof_end = papi_profile_template['update_neuron']['after'] % {'name': pop.name}

        prof_code = """
        // first run, measuring average time
        %(prof_begin)s
%(code)s
        %(prof_end)s
""" % {'code': code,
       'prof_begin': prof_begin,
       'prof_end': prof_end
       }
        return prof_code

    def _generate_header(self):
        """
        generate Profiling.h
        """
        config_xml = """
        _out_file << "  <config>" << std::endl;
        _out_file << "    <paradigm>%(paradigm)s</paradigm>" << std::endl;
        _out_file << "    <num_threads>%(num_threads)s</num_threads>" << std::endl;
        _out_file << "  </config>" << std::endl;
        """ % {
            'paradigm': Global.config["paradigm"],
            'num_threads': Global.config["num_threads"]
        }
        config = Global.config["paradigm"] + '_'  + str(Global.config["num_threads"]) + 'threads'

        return papi_profile_header % {