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



from ANNarchy.core import Global
from .ProfileGenerator import ProfileGenerator
from .ProfileTemplate import cuda_profile_template, cuda_profile_header

    def annotate_spike_gather(self, pop, code):
        """
        annotate the update neuron code
        """
        prof_begin = cuda_profile_template['spike_gather']['before'] % {'id': pop.id, 'name': pop.name}
        prof_end = cuda_profile_template['spike_gather']['after'] % {'id': pop.id, '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 << "  </config>" << std::endl;
        """ % {'paradigm': Global.config["paradigm"]}

        config = Global.config["paradigm"]

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



# Path: ANNarchy/generator/Profile/CUDAProfile.py
from ANNarchy.core import Global
from .ProfileGenerator import ProfileGenerator
from .ProfileTemplate import cuda_profile_template, cuda_profile_header


    def annotate_spike_gather(self, pop, code):
        """
        annotate the update neuron code
        """
        prof_begin = cuda_profile_template['spike_gather']['before'] % {'id': pop.id, 'name': pop.name}
        prof_end = cuda_profile_template['spike_gather']['after'] % {'id': pop.id, '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 << "  </config>" << std::endl;
        """ % {'paradigm': Global.config["paradigm"]}

        config = Global.config["paradigm"]

        return cuda_profile_header % {