/usr/bin/pomp2-parse-init-regions.awk is in libpomp2-dev 1.0.7+dfsg-6+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | #!/usr/bin/mawk -f
##
## This file is part of the Score-P software (http://www.score-p.org)
##
## Copyright (c) 2009-2011,
## RWTH Aachen University, Germany
## Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
## Technische Universitaet Dresden, Germany
## University of Oregon, Eugene, USA
## Forschungszentrum Juelich GmbH, Germany
## German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
## Technische Universitaet Muenchen, Germany
##
## See the COPYING file in the package base directory for details.
##
#
# pomp2_parse_init_regions.awk
#
# Expects the output of
# $(NM) $ALL_OBJS_AND_LIBS | $(GREP) -i POMP2_Init_reg | $(GREP) " [TD] "
# as input. See <prefix/share/opari/doc/example/Makefile> for a working
# example.
#
# The output is C-code that needs to be linked to your application. It
# provides several functions:
#
# void POMP2_Init_regions(): need to be called from your POMP2 library to
# initialize all instrumented POMP2 region by calling the instrumented
# functions POMP2_Init_reg_*.
#
# size_t POMP2_Get_num_regions() returns the number of POMP2 regions found
# in $ALL_OBJS_AND_LIBS.
#
# const char* POMP2_Get_opari2_version() returns a version string.
#
# Three functions returning int and specifying the library interface version:
# int POMP2_Get_required_pomp2_library_version_(current|revision|age)()
#
# Author: Christian Roessel <c.roessel@fz-juelich.de>
#
/_[0-9a-z][0-9a-z]*_[0-9][0-9]*_?_?$/ {
if (tolower($0) ~ /pomp2_init_reg/ && $0 ~ /[TDA]/ )
{
for (i = 1; i <= NF; i++)
{
if (index($i,"POMP2_Init_reg") != 0)
{
separator = "POMP2_Init_reg";
}
else if (index($i,"pomp2_init_reg") != 0)
{
separator = "pomp2_init_reg";
}
else if (index($i,"POMP2_INIT_REG") != 0)
{
separator = "POMP2_INIT_REG";
}
else
{
continue;
}
# $i looks like "POMP2_Init_reg_uniqueId_nRegions" or
# like "pomp2_init_reg_uniqueId_nRegions" or
# like "POMP2_INIT_REG_uniqueId_nRegions"
split ($i,splitResult,separator);
_uniqueId_nRegions = splitResult[2];
if (!(_uniqueId_nRegions in regions))
{
regions[_uniqueId_nRegions] = $i;
split(_uniqueId_nRegions, tokens, "_");
nRegions += tokens[3];
}
}
}
}
END{
print tmp "\n"
print "#ifdef __cplusplus"
print "extern \"C\""
print "{"
print "#endif"
print "#include <stddef.h>\n"
# cut away leading full-stops
for (i in regions)
{
sub(/^\./, "", regions[i]);
}
# declare POMP2_Init_reg_* functions extern
for (i in regions)
{
print "extern void " regions[i] "();";
}
# define POMP2_Init_regions() and call all POMP2_Init_reg_* functions
print "\nvoid POMP2_Init_regions()"
print "{"
for (i in regions)
{
print " " regions[i] "();";
}
print "}\n"
# define function POMP2_Get_num_regions()
print "size_t POMP2_Get_num_regions()"
print "{"
if (nRegions != 0)
{
print " return " nRegions ";"
} else {
print " return 0;"
}
print "}\n"
# define function POMP2_Get_opari2_version()
print "const char* POMP2_Get_opari2_version()"
print "{"
print " return \"1.0.7\";"
print "}\n"
print "/* "
print " * The following functions define the POMP2 library interface version"
print " * the instrumented code conforms with. The library interface version"
print " * is modeled after"
print " * https://www.gnu.org/software/libtool/manual/libtool.html#Versioning"
print " */\n"
# define function POMP2_Get_required_pomp2_library_version_current()
print "int POMP2_Get_required_pomp2_library_version_current()"
print "{"
print " return 1;"
print "}\n"
# define function POMP2_Get_required_pomp2_library_version_revision()
print "int POMP2_Get_required_pomp2_library_version_revision()"
print "{"
print " return 0;"
print "}\n"
# define function POMP2_Get_required_pomp2_library_version_age()
print "int POMP2_Get_required_pomp2_library_version_age()"
print "{"
print " return 0;"
print "}\n"
print "#ifdef __cplusplus"
print "}"
print "#endif"
}
|