|
| 1 | +diff -crB --new-file VampirTrace-5.14.4/acinclude.m4 VampirTrace-5.14.4-apihooks/acinclude.m4 |
| 2 | +*** VampirTrace-5.14.4/acinclude.m4 2013-06-14 09:44:19.000000000 +0200 |
| 3 | +--- VampirTrace-5.14.4-apihooks/acinclude.m4 2016-03-12 09:35:42.863077841 +0100 |
| 4 | +*************** |
| 5 | +*** 1,3 **** |
| 6 | +--- 1,4 ---- |
| 7 | ++ m4_include(config/m4/acinclude.apihook.m4) |
| 8 | + m4_include(config/m4/acinclude.clapack.m4) |
| 9 | + m4_include(config/m4/acinclude.compinst.m4) |
| 10 | + m4_include(config/m4/acinclude.compwrap.m4) |
| 11 | +diff -crB --new-file VampirTrace-5.14.4/config/m4/acinclude.apihook.m4 VampirTrace-5.14.4-apihooks/config/m4/acinclude.apihook.m4 |
| 12 | +*** VampirTrace-5.14.4/config/m4/acinclude.apihook.m4 1970-01-01 01:00:00.000000000 +0100 |
| 13 | +--- VampirTrace-5.14.4-apihooks/config/m4/acinclude.apihook.m4 2013-03-21 14:15:54.000000000 +0100 |
| 14 | +*************** |
| 15 | +*** 0 **** |
| 16 | +--- 1,54 ---- |
| 17 | ++ AC_DEFUN([ACVT_APIHOOKS], |
| 18 | ++ [ |
| 19 | ++ have_apihooks="no" |
| 20 | ++ apihooks_error="no" |
| 21 | ++ |
| 22 | ++ APIHOOKSLIBDIR= |
| 23 | ++ APIHOOKSLIB="-lvtapihooks" |
| 24 | ++ APIHOOKSPREFIX="vt_api_hooks" |
| 25 | ++ |
| 26 | ++ |
| 27 | ++ AC_MSG_CHECKING([whether API hooks should be included]) |
| 28 | ++ |
| 29 | ++ AC_ARG_ENABLE( |
| 30 | ++ apihooks, |
| 31 | ++ AC_HELP_STRING( |
| 32 | ++ [--enable-apihooks], |
| 33 | ++ [enable support for API hooks, default: disabled]), |
| 34 | ++ [ |
| 35 | ++ have_apihooks="yes"; |
| 36 | ++ AC_MSG_RESULT([yes]) |
| 37 | ++ ], |
| 38 | ++ [ |
| 39 | ++ AC_MSG_RESULT([no]) |
| 40 | ++ ] |
| 41 | ++ |
| 42 | ++ ) |
| 43 | ++ |
| 44 | ++ AS_IF([test x"$have_apihooks" = "xyes"], |
| 45 | ++ [ |
| 46 | ++ AC_ARG_WITH(apihooks-lib-dir, |
| 47 | ++ AC_HELP_STRING([--with-apihooks-lib-dir=APIHOOKSLIBDIR], |
| 48 | ++ [give the path for API-hooks-library, default: /usr/lib]), |
| 49 | ++ [APIHOOKSLIBDIR="-L$withval/"]) |
| 50 | ++ |
| 51 | ++ AC_ARG_WITH(apihooks-lib, |
| 52 | ++ AC_HELP_STRING([--with-apihooks-lib=APIHOOKSLIB], [use given API hooks lib, default: -lvtapihooks]), |
| 53 | ++ [APIHOOKSLIB="$withval"]) |
| 54 | ++ |
| 55 | ++ AC_ARG_WITH(apihooks-prefix, |
| 56 | ++ AC_HELP_STRING([--with-apihooks-prefix=APIHOOKSPREFIX], [use given API hooks prefix, default: vt_api_hooks]), |
| 57 | ++ [APIHOOKSPREFIX="$withval"]) |
| 58 | ++ |
| 59 | ++ sav_LIBS=$LIBS |
| 60 | ++ LIBS="$LIBS $APIHOOKSLIBDIR $APIHOOKSLIB" |
| 61 | ++ |
| 62 | ++ AC_MSG_CHECKING([whether API hooks library can be found/linked (flags: $LIBS)]) |
| 63 | ++ AC_TRY_LINK([],[], |
| 64 | ++ [AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no]);apihooks_error=yes]) |
| 65 | ++ LIBS=$sav_LIBS |
| 66 | ++ ]) |
| 67 | ++ AC_SUBST(APIHOOKSLIBDIR) |
| 68 | ++ AC_SUBST(APIHOOKSLIB) |
| 69 | ++ AC_SUBST(APIHOOKSPREFIX) |
| 70 | ++ ]) |
| 71 | +diff -crB --new-file VampirTrace-5.14.4/config/m4/acinclude.conf.m4 VampirTrace-5.14.4-apihooks/config/m4/acinclude.conf.m4 |
| 72 | +*** VampirTrace-5.14.4/config/m4/acinclude.conf.m4 2013-02-18 09:45:40.000000000 +0100 |
| 73 | +--- VampirTrace-5.14.4-apihooks/config/m4/acinclude.conf.m4 2016-03-12 09:33:39.519695578 +0100 |
| 74 | +*************** |
| 75 | +*** 284,289 **** |
| 76 | +--- 284,299 ---- |
| 77 | + [answer="yes"], [answer="no"]) |
| 78 | + echo " Build Plugin Counter support: $answer" |
| 79 | + |
| 80 | ++ AS_IF([test x"$have_apihooks" = "xyes"], |
| 81 | ++ [answer="yes"], [answer="no"]) |
| 82 | ++ echo " Build API hook support: $answer" |
| 83 | ++ |
| 84 | ++ AS_IF([test x"$have_apihooks" = "xyes"], |
| 85 | ++ [ |
| 86 | ++ echo " API hooks library: $APIHOOKSLIB" |
| 87 | ++ echo " API hooks prefix : $APIHOOKSPREFIX" |
| 88 | ++ ]) |
| 89 | ++ |
| 90 | + AS_IF([test x"$have_rusage" = "xyes"], |
| 91 | + [answer="yes"], [answer="no"]) |
| 92 | + echo " Build Resource usage trace support: $answer" |
| 93 | +diff -crB --new-file VampirTrace-5.14.4/configure.ac VampirTrace-5.14.4-apihooks/configure.ac |
| 94 | +*** VampirTrace-5.14.4/configure.ac 2013-06-14 09:45:34.000000000 +0200 |
| 95 | +--- VampirTrace-5.14.4-apihooks/configure.ac 2016-03-12 09:37:05.114666702 +0100 |
| 96 | +*************** |
| 97 | +*** 341,346 **** |
| 98 | +--- 341,353 ---- |
| 99 | + AM_CONDITIONAL(AMBUILDJAVA, test x"$have_java" = "xyes") |
| 100 | + AM_CONDITIONAL(AMBUILDVTJAVA, test x"$have_java" = "xyes" -a x"$JAVA" != x) |
| 101 | + |
| 102 | ++ # Check for support for API hooks |
| 103 | ++ ACVT_CONF_TITLE([API hooks]) |
| 104 | ++ ACVT_APIHOOKS |
| 105 | ++ #these only occur if api hooks are enforced but the linking failed |
| 106 | ++ AS_IF([test x"$apihooks_error" = "xyes"], [AC_MSG_NOTICE([Error: Linking failed]); exit 1]) |
| 107 | ++ AM_CONDITIONAL(AMHAVEAPIHOOKS, test x"$have_apihooks" = "xyes") |
| 108 | ++ |
| 109 | + # Check for hardware performace counter support |
| 110 | + ACVT_CONF_TITLE([Hardware performance counter]) |
| 111 | + ACVT_METRICS |
| 112 | +diff -crB --new-file VampirTrace-5.14.4/vtlib/Makefile.am VampirTrace-5.14.4-apihooks/vtlib/Makefile.am |
| 113 | +*** VampirTrace-5.14.4/vtlib/Makefile.am 2013-03-27 10:41:00.000000000 +0100 |
| 114 | +--- VampirTrace-5.14.4-apihooks/vtlib/Makefile.am 2016-03-12 09:34:36.155411716 +0100 |
| 115 | +*************** |
| 116 | +*** 256,261 **** |
| 117 | +--- 256,269 ---- |
| 118 | + PLUGINCNTRCFLAGS = |
| 119 | + endif |
| 120 | + |
| 121 | ++ if AMHAVEAPIHOOKS |
| 122 | ++ APIHOOKSCFLAGS = -DVT_API_HOOKS_CLASS=$(APIHOOKSPREFIX) |
| 123 | ++ APIHOOKSLIBRARY = $(APIHOOKSLIBDIR) $(APIHOOKSLIB) |
| 124 | ++ else |
| 125 | ++ APIHOOKSCFLAGS = |
| 126 | ++ APIHOOKSLIBRARY = |
| 127 | ++ endif |
| 128 | ++ |
| 129 | + if AMHAVEMETRICS |
| 130 | + if AMHAVEPAPI |
| 131 | + METRSOURCES = vt_metric_papi.c |
| 132 | +diff -crB --new-file VampirTrace-5.14.4/vtlib/vt_api_hook.h VampirTrace-5.14.4-apihooks/vtlib/vt_api_hook.h |
| 133 | +*** VampirTrace-5.14.4/vtlib/vt_api_hook.h 1970-01-01 01:00:00.000000000 +0100 |
| 134 | +--- VampirTrace-5.14.4-apihooks/vtlib/vt_api_hook.h 2013-08-05 16:26:11.000000000 +0200 |
| 135 | +*************** |
| 136 | +*** 0 **** |
| 137 | +--- 1,47 ---- |
| 138 | ++ /** |
| 139 | ++ * VampirTrace |
| 140 | ++ * http://www.tu-dresden.de/zih/vampirtrace |
| 141 | ++ * |
| 142 | ++ * Copyright (c) 2005-2013, ZIH, TU Dresden, Federal Republic of Germany |
| 143 | ++ * |
| 144 | ++ * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing |
| 145 | ++ * Centre, Federal Republic of Germany |
| 146 | ++ * |
| 147 | ++ * See the file COPYING in the package base directory for details |
| 148 | ++ **/ |
| 149 | ++ |
| 150 | ++ |
| 151 | ++ #if defined(VT_API_HOOKS_CLASS) |
| 152 | ++ |
| 153 | ++ /* This double dereferencing has to be used. Otherwise A might |
| 154 | ++ * not be resolved correctly */ |
| 155 | ++ |
| 156 | ++ #define CONCAT_(A,B) A ## _ ## B |
| 157 | ++ #define CONCAT(A,B) CONCAT_(A,B) |
| 158 | ++ |
| 159 | ++ /* Use this to define functions */ |
| 160 | ++ |
| 161 | ++ #define VT_API_HOOK_DEFINE(function_name, signature) \ |
| 162 | ++ extern void CONCAT(VT_API_HOOKS_CLASS,function_name signature); |
| 163 | ++ |
| 164 | ++ /* Use this to call functions */ |
| 165 | ++ |
| 166 | ++ #define VT_API_HOOK(function_name, params) \ |
| 167 | ++ CONCAT(VT_API_HOOKS_CLASS,function_name) params; |
| 168 | ++ |
| 169 | ++ /* function definitions */ |
| 170 | ++ VT_API_HOOK_DEFINE(enter,(uint32_t, uint64_t *, uint32_t)) |
| 171 | ++ VT_API_HOOK_DEFINE(exit,(uint32_t, uint64_t *)) |
| 172 | ++ VT_API_HOOK_DEFINE(open,(void)) |
| 173 | ++ VT_API_HOOK_DEFINE(close,(void)) |
| 174 | ++ VT_API_HOOK_DEFINE(close_on_signal,(void)) |
| 175 | ++ VT_API_HOOK_DEFINE(vt_trace_on,(uint32_t,uint8_t)) |
| 176 | ++ VT_API_HOOK_DEFINE(vt_trace_off,(uint32_t,uint8_t,uint8_t)) |
| 177 | ++ VT_API_HOOK_DEFINE(reset,(void)) |
| 178 | ++ VT_API_HOOK_DEFINE(def_region,(uint32_t, const char *, uint32_t, uint32_t, |
| 179 | ++ uint32_t, const char *, uint8_t, uint32_t)) |
| 180 | ++ |
| 181 | ++ #else |
| 182 | ++ #define VT_API_HOOK(function_name, params) |
| 183 | ++ #endif |
| 184 | ++ |
| 185 | +diff -crB --new-file VampirTrace-5.14.4/vtlib/vt_trc.c VampirTrace-5.14.4-apihooks/vtlib/vt_trc.c |
| 186 | +*** VampirTrace-5.14.4/vtlib/vt_trc.c 2013-06-14 14:54:54.000000000 +0200 |
| 187 | +--- VampirTrace-5.14.4-apihooks/vtlib/vt_trc.c 2016-03-12 09:43:07.612858555 +0100 |
| 188 | +*************** |
| 189 | +*** 89,94 **** |
| 190 | +--- 89,95 ---- |
| 191 | + # include "vt_plugin_cntr_int.h" |
| 192 | + #endif /* VT_PLUGIN_CNTR */ |
| 193 | + |
| 194 | ++ #include "vt_api_hook.h" |
| 195 | + |
| 196 | + #define GET_THREAD_ID(tid) \ |
| 197 | + if ( (tid) == VT_CURRENT_THREAD ) { \ |
| 198 | +*************** |
| 199 | +*** 1153,1158 **** |
| 200 | +--- 1154,1161 ---- |
| 201 | + if ( vt_open_called ) |
| 202 | + return; |
| 203 | + |
| 204 | ++ VT_API_HOOK(open,()); |
| 205 | ++ |
| 206 | + /* do initialization only once */ |
| 207 | + #if (defined(VT_MT) || defined(VT_HYB)) |
| 208 | + VTThrd_lock(&init_mutex); |
| 209 | +*************** |
| 210 | +*** 1477,1482 **** |
| 211 | +--- 1480,1487 ---- |
| 212 | + int extra_enters; |
| 213 | + uint64_t time; |
| 214 | + |
| 215 | ++ VT_API_HOOK(reset,()); |
| 216 | ++ |
| 217 | + vt_is_alive = 0; |
| 218 | + |
| 219 | + /* notice current call stack level */ |
| 220 | +*************** |
| 221 | +*** 1601,1606 **** |
| 222 | +--- 1606,1613 ---- |
| 223 | + |
| 224 | + void vt_close_by_signal(int signum) |
| 225 | + { |
| 226 | ++ VT_API_HOOK(close_by_signal,()); |
| 227 | ++ |
| 228 | + vt_cntl_msg(2, "Received signal %i on pid %i", signum, getpid()); |
| 229 | + |
| 230 | + /* restore original signal handler */ |
| 231 | +*************** |
| 232 | +*** 1625,1630 **** |
| 233 | +--- 1632,1639 ---- |
| 234 | + /* catch vt_close called from child processes through atexit */ |
| 235 | + if ( init_pid != getpid() ) return; |
| 236 | + |
| 237 | ++ VT_API_HOOK(close,()); |
| 238 | ++ |
| 239 | + /* do finalization only once */ |
| 240 | + #if (defined(VT_MT) || defined(VT_HYB)) |
| 241 | + VTThrd_lock(&init_mutex); |
| 242 | +*************** |
| 243 | +*** 1862,1867 **** |
| 244 | +--- 1871,1878 ---- |
| 245 | + { |
| 246 | + GET_THREAD_ID(tid); |
| 247 | + |
| 248 | ++ VT_API_HOOK(vt_trace_on,(tid,mark)); |
| 249 | ++ |
| 250 | + if ( vt_is_alive && |
| 251 | + VTTHRD_TRACE_STATUS(VTThrdv[tid]) == VT_TRACE_OFF ) |
| 252 | + { |
| 253 | +*************** |
| 254 | +*** 1900,1905 **** |
| 255 | +--- 1911,1918 ---- |
| 256 | + { |
| 257 | + GET_THREAD_ID(tid); |
| 258 | + |
| 259 | ++ VT_API_HOOK(vt_trace_off,(tid,mark,permanent)); |
| 260 | ++ |
| 261 | + if ( vt_is_alive && |
| 262 | + VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_OFF_PERMANENT ) |
| 263 | + { |
| 264 | +*************** |
| 265 | +*** 2489,2494 **** |
| 266 | +--- 2502,2510 ---- |
| 267 | + rdid, |
| 268 | + sid); |
| 269 | + |
| 270 | ++ VT_API_HOOK(def_region, (tid, rname, fid, begln, endln, rgroup, |
| 271 | ++ rtype, rid)); |
| 272 | ++ |
| 273 | + return rid; |
| 274 | + } |
| 275 | + |
| 276 | +*************** |
| 277 | +*** 2737,2742 **** |
| 278 | +--- 2753,2760 ---- |
| 279 | + |
| 280 | + GET_THREAD_ID(tid); |
| 281 | + |
| 282 | ++ VT_API_HOOK(enter,(tid,time,rid)); |
| 283 | ++ |
| 284 | + /* immediately return, if tracing is disabled permanently */ |
| 285 | + if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) == VT_TRACE_OFF_PERMANENT) return 0; |
| 286 | + |
| 287 | +*************** |
| 288 | +*** 2870,2875 **** |
| 289 | +--- 2888,2895 ---- |
| 290 | + |
| 291 | + GET_THREAD_ID(tid); |
| 292 | + |
| 293 | ++ VT_API_HOOK(exit,(tid,time)); |
| 294 | ++ |
| 295 | + /* immediately return, if tracing is disabled permanently */ |
| 296 | + if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) == VT_TRACE_OFF_PERMANENT) return; |
| 297 | + |
0 commit comments