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



from ANNarchy.core import Global
from .ProfileGenerator import ProfileGenerator
from .ProfileTemplate import papi_profile_template, papi_profile_header
#
#     You should have received a copy of the GNU General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#===============================================================================


class PAPIProfile(ProfileGenerator):
    """
    Extent the generated code by profiling annotations.
    """
    def __init__(self, annarchy_dir, net_id):
        ProfileGenerator.__init__(self, annarchy_dir, net_id)

    def generate(self):
        """
        Generate Profiling class code, called from Generator instance.
        """
        # Generate header for profiling
        with open(self.annarchy_dir+'/generate/net'+str(self._net_id)+'/Profiling.h', 'w') as ofile:
            ofile.write(self._generate_header())

    def generate_body_dict(self):
        """
        Creates a dictionary, contain profile code snippets.
        """
        body_dict = {
            'prof_include': papi_profile_template['include'],
            'prof_step_pre': papi_profile_template['step_pre'],
            'prof_step_post': papi_profile_template['step_post'],

# 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

#
#     You should have received a copy of the GNU General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#===============================================================================


class PAPIProfile(ProfileGenerator):
    """
    Extent the generated code by profiling annotations.
    """
    def __init__(self, annarchy_dir, net_id):
        ProfileGenerator.__init__(self, annarchy_dir, net_id)

    def generate(self):
        """
        Generate Profiling class code, called from Generator instance.
        """
        # Generate header for profiling
        with open(self.annarchy_dir+'/generate/net'+str(self._net_id)+'/Profiling.h', 'w') as ofile:
            ofile.write(self._generate_header())

    def generate_body_dict(self):
        """
        Creates a dictionary, contain profile code snippets.
        """
        body_dict = {
            'prof_include': papi_profile_template['include'],
            'prof_step_pre': papi_profile_template['step_pre'],
            'prof_step_post': papi_profile_template['step_post'],

            'prof_run_pre': papi_profile_template['run_pre'],