Added using of a portable implementation of 'snprintf()', that comes also with the VT-package
This commit was SVN r19836.
Этот коммит содержится в:
родитель
b50a4f126a
Коммит
93fcd24832
@ -1,10 +1,14 @@
|
||||
SUBDIRS = \
|
||||
util \
|
||||
extlib \
|
||||
vtlib \
|
||||
tools \
|
||||
doc
|
||||
|
||||
EXTRA_DIST = \
|
||||
config_bottom.h \
|
||||
CONFIG-EXAMPLES \
|
||||
VERSION \
|
||||
examples/c/Makefile \
|
||||
examples/c/Makefile.config \
|
||||
examples/c/hello.c \
|
||||
@ -19,7 +23,5 @@ EXTRA_DIST = \
|
||||
examples/fortran/Makefile.config \
|
||||
examples/fortran/hello.F \
|
||||
examples/fortran/pi.F \
|
||||
examples/fortran/ring.F \
|
||||
CONFIG-EXAMPLES \
|
||||
VERSION
|
||||
examples/fortran/ring.F
|
||||
|
||||
|
@ -345,27 +345,30 @@ AC_DEFUN([ACVT_CONF_SUMMARY],
|
||||
echo " Host (H): $host"
|
||||
echo " Cross compiling: $cross_compiling"
|
||||
echo ""
|
||||
echo " C compiler: $CC"
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " C Compiler (H|B): $CC | $CC_FOR_BUILD"],
|
||||
[echo " C Compiler: $CC"])
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " C++ Compiler (H|B): $CXX | $CXX_FOR_BUILD"],
|
||||
[echo " C++ compiler: $CXX"])
|
||||
echo " Fortran 77 compiler: $F77"
|
||||
echo " Fortran 90 compiler: $FC"
|
||||
echo " C preprocessor: $CPP"
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " C preprocessor (H|B): $CPP | $CPP_FOR_BUILD"],
|
||||
[echo " C preprocessor: $CPP"])
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " C++ preprocessor (H|B): $CXXCPP | $CXXCPP_FOR_BUILD"],
|
||||
[echo " C++ preprocessor: $CXXCPP"])
|
||||
echo ""
|
||||
echo " CFLAGS: $CFLAGS"
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " CFLAGS (H|B): $CFLAGS | $CFLAGS_FOR_BUILD"],
|
||||
[echo " CFLAGS: $CFLAGS"])
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " CXXFLAGS (H|B): $CXXFLAGS | $CXXFLAGS_FOR_BUILD"],
|
||||
[echo " CXXFLAGS: $CXXFLAGS"])
|
||||
echo " FFLAGS: $FFLAGS"
|
||||
echo " FCFLAGS: $FCFLAGS"
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " CPPFLAGS (H|B): $CPPFLAGS | $CPPFLAGS_FOR_BUILD"],
|
||||
[echo " CPPFLAGS: $CPPFLAGS"])
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[echo " LDFLAGS (H|B): $LDFLAGS | $LDFLAGS_FOR_BUILD"],
|
||||
[echo " LDFLAGS: $LDFLAGS"])
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
@ -438,6 +441,109 @@ AC_DEFUN([ACVT_CONF_SUMMARY],
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
])
|
||||
])
|
||||
AC_DEFUN([ACVT_CROSS],
|
||||
[
|
||||
comp_for_build_given="no"
|
||||
|
||||
AC_ARG_VAR(CC_FOR_BUILD, [C compiler command for build system])
|
||||
AC_ARG_VAR(CFLAGS_FOR_BUILD, [C compiler flags for build system])
|
||||
AC_ARG_VAR(CPP_FOR_BUILD, [C preprocessor for build system])
|
||||
AC_ARG_VAR(CXX_FOR_BUILD, [C++ compiler command for build system])
|
||||
AC_ARG_VAR(CXXFLAGS_FOR_BUILD, [C++ compiler flags for build system])
|
||||
AC_ARG_VAR(CXXCPP_FOR_BUILD, [C++ preprocessor for build system])
|
||||
AC_ARG_VAR(CPPFLAGS_FOR_BUILD, [C/C++/Objective C preprocessor flags for build system])
|
||||
AC_ARG_VAR(LDFLAGS_FOR_BUILD, [linker flags for build system])
|
||||
AC_ARG_VAR(LIBS_FOR_BUILD, [libraries to pass to the linker for build system])
|
||||
|
||||
AS_IF([test x"$cross_compiling" != "xyes"],
|
||||
[
|
||||
# reset *_FOR_BUILD variables, if no cross compiling
|
||||
CC_FOR_BUILD=$CC; CFLAGS_FOR_BUILD=$CFLAGS; CPP_FOR_BUILD=$CPP
|
||||
CXX_FOR_BUILD=$CXX; CXXFLAGS_FOR_BUILD=$CXXFLAGS; CXXCPP_FOR_BUILD=$CXXCPP
|
||||
CPPFLAGS_FOR_BUILD=$CPPFLAGS; LDFLAGS_FOR_BUILD=$LDFLAGS; LIBS_FOR_BUILD=$LIBS
|
||||
],
|
||||
[
|
||||
AC_MSG_CHECKING([for C compiler for build system ($build)])
|
||||
AS_IF([test x"$CC_FOR_BUILD" = x],
|
||||
[AC_MSG_RESULT([$CC])], [AC_MSG_RESULT([$CC_FOR_BUILD])])
|
||||
AC_MSG_CHECKING([for C++ compiler for build system ($build)])
|
||||
AS_IF([test x"$CXX_FOR_BUILD" = x],
|
||||
[AC_MSG_RESULT([$CXX])], [AC_MSG_RESULT([$CXX_FOR_BUILD])])
|
||||
|
||||
AS_IF([test x"$CC_FOR_BUILD" = x -a x"$CXX_FOR_BUILD" != x],
|
||||
[
|
||||
AC_MSG_ERROR([no C compiler command for build system given
|
||||
Set \`CC_FOR_BUILD' to the C compiler of build system.])
|
||||
])
|
||||
AS_IF([test x"$CXX_FOR_BUILD" = x -a x"$CC_FOR_BUILD" != x],
|
||||
[
|
||||
AC_MSG_ERROR([no C++ compiler command for build system given
|
||||
Set \`CXX_FOR_BUILD' to the C++ compiler of build system.])
|
||||
])
|
||||
AS_IF([test x"$CC_FOR_BUILD" != x -a x"$CXX_FOR_BUILD" != x],
|
||||
[
|
||||
comp_for_build_given="yes"
|
||||
])
|
||||
AS_IF([test x"$CC_FOR_BUILD" = x -a x"$CXX_FOR_BUILD" = x],
|
||||
[
|
||||
AC_MSG_NOTICE([no C/C++ compiler command for build system given
|
||||
In cross compile mode, it's recommended to build the compiler wrappers and OPARI for the build system. Set \`CC_FOR_BUILD' and `CXX_FOR_BUILD' to the C/C++ compiler of build system therfor.])
|
||||
CC_FOR_BUILD=$CC
|
||||
CXX_FOR_BUILD=$CXX
|
||||
])
|
||||
|
||||
AS_IF([test x"$CFLAGS_FOR_BUILD" = x], [CFLAGS_FOR_BUILD=$CFLAGS])
|
||||
AS_IF([test x"$CXXFLAGS_FOR_BUILD" = x], [CXXFLAGS_FOR_BUILD=$CXXFLAGS])
|
||||
AS_IF([test x"$CPPFLAGS_FOR_BUILD" = x], [CPPFLAGS_FOR_BUILD=$CPPFLAGS])
|
||||
AS_IF([test x"$LDFLAGS_FOR_BUILD" = x], [LDFLAGS_FOR_BUILD=$LDFLAGS])
|
||||
AS_IF([test x"$LIBS_FOR_BUILD" = x], [LIBS_FOR_BUILD=$LIBS])
|
||||
|
||||
AS_IF([test x"$comp_for_build_given" = "xyes"],
|
||||
[
|
||||
sav_CPPFLAGS=$CPPFLAGS; sav_LDFLAGS=$LDFLAGS; sav_LIBS=$LIBS
|
||||
CPPFLAGS=$CPPFLAGS_FOR_BUILD; LDFLAGS=$LDFLAGS_FOR_BUILD; LIBS=$LIBS_FOR_BUILD
|
||||
|
||||
sav_CC=$CC; sav_CFLAGS=$CFLAGS; sav_CPP=$CPP
|
||||
CC=$CC_FOR_BUILD; CFLAGS=$CFLAGS_FOR_BUILD
|
||||
AC_MSG_CHECKING([whether the C compiler for build system works])
|
||||
AC_TRY_LINK([], [],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_ERROR([C compiler for build system cannot create executables
|
||||
See \`config.log' for more details.])])
|
||||
|
||||
AS_IF([test x"$CPP_FOR_BUILD" = x],
|
||||
[
|
||||
unset CPP
|
||||
unset ac_cv_prog_CPP # clear cache variable for CPP
|
||||
AC_PROG_CPP
|
||||
CPP_FOR_BUILD=$CPP
|
||||
])
|
||||
CC=$sav_CC; CFLAGS=$sav_CFLAGS; CPP=$sav_CPP
|
||||
|
||||
AC_LANG([C++])
|
||||
sav_CXX=$CXX; sav_CXXFLAGS=$CXXFLAGS; sav_CXXCPP=$CXXCPP
|
||||
CXX=$CXX_FOR_BUILD; CXXFLAGS=$CXXFLAGS_FOR_BUILD
|
||||
AC_MSG_CHECKING([whether the C++ compiler for build system works])
|
||||
AC_TRY_LINK([], [],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_ERROR([C++ compiler for build system cannot create executables
|
||||
See \`config.log' for more details.])])
|
||||
|
||||
AS_IF([test x"$CXXCPP_FOR_BUILD" = x],
|
||||
[
|
||||
unset CXXCPP
|
||||
unset ac_cv_prog_CXXCPP # clear cache variable for CXXCPP
|
||||
AC_PROG_CXXCPP
|
||||
CXXCPP_FOR_BUILD=$CXXCPP
|
||||
])
|
||||
CXX=$sav_CXX; CXXFLAGS=$sav_CXXFLAGS; CXXCPP=$sav_CXXCPP
|
||||
AC_LANG([C])
|
||||
|
||||
CPPFLAGS=$sav_CPPFLAGS; LDFLAGS=$sav_LDFLAGS; LIBS=$sav_LIBS
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([ACVT_DL],
|
||||
[
|
||||
dl_error="no"
|
||||
|
40
ompi/contrib/vt/vt/config_bottom.h
Обычный файл
40
ompi/contrib/vt/vt/config_bottom.h
Обычный файл
@ -0,0 +1,40 @@
|
||||
#ifndef _CONFIG_H
|
||||
#error "config_bottom.h should only be included from config.h"
|
||||
#endif /* _CONFIG_H */
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
#if !(defined(HAVE_ASPRINTF) && HAVE_ASPRINTF)
|
||||
# undef asprintf
|
||||
# define asprintf vt_asprintf
|
||||
#endif /* HAVE_ASPRINTF */
|
||||
|
||||
#if !(defined(HAVE_SNPRINTF) && HAVE_SNPRINTF)
|
||||
# undef snprintf
|
||||
# define snprintf vt_snprintf
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
#if !(defined(HAVE_VASPRINTF) && HAVE_VASPRINTF)
|
||||
# undef vasprintf
|
||||
# define vasprintf vt_vasprintf
|
||||
#endif /* HAVE_VASPRINTF */
|
||||
|
||||
#if !(defined(HAVE_VSNPRINTF) && HAVE_VSNPRINTF)
|
||||
# undef vsnprintf
|
||||
# define vsnprintf vt_vsnprintf
|
||||
#endif /* HAVE_VSNPRINTF */
|
||||
|
||||
#if !(defined(HAVE_STRDUP) && HAVE_STRDUP)
|
||||
# undef strdup
|
||||
# define strdup vt_strdup
|
||||
#endif /* HAVE_STRDUP */
|
||||
|
||||
#if defined(HAVE_FNMATCH_H) && HAVE_FNMATCH_H
|
||||
# include <fnmatch.h>
|
||||
#else /* HAVE_FNMATCH_H */
|
||||
# undef fnmatch
|
||||
# define fnmatch vt_fnmatch
|
||||
# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
|
||||
# define vt_fnmatch(_pattern, _string, __flags) strcmp(_string, _pattern)
|
||||
#endif /* HAVE_FNMATCH_H */
|
||||
|
@ -2,15 +2,24 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(VampirTrace, 5.4.6, service@vampir.eu)
|
||||
AC_INIT(VampirTrace, 5.4.6, vampirsupport@zih.tu-dresden.de)
|
||||
AM_INIT_AUTOMAKE(VampirTrace, 5.4.6)
|
||||
AC_CONFIG_SRCDIR(config.h.in)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
ACVT_CONF_INIT
|
||||
|
||||
ACVT_CONF_TITLE([Initialization])
|
||||
|
||||
# Setup the top and bottom of the config.h file
|
||||
AH_TOP([
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
])
|
||||
AH_BOTTOM([
|
||||
#include "config_bottom.h"
|
||||
#endif /* _CONFIG_H */
|
||||
])
|
||||
|
||||
# Check for absolute paths of $builddir and $srcdir
|
||||
top_vt_builddir="`pwd`"
|
||||
cd "$srcdir"
|
||||
@ -18,7 +27,14 @@ top_vt_srcdir="`pwd`"
|
||||
cd "$top_vt_builddir"
|
||||
AC_MSG_NOTICE([builddir: $top_vt_builddir])
|
||||
AC_MSG_NOTICE([srcdir: $top_vt_srcdir])
|
||||
AS_IF([test "$top_vt_builddir" != "$top_vt_srcdir"], AC_MSG_NOTICE([detected VPATH build]))
|
||||
AS_IF([test "$top_vt_builddir" != "$top_vt_srcdir"],
|
||||
[
|
||||
AC_MSG_NOTICE([detected VPATH build])
|
||||
# If VPATH build, including of the source directory needed
|
||||
# to find '<srcdir>/config_bottom.h' and '<srcdir>/util/util.h'
|
||||
CPPFLAGS='-I$(top_srcdir)'" $CPPFLAGS"
|
||||
CXXCPPFLAGS='-I$(top_srcdir)'" $CXXCPPFLAGS"
|
||||
])
|
||||
|
||||
# Check for type of host system
|
||||
AC_CANONICAL_HOST
|
||||
@ -43,70 +59,11 @@ AC_PROG_CXXCPP
|
||||
AC_PROG_F77
|
||||
AC_PROG_FC
|
||||
|
||||
AM_CONDITIONAL(AMHAVECC, test x"$CC" != x)
|
||||
AM_CONDITIONAL(AMHAVECXX, test x"$CXX" != x)
|
||||
AM_CONDITIONAL(AMHAVEF77, test x"$F77" != x)
|
||||
AM_CONDITIONAL(AMHAVEFC, test x"$FC" != x)
|
||||
|
||||
# Check for *front-end* C++ compiler, preprocessor, and flags
|
||||
AC_ARG_VAR(CXX_FOR_BUILD, [C++ compiler command for build system])
|
||||
AC_ARG_VAR(CXXFLAGS_FOR_BUILD, [C++ compiler flags for build system])
|
||||
AC_ARG_VAR(CXXCPP_FOR_BUILD, [C++ preprocessor for build system])
|
||||
AC_ARG_VAR(CPPFLAGS_FOR_BUILD, [C/C++/Objective C preprocessor flags for build system])
|
||||
AC_ARG_VAR(LDFLAGS_FOR_BUILD, [linker flags for build system])
|
||||
AC_ARG_VAR(LIBS_FOR_BUILD, [libraries to pass to the linker for build system])
|
||||
|
||||
AS_IF([test x"$cross_compiling" = "xyes"],
|
||||
[
|
||||
AC_MSG_CHECKING([for C++ compiler for build system ($build)])
|
||||
AS_IF([test x"$CXX_FOR_BUILD" = x],
|
||||
[
|
||||
AC_MSG_RESULT([$CXX])
|
||||
AC_MSG_NOTICE([no C++ compiler command for build system given
|
||||
In cross compile mode, it's recommended to build the compiler wrappers and OPARI for the build system. Set \`CXX_FOR_BUILD' to the C++ compiler of build system therefor.])
|
||||
CXX_FOR_BUILD=$CXX
|
||||
cxx_for_build_given="no"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([$CXX_FOR_BUILD])
|
||||
cxx_for_build_given="yes"
|
||||
])
|
||||
AS_IF([test x"$CXXFLAGS_FOR_BUILD" = x], [CXXFLAGS_FOR_BUILD=$CXXFLAGS])
|
||||
AS_IF([test x"$CPPFLAGS_FOR_BUILD" = x], [CPPFLAGS_FOR_BUILD=$CPPFLAGS])
|
||||
AS_IF([test x"$LDFLAGS_FOR_BUILD" = x], [LDFLAGS_FOR_BUILD=$LDFLAGS])
|
||||
AS_IF([test x"$LIBS_FOR_BUILD" = x], [LIBS_FOR_BUILD=$LIBS])
|
||||
|
||||
AS_IF([test x"$cxx_for_build_given" = "xyes"],
|
||||
[
|
||||
AC_LANG([C++])
|
||||
sav_CXX=$CXX; sav_CXXFLAGS=$CXXFLAGS; sav_CXXCPP=$CXXCPP
|
||||
sav_CPPFLAGS=$CPPFLAGS; sav_LDFLAGS=$LDFLAGS; sav_LIBS=$LIBS
|
||||
CXX=$CXX_FOR_BUILD; CXXFLAGS=$CXXFLAGS_FOR_BUILD
|
||||
CPPFLAGS=$CPPFLAGS_FOR_BUILD; LDFLAGS=$LDFLAGS_FOR_BUILD; LIBS=$LIBS_FOR_BUILD
|
||||
AC_MSG_CHECKING([whether the C++ compiler for build system works])
|
||||
AC_TRY_LINK([], [],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_ERROR([C++ compiler for build system cannot create executables
|
||||
See \`config.log' for more details.])])
|
||||
|
||||
AS_IF([test x"$CXXCPP_FOR_BUILD" = x],
|
||||
[
|
||||
unset CXXCPP
|
||||
unset ac_cv_prog_CXXCPP # clear cache variable for CXXCPP
|
||||
AC_PROG_CXXCPP
|
||||
CXXCPP_FOR_BUILD=$CXXCPP
|
||||
])
|
||||
|
||||
CXX=$sav_CXX; CXXFLAGS=$sav_CXXFLAGS; CXXCPP=$sav_CXXCPP
|
||||
CPPFLAGS=$sav_CPPFLAGS; LDFLAGS=$sav_LDFLAGS; LIBS=$sav_LIBS
|
||||
AC_LANG([C])
|
||||
])
|
||||
],
|
||||
[
|
||||
# reset *_FOR_BUILD variables, if no cross compiling
|
||||
CXX_FOR_BUILD=$CXX; CXXFLAGS_FOR_BUILD=$CXXFLAGS; CXXCPP_FOR_BUILD=$CXXCPP
|
||||
CPPFLAGS_FOR_BUILD=$CPPFLAGS; LDFLAGS_FOR_BUILD=$LDFLAGS; LIBS_FOR_BUILD=$LIBS
|
||||
])
|
||||
# Check cross-build related stuff
|
||||
ACVT_CROSS
|
||||
|
||||
# Do we want to build and install binaries
|
||||
AC_ARG_ENABLE(binaries,
|
||||
@ -138,7 +95,13 @@ AC_CHECK_SIZEOF(mode_t, 4)
|
||||
#AC_REPLACE_FNMATCH
|
||||
#AC_FUNC_MALLOC
|
||||
#AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([atexit gethostname setenv])
|
||||
AC_CHECK_DECL([va_copy],
|
||||
[AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if you have the `va_copy' function.])],
|
||||
[], [#include <stdarg.h>])
|
||||
AC_CHECK_DECL([__va_copy],
|
||||
[AC_DEFINE([HAVE_UNDERSCORE_VA_COPY], [1], [Define to 1 if you have the `__va_copy' function.])],
|
||||
[], [#include <stdarg.h>])
|
||||
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strdup])
|
||||
|
||||
# Check for OTF
|
||||
ACVT_CONF_TITLE([Open Trace Format (OTF) library and tools])
|
||||
@ -289,6 +252,7 @@ ACVT_COMPWRAP
|
||||
|
||||
# Output files
|
||||
AC_CONFIG_FILES([Makefile
|
||||
util/Makefile
|
||||
extlib/Makefile
|
||||
vtlib/Makefile
|
||||
tools/Makefile
|
||||
|
@ -52,7 +52,13 @@ AC_SUBST([have_stdint_h])
|
||||
AC_SUBST([have_inttypes_h])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS([fseeko ftello strdup])
|
||||
AC_CHECK_DECL([va_copy],
|
||||
[AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if you have the `va_copy' function.])],
|
||||
[], [#include <stdarg.h>])
|
||||
AC_CHECK_DECL([__va_copy],
|
||||
[AC_DEFINE([HAVE_UNDERSCORE_VA_COPY], [1], [Define to 1 if you have the `__va_copy' function.])],
|
||||
[], [#include <stdarg.h>])
|
||||
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strdup fseeko ftello])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
# AC_C_CONST ### do not use this if you want to do C++ programs because it might define 'const'
|
||||
|
@ -440,7 +440,7 @@ int OTF_File_seek( OTF_File* file, uint64_t pos ) {
|
||||
}
|
||||
|
||||
|
||||
ret= OTF_fseek( file->file, pos, SEEK_SET );
|
||||
ret= fseeko( file->file, pos, SEEK_SET );
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
|
||||
@ -522,7 +522,7 @@ uint64_t OTF_File_tell( OTF_File* file ) {
|
||||
|
||||
if ( NULL != file->file ) {
|
||||
|
||||
file->pos= OTF_ftell( file->file );
|
||||
file->pos= ftello( file->file );
|
||||
}
|
||||
|
||||
return file->pos;
|
||||
@ -674,7 +674,7 @@ void OTF_File_suspend( OTF_File* file ) {
|
||||
|
||||
/* get status and close OS file */
|
||||
|
||||
file->pos= OTF_ftell( file->file );
|
||||
file->pos= ftello( file->file );
|
||||
fclose( file->file );
|
||||
file->file= NULL;
|
||||
}
|
||||
@ -723,7 +723,7 @@ int OTF_File_revive( OTF_File* file, OTF_FileMode mode ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
OTF_fseek( file->file, file->pos, SEEK_SET );
|
||||
fseeko( file->file, file->pos, SEEK_SET );
|
||||
|
||||
} else {
|
||||
|
||||
@ -904,7 +904,7 @@ int OTF_File_revive( OTF_File* file, OTF_FileMode mode ) {
|
||||
/* dont need to seek to the saved position because there
|
||||
will be another seek anyway*/
|
||||
/*
|
||||
OTF_fseek( file->file, file->pos, SEEK_SET );
|
||||
fseeko( file->file, file->pos, SEEK_SET );
|
||||
*/
|
||||
|
||||
} else {
|
||||
|
@ -56,36 +56,36 @@ char* OTF_getFilename( const char* namestub, uint32_t id, OTF_FileType type,
|
||||
case OTF_FILETYPE_MASTER:
|
||||
|
||||
/* mastercontrol file stays uncompressed even with compression */
|
||||
OTF_snprintf( ret, l, "%s.%s", namestub, OTF_FILENAMESUFFIX_MAIN );
|
||||
snprintf( ret, l, "%s.%s", namestub, OTF_FILENAMESUFFIX_MAIN );
|
||||
break;
|
||||
|
||||
case OTF_FILETYPE_GLOBAL_DEF:
|
||||
|
||||
OTF_snprintf( ret, l, "%s.%s%s", namestub, OTF_FILENAMESUFFIX_DEF,
|
||||
snprintf( ret, l, "%s.%s%s", namestub, OTF_FILENAMESUFFIX_DEF,
|
||||
((type&OTF_FILECOMPRESSION_BITS) > 0 && (type&OTF_FILECOMPRESSION_BITS) <= 9 ) ? ".z" : "" );
|
||||
break;
|
||||
|
||||
case OTF_FILETYPE_DEF:
|
||||
|
||||
OTF_snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_DEF,
|
||||
snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_DEF,
|
||||
((type&OTF_FILECOMPRESSION_BITS) > 0 && (type&OTF_FILECOMPRESSION_BITS) <= 9 ) ? ".z" : "" );
|
||||
break;
|
||||
|
||||
case OTF_FILETYPE_EVENT:
|
||||
|
||||
OTF_snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_EVENTS,
|
||||
snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_EVENTS,
|
||||
((type&OTF_FILECOMPRESSION_BITS) > 0 && (type&OTF_FILECOMPRESSION_BITS) <= 9 ) ? ".z" : "" );
|
||||
break;
|
||||
|
||||
case OTF_FILETYPE_SNAPS:
|
||||
|
||||
OTF_snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_SNAPS,
|
||||
snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_SNAPS,
|
||||
((type&OTF_FILECOMPRESSION_BITS) > 0 && (type&OTF_FILECOMPRESSION_BITS) <= 9 ) ? ".z" : "" );
|
||||
break;
|
||||
|
||||
case OTF_FILETYPE_STATS:
|
||||
|
||||
OTF_snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_STATS,
|
||||
snprintf( ret, l, "%s.%x.%s%s", namestub, id, OTF_FILENAMESUFFIX_STATS,
|
||||
((type&OTF_FILECOMPRESSION_BITS) > 0 && (type&OTF_FILECOMPRESSION_BITS) <= 9 ) ? ".z" : "" );
|
||||
break;
|
||||
|
||||
@ -102,7 +102,7 @@ char* OTF_getFilename( const char* namestub, uint32_t id, OTF_FileType type,
|
||||
char* OTF_stripFilename( const char* filename ) {
|
||||
|
||||
|
||||
char* ret= OTF_strdup( filename );
|
||||
char* ret= strdup( filename );
|
||||
char* p= ret;
|
||||
|
||||
if( NULL == p ) {
|
||||
|
@ -5,58 +5,259 @@
|
||||
|
||||
#include "OTF_Platform.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_WIN32) /* windows */
|
||||
|
||||
# include <Windows.h>
|
||||
#include <Windows.h>
|
||||
|
||||
int gettimeofday(struct timeval* tv, void* dummytimezone) {
|
||||
union {
|
||||
long long ns100;
|
||||
FILETIME ft;
|
||||
} now;
|
||||
int gettimeofday(struct timeval* tv, void* dummytimezone) {
|
||||
union {
|
||||
long long ns100;
|
||||
FILETIME ft;
|
||||
} now;
|
||||
|
||||
GetSystemTimeAsFileTime (&now.ft);
|
||||
tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL);
|
||||
tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL);
|
||||
GetSystemTimeAsFileTime (&now.ft);
|
||||
tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL);
|
||||
tv->tv_sec = (long) ((now.ns100 - 116444736000000000LL) / 10000000LL);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* unix */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int guess_strlen(const char* fmt, va_list ap) {
|
||||
char* sarg;
|
||||
double darg;
|
||||
float farg;
|
||||
size_t i;
|
||||
int iarg;
|
||||
int len;
|
||||
long larg;
|
||||
|
||||
/* Start off with a fudge factor of 128 to handle the % escapes that
|
||||
* we aren't calculating here */
|
||||
|
||||
len = (int)strlen(fmt) + 128;
|
||||
for (i = 0; i < strlen(fmt); ++i) {
|
||||
if ('%' == fmt[i] && i + 1 < strlen(fmt) && '%' != fmt[i + 1]) {
|
||||
++i;
|
||||
switch (fmt[i]) {
|
||||
case 'c':
|
||||
(void)va_arg(ap, int);
|
||||
len += 1; /* let's suppose it's a printable char */
|
||||
break;
|
||||
case 's':
|
||||
sarg = va_arg(ap, char*);
|
||||
|
||||
/* If there's an arg, get the strlen, otherwise we'll
|
||||
* use (null) */
|
||||
|
||||
if (NULL != sarg) {
|
||||
len += (int)strlen(sarg);
|
||||
} else {
|
||||
len += 5;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
case 'i':
|
||||
iarg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (iarg < 0) ++len;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
iarg /= 10;
|
||||
} while (0 != iarg);
|
||||
break;
|
||||
case 'x':
|
||||
case 'X':
|
||||
iarg = va_arg(ap, int);
|
||||
/* Now get the log16 */
|
||||
do {
|
||||
++len;
|
||||
iarg /= 16;
|
||||
} while (0 != iarg);
|
||||
break;
|
||||
case 'f':
|
||||
farg = (float)va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (farg < 0) {
|
||||
++len;
|
||||
farg = -farg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
farg /= 10.0;
|
||||
} while (0 != farg);
|
||||
break;
|
||||
case 'g':
|
||||
darg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (darg < 0) {
|
||||
++len;
|
||||
darg = -darg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
darg /= 10.0;
|
||||
} while (0 != darg);
|
||||
break;
|
||||
case 'l':
|
||||
/* Get %ld %lx %lX %lf */
|
||||
if (i + 1 < strlen(fmt)) {
|
||||
++i;
|
||||
switch (fmt[i]) {
|
||||
case 'x':
|
||||
case 'X':
|
||||
larg = va_arg(ap, int);
|
||||
/* Now get the log16 */
|
||||
do {
|
||||
++len;
|
||||
larg /= 16;
|
||||
} while (0 != larg);
|
||||
break;
|
||||
case 'f':
|
||||
darg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (darg < 0) {
|
||||
++len;
|
||||
darg = -darg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
darg /= 10.0;
|
||||
} while (0 != darg);
|
||||
break;
|
||||
case 'd':
|
||||
default:
|
||||
larg = va_arg(ap, int);
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
larg /= 10;
|
||||
} while (0 != larg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
return len;
|
||||
}
|
||||
|
||||
char* OTF_basename(char* path) {
|
||||
char *ret;
|
||||
#if defined(_WIN32)
|
||||
const char* s = "\\";
|
||||
int OTF_asprintf(char** ptr, const char* fmt, ...) {
|
||||
int length;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
length = OTF_vasprintf(ptr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int OTF_vasprintf(char** ptr, const char* fmt, va_list ap) {
|
||||
int length;
|
||||
va_list ap2;
|
||||
|
||||
/* va_list might have pointer to internal state and using
|
||||
* it twice is a bad idea. So make a copy for the second
|
||||
* use. Copy order taken from Autoconf docs. */
|
||||
#if defined(HAVE_VA_COPY) && HAVE_VA_COPY
|
||||
va_copy(ap2, ap);
|
||||
#elif defined(HAVE_UNDERSCORE_VA_COPY) && HAVE_UNDERSCORE_VA_COPY
|
||||
__va_copy(ap2, ap);
|
||||
#else
|
||||
const char* s = "/";
|
||||
memcpy (&ap2, &ap, sizeof(va_list));
|
||||
#endif
|
||||
|
||||
if( path == NULL || strlen( path ) == 0 ) {
|
||||
ret = OTF_strdup( "." );
|
||||
} else if( path[strlen(path)-1] == *s ) {
|
||||
ret = OTF_strdup( s );
|
||||
} else {
|
||||
char* tmp;
|
||||
if( ( tmp = strrchr( path, *s ) ) != NULL )
|
||||
ret = OTF_strdup( tmp+1 );
|
||||
else
|
||||
ret = OTF_strdup( path );
|
||||
|
||||
/* guess the size */
|
||||
length = guess_strlen(fmt, ap);
|
||||
|
||||
/* allocate a buffer */
|
||||
*ptr = (char*) malloc((size_t) length + 1);
|
||||
if (NULL == *ptr) {
|
||||
errno = ENOMEM;
|
||||
va_end(ap2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
/* fill the buffer */
|
||||
length = vsprintf(*ptr, fmt, ap2);
|
||||
#if (defined(HAVE_VA_COPY) && HAVE_VA_COPY) || (defined(HAVE_UNDERSCORE_VA_COPY) && HAVE_UNDERSCORE_VA_COPY)
|
||||
va_end(ap2);
|
||||
#endif /* HAVE_VA_COPY || HAVE_UNDERSCORE_VA_COPY */
|
||||
|
||||
/* realloc */
|
||||
*ptr = (char*)realloc(*ptr, (size_t)length + 1);
|
||||
if (NULL == *ptr) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int OTF_snprintf(char* str, size_t size, const char* fmt, ...) {
|
||||
int length;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
length = OTF_vsnprintf(str, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int OTF_vsnprintf(char* str, size_t size, const char* fmt, va_list ap) {
|
||||
int length;
|
||||
char* buf;
|
||||
|
||||
length = OTF_vasprintf(&buf, fmt, ap);
|
||||
if (length < 0) {
|
||||
return length;
|
||||
}
|
||||
|
||||
/* return the length when given a null buffer (C99) */
|
||||
if (str) {
|
||||
if ((size_t) length < size) {
|
||||
strcpy(str, buf);
|
||||
} else {
|
||||
memcpy(str, buf, size - 1);
|
||||
str[size] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
char* OTF_strdup(const char* s) {
|
||||
char *c;
|
||||
char* c;
|
||||
|
||||
if( s == NULL || ( c = ( char* )malloc( strlen(s)+1 ) ) == NULL )
|
||||
if (s == NULL || (c = (char*)malloc(strlen(s)+1)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy( c, s );
|
||||
strcpy(c, s) ;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* windows/unix */
|
||||
|
||||
|
@ -23,11 +23,7 @@
|
||||
# include "OTF_Platform_win.h"
|
||||
#else /* unix */
|
||||
# include "OTF_Platform_unix.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* windows/unix */
|
||||
|
||||
/* if you know (for sure) of more compilers supporting __FUNCTION__,
|
||||
then add them here */
|
||||
@ -49,11 +45,4 @@ extern "C" {
|
||||
# define __LINE__ 0
|
||||
#endif
|
||||
|
||||
char *OTF_basename( char* path );
|
||||
char *OTF_strdup( const char* s );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OTF_PLATFORM_H */
|
||||
|
@ -20,18 +20,56 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_FSEEKO) && HAVE_FSEEKO
|
||||
# define OTF_fseek fseeko
|
||||
#else /* HAVE_FSEEKO */
|
||||
# define OTF_fseek fseek
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if !(defined(HAVE_FSEEKO) && HAVE_FSEEKO)
|
||||
# undef fseeko
|
||||
# define fseeko fseek
|
||||
#endif /* HAVE_FSEEKO */
|
||||
|
||||
#if defined(HAVE_FTELLO) && HAVE_FTELLO
|
||||
# define OTF_ftell ftello
|
||||
#else /* HAVE_FTELLO */
|
||||
# define OTF_ftell ftell
|
||||
#if !(defined(HAVE_FTELLO) && HAVE_FTELLO)
|
||||
# undef ftello
|
||||
# define ftello ftell
|
||||
#endif /* HAVE_FTELLO */
|
||||
|
||||
#define OTF_snprintf snprintf
|
||||
#if !(defined(HAVE_ASPRINTF) && HAVE_ASPRINTF)
|
||||
# undef asprintf
|
||||
# define asprintf OTF_asprintf
|
||||
#endif /* HAVE_ASPRINTF */
|
||||
|
||||
#if !(defined(HAVE_SNPRINTF) && HAVE_SNPRINTF)
|
||||
# undef snprintf
|
||||
# define snprintf OTF_snprintf
|
||||
#endif /* HAVE_SNPRINTF */
|
||||
|
||||
#if !(defined(HAVE_VASPRINTF) && HAVE_VASPRINTF)
|
||||
# undef vasprintf
|
||||
# define vasprintf OTF_vasprintf
|
||||
#endif /* HAVE_VASPRINTF */
|
||||
|
||||
#if !(defined(HAVE_VSNPRINTF) && HAVE_VSNPRINTF)
|
||||
# undef vsnprintf
|
||||
# define vsnprintf OTF_vsnprintf
|
||||
#endif /* HAVE_VSNPRINTF */
|
||||
|
||||
#if !(defined(HAVE_STRDUP) && HAVE_STRDUP)
|
||||
# undef strdup
|
||||
# define strdup OTF_strdup
|
||||
#endif /* HAVE_STRDUP */
|
||||
|
||||
int OTF_asprintf( char** ptr, const char* fmt, ... );
|
||||
int OTF_snprintf( char* str, size_t size, const char* fmt, ... );
|
||||
int OTF_vasprintf( char** ptr, const char* fmt, va_list ap );
|
||||
int OTF_vsnprintf( char* str, size_t size, const char* fmt, va_list ap );
|
||||
char* OTF_strdup( const char* s );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OTF_PLATFORM_UNIX_H */
|
||||
|
@ -24,10 +24,13 @@ extern "C" {
|
||||
# define HAVE_IO_H
|
||||
# define HAVE_ZLIB
|
||||
|
||||
# define OTF_ftell (uint64_t) _ftelli64
|
||||
# define OTF_fseek(f,off,orig) _fseeki64(f,(__int64)off,orig)
|
||||
# undef ftello
|
||||
# define ftello (uint64_t) _ftelli64
|
||||
# undef fseeko
|
||||
# define fseeko(f,off,orig) _fseeki64(f,(__int64)off,orig)
|
||||
|
||||
# define OTF_snprintf _snprintf
|
||||
# define snprintf
|
||||
# define snprintf _snprintf
|
||||
|
||||
# pragma warning (disable : 4996) /* disable insecurity/deprication warnings */
|
||||
|
||||
|
@ -191,6 +191,7 @@ OTF_RBuffer* OTF_RBuffer_open( const char* filename, OTF_FileManager* manager )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
OTF_RBuffer_init( ret );
|
||||
|
||||
if( NULL == manager ) {
|
||||
@ -207,7 +208,6 @@ OTF_RBuffer* OTF_RBuffer_open( const char* filename, OTF_FileManager* manager )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ret->file= OTF_File_open( filename, manager, OTF_FILEMODE_READ );
|
||||
|
||||
if ( NULL == ret->file ) {
|
||||
|
@ -142,7 +142,7 @@ OTF_RStream* OTF_RStream_open( const char* namestub, uint32_t id, OTF_FileManage
|
||||
|
||||
OTF_RStream_init( ret );
|
||||
|
||||
ret->namestub= OTF_strdup( namestub );
|
||||
ret->namestub= strdup( namestub );
|
||||
ret->id= id;
|
||||
|
||||
if( NULL == manager ) {
|
||||
|
@ -175,7 +175,7 @@ OTF_WStream* OTF_WStream_open( const char* namestub, uint32_t id,
|
||||
|
||||
OTF_WStream_init( ret );
|
||||
|
||||
ret->namestub= OTF_strdup( namestub );
|
||||
ret->namestub= strdup( namestub );
|
||||
ret->id= id;
|
||||
ret->manager= manager;
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "OTF_Platform.h"
|
||||
|
||||
#include "vtf3.h"
|
||||
|
||||
#include "Treehash.h"
|
||||
@ -105,7 +107,7 @@ int treehash_addnode( hashtabT *p_hashtab, uint32_t process, const char* name, u
|
||||
p_newnode->process = process;
|
||||
p_newnode->processi = 0;
|
||||
if ( name )
|
||||
p_newnode->name = OTF_strdup( name );
|
||||
p_newnode->name = strdup( name );
|
||||
else
|
||||
p_newnode->name = 0;
|
||||
p_newnode->childrensize = 0;
|
||||
|
@ -83,7 +83,7 @@ int main (int argc, char **argv) {
|
||||
|
||||
if( i+1 < argc ) {
|
||||
|
||||
inputFile= OTF_strdup( argv[i+1] );
|
||||
inputFile= strdup( argv[i+1] );
|
||||
++i;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ int main (int argc, char **argv) {
|
||||
|
||||
if ( '-' != argv[i][0] ) {
|
||||
|
||||
inputFile= OTF_strdup( argv[i] );
|
||||
inputFile= strdup( argv[i] );
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -126,7 +126,7 @@ int main ( int argc, const char** argv ) {
|
||||
|
||||
if ( ( 0 == strcmp( "-i", argv[i] ) ) && ( i+1 < argc ) ) {
|
||||
|
||||
filename= OTF_strdup( argv[i+1] );
|
||||
filename= strdup( argv[i+1] );
|
||||
++i;
|
||||
|
||||
} else if ( ( 0 == strcmp( "-b", argv[i] ) ) && ( i+1 < argc ) ) {
|
||||
@ -241,7 +241,7 @@ int main ( int argc, const char** argv ) {
|
||||
|
||||
if ( '-' != argv[i][0] ) {
|
||||
|
||||
filename= OTF_strdup( argv[i] );
|
||||
filename= strdup( argv[i] );
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -206,7 +206,7 @@ int main ( int argc, const char** argv ) {
|
||||
strncpy( outfilename, infilename, len +1 );
|
||||
|
||||
/* find and remove ".z" at the end */
|
||||
if ( ( 2 < len ) && ( 0 != strcmp( ".z", outfilename +len -2 ) ) ) {
|
||||
if ( ( 2 >= len ) || ( 0 != strcmp( ".z", outfilename +len -2 ) ) ) {
|
||||
|
||||
fprintf( stderr, "ERROR: no trailing '.z' in filename '%s', rejecting\n",
|
||||
infilename );
|
||||
|
@ -5,6 +5,11 @@ bin_PROGRAMS = \
|
||||
otfconfig
|
||||
endif
|
||||
|
||||
otfconfig_LDADD = $(top_builddir)/otflib/libotf.la
|
||||
if ! AMDEPZLIB
|
||||
otfconfig_LDADD += $(ZLIB_LIB_LINE)
|
||||
endif
|
||||
|
||||
otfconfig_SOURCES = \
|
||||
otfconfig.c
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
#include "OTF_inttypes.h"
|
||||
|
||||
#include "OTF_Platform.h"
|
||||
#include "otf.h"
|
||||
|
||||
#define SHOW_HELPTEXT { \
|
||||
|
@ -141,7 +141,7 @@ int handleDefFunction( void* fcbx, uint32_t streamid,
|
||||
|
||||
/* insert all data about the function */
|
||||
si->functions[si->nfunctions].deftoken = deftoken;
|
||||
si->functions[si->nfunctions].name = OTF_strdup( name );
|
||||
si->functions[si->nfunctions].name = strdup( name );
|
||||
si->functions[si->nfunctions].group = group;
|
||||
si->functions[si->nfunctions].scltoken = scltoken;
|
||||
|
||||
@ -188,7 +188,7 @@ int handleDefFunctionGroup( void* fcbx, uint32_t streamid,
|
||||
|
||||
/* insert all data about the function */
|
||||
si->functiongroups[si->nfunctiongroups].deftoken = deftoken;
|
||||
si->functiongroups[si->nfunctiongroups].name = OTF_strdup( name );
|
||||
si->functiongroups[si->nfunctiongroups].name = strdup( name );
|
||||
|
||||
++(si->nfunctiongroups);
|
||||
|
||||
|
@ -258,7 +258,7 @@ int handleDefcommunicator( void *fcb, int communicator,
|
||||
fha->processgroups[fha->processgroupcount].id= mcommunicator;
|
||||
fha->processgroups[fha->processgroupcount].size= communicatorsize;
|
||||
fha->processgroups[fha->processgroupcount].procs= procs;
|
||||
fha->processgroups[fha->processgroupcount].name= OTF_strdup( tmp );
|
||||
fha->processgroups[fha->processgroupcount].name= strdup( tmp );
|
||||
|
||||
fha->processgroupcount++;
|
||||
|
||||
@ -340,7 +340,7 @@ int handleDefcpugrp( void *fcb, unsigned int cpugrpid,
|
||||
fha->processgroups[fha->processgroupcount].id= mpg;
|
||||
fha->processgroups[fha->processgroupcount].size= cpuorcpugrpidarraydim;
|
||||
fha->processgroups[fha->processgroupcount].procs= procs;
|
||||
fha->processgroups[fha->processgroupcount].name= OTF_strdup( cpugrpname );
|
||||
fha->processgroups[fha->processgroupcount].name= strdup( cpugrpname );
|
||||
|
||||
fha->processgroupcount++;
|
||||
|
||||
@ -364,7 +364,7 @@ int handleDefcpuname( void *fcb, unsigned int cpuid,
|
||||
return 0;
|
||||
}
|
||||
|
||||
((fcbT*)fcb)->processes[cpu][thread].name = OTF_strdup( cpuname );
|
||||
((fcbT*)fcb)->processes[cpu][thread].name = strdup( cpuname );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ int main (int argc, char **argv) {
|
||||
|
||||
} else if ( ( 0 == strcmp( "-o", argv[i] ) ) && ( i+1 < argc ) ) {
|
||||
|
||||
fcb.outputFile= OTF_strdup( argv[i+1] );
|
||||
fcb.outputFile= strdup( argv[i+1] );
|
||||
|
||||
++i;
|
||||
|
||||
@ -162,7 +162,7 @@ int main (int argc, char **argv) {
|
||||
printf( " no output file specified\n" );
|
||||
exit(1);
|
||||
*/
|
||||
outputFile= OTF_strdup( "out.otf" );
|
||||
outputFile= strdup( "out.otf" );
|
||||
}
|
||||
|
||||
if ( maxfilehandles < 1 ) {
|
||||
|
@ -2,17 +2,8 @@ AUTOMAKE_OPTIONS = -Wno-gnu
|
||||
|
||||
if AMBUILDBINARIES
|
||||
|
||||
if AMHAVECC
|
||||
WRAP_CC = vtcc
|
||||
else
|
||||
WRAP_CC =
|
||||
endif
|
||||
|
||||
if AMHAVECXX
|
||||
WRAP_CXX = vtcxx
|
||||
else
|
||||
WRAP_CXX =
|
||||
endif
|
||||
|
||||
if AMHAVEF77
|
||||
WRAP_F77 = vtf77
|
||||
@ -40,6 +31,9 @@ bin_PROGRAMS = $(WRAP_CC) $(WRAP_CXX) $(WRAP_F77) $(WRAP_FC)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/vtlib/
|
||||
|
||||
CC = $(CC_FOR_BUILD)
|
||||
CFLAGS = $(CFLAGS_FOR_BUILD)
|
||||
CPP = $(CPP_FOR_BUILD)
|
||||
CXX = $(CXX_FOR_BUILD)
|
||||
CXXFLAGS = $(CXXFLAGS_FOR_BUILD)
|
||||
CXXCPP = $(CXXCPP_FOR_BUILD)
|
||||
@ -49,15 +43,18 @@ LIBS = $(LIBS_FOR_BUILD)
|
||||
|
||||
AM_CXXFLAGS = -DDATADIR=\"$(datadir)\"
|
||||
|
||||
vtcc_SOURCES = compwrap.cc compwrap.h
|
||||
vtcc_SOURCES = compwrap.cc compwrap.h $(top_srcdir)/util/util.c
|
||||
vtcc_CXXFLAGS = $(AM_CXXFLAGS) -DWRAP_LANG_CC
|
||||
|
||||
vtcxx_SOURCES = $(vtcc_SOURCES)
|
||||
vtcxx_SOURCES = compwrap.cc compwrap.h
|
||||
vtcxx_CXXFLAGS = $(AM_CXXFLAGS) -DWRAP_LANG_CXX
|
||||
vtcxx_LDADD = util.$(OBJEXT)
|
||||
|
||||
vtf77_SOURCES = $(vtcc_SOURCES)
|
||||
vtf77_SOURCES = compwrap.cc compwrap.h
|
||||
vtf77_CXXFLAGS = $(AM_CXXFLAGS) -DWRAP_LANG_F77
|
||||
vtf77_LDADD = util.$(OBJEXT)
|
||||
|
||||
vtf90_SOURCES = $(vtcc_SOURCES)
|
||||
vtf90_SOURCES = compwrap.cc compwrap.h
|
||||
vtf90_CXXFLAGS = $(AM_CXXFLAGS) -DWRAP_LANG_F90
|
||||
vtf90_LDADD = util.$(OBJEXT)
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
#include "compwrap.h"
|
||||
|
||||
static bool ReadDataFile();
|
||||
@ -86,15 +88,15 @@ ReadDataFile()
|
||||
{
|
||||
bool error = false;
|
||||
|
||||
const unsigned int keys_num = 24;
|
||||
const unsigned int keys_num = 25;
|
||||
const std::string keys[] = {
|
||||
"version", "language", "compiler_env", "compiler_flags_env",
|
||||
"compiler", "compiler_flags", "linker_flags", "libs", "includedir",
|
||||
"libdir", "opari_bin", "opari_tab_compiler", "opari_tab_compiler_flags",
|
||||
"pmpilib", "fmpilib", "dynattlib", "compiler_iflags_gnu",
|
||||
"compiler_iflags_intel", "compiler_iflags_pathscale", "compiler_iflags_pgi",
|
||||
"compiler_iflags_sun", "compiler_iflags_xl", "compiler_iflags_ftrace",
|
||||
"inst_avail", "inst_default"
|
||||
"compiler_iflags_intel", "compiler_iflags_pathscale",
|
||||
"compiler_iflags_pgi", "compiler_iflags_sun", "compiler_iflags_xl",
|
||||
"compiler_iflags_ftrace", "inst_avail", "inst_default"
|
||||
};
|
||||
|
||||
std::string data_file = DATADIR"/" + ExeName + "-wrapper-data.txt";
|
||||
@ -1118,7 +1120,33 @@ Wrapper::show()
|
||||
{
|
||||
if( usesMPI() )
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s %s "VTHYBLIB" %s %s",
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1,
|
||||
"%s %s %s %s "VTHYBLIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
|
||||
Properties.fmpilib.c_str(),
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTOMPLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
}
|
||||
else if( usesMPI() )
|
||||
{
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s %s "VTMPILIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
@ -1127,43 +1155,18 @@ Wrapper::show()
|
||||
Properties.fmpilib.c_str(),
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
#endif
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTOMPLIB" %s",
|
||||
}
|
||||
else
|
||||
{
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTSEQLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
}
|
||||
else if( usesMPI() )
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s %s "VTMPILIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
|
||||
Properties.fmpilib.c_str(),
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTSEQLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
|
||||
std::cout << (showmeCompile() ? "" : Properties.comp_args) << " "
|
||||
@ -1265,54 +1268,56 @@ Wrapper::run()
|
||||
{
|
||||
if( usesMPI() )
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s %s "VTHYBLIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1,
|
||||
"%s %s %s %s "VTHYBLIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
|
||||
Properties.fmpilib.c_str(),
|
||||
Properties.fmpilib.c_str(),
|
||||
#else
|
||||
"",
|
||||
"",
|
||||
#endif
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTOMPLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTOMPLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( usesMPI() )
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s %s "VTMPILIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1,
|
||||
"%s %s %s %s "VTMPILIB" %s %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
#if defined(WRAP_LANG_F77) || defined(WRAP_LANG_F90)
|
||||
Properties.fmpilib.c_str(),
|
||||
Properties.fmpilib.c_str(),
|
||||
#else
|
||||
"",
|
||||
"",
|
||||
#endif
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
Properties.pmpilib.c_str(),
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTSEQLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
vt_snprintf( vtlib, sizeof(vtlib) - 1, "%s %s %s "VTSEQLIB" %s",
|
||||
Properties.comp_ldflags.c_str(),
|
||||
Properties.libdir.c_str(),
|
||||
getInstType() == INST_TYPE_DYNINST ?
|
||||
Properties.dynattlib.c_str() : "",
|
||||
Properties.comp_ulibs.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,9 @@ include_HEADERS = \
|
||||
../lib/opari_omp.h \
|
||||
../lib/pomp_lib.h
|
||||
|
||||
CC = $(CC_FOR_BUILD)
|
||||
CFLAGS = $(CFLAGS_FOR_BUILD)
|
||||
CPP = $(CPP_FOR_BUILD)
|
||||
CXX = $(CXX_FOR_BUILD)
|
||||
CXXFLAGS = $(CXXFLAGS_FOR_BUILD)
|
||||
CXXCPP = $(CXXCPP_FOR_BUILD)
|
||||
@ -28,7 +31,8 @@ opari_SOURCES = \
|
||||
opari.cc \
|
||||
process_c.cc \
|
||||
process_f.cc \
|
||||
process_omp.cc
|
||||
process_omp.cc \
|
||||
$(top_srcdir)/util/util.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
fixinc/cctype \
|
||||
|
@ -15,7 +15,6 @@
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
#include <cstdio>
|
||||
using std::sprintf;
|
||||
using std::remove;
|
||||
#include <cstring>
|
||||
using std::strcmp;
|
||||
@ -26,6 +25,8 @@
|
||||
#include <cstdlib>
|
||||
using std::exit;
|
||||
|
||||
#include "util/util.h"
|
||||
|
||||
#include "opari.h"
|
||||
#include "handler.h"
|
||||
|
||||
@ -163,8 +164,8 @@ int main (int argc, char *argv[]) {
|
||||
out_filename = new char[strlen(infile)+5];
|
||||
char* dot = (char *) strrchr(infile, '.');
|
||||
if ( dot != 0 ) {
|
||||
snprintf(out_filename, strlen(infile)+5, "%.*s.mod%s",
|
||||
(int)(dot - infile), infile, dot);
|
||||
vt_snprintf(out_filename, strlen(infile)+5, "%.*s.mod%s",
|
||||
(int)(dot - infile), infile, dot);
|
||||
|
||||
if ( keepSrcInfo && (lang & L_FORTRAN) ) {
|
||||
dot = strrchr(out_filename, '.');
|
||||
@ -223,16 +224,16 @@ int main (int argc, char *argv[]) {
|
||||
if ( dirsep ) {
|
||||
len = strlen(rcdir)+strlen(dirsep)+11+1;
|
||||
incfile = new char[len];
|
||||
snprintf(incfile, len - 1, "%s/%s.opari.inc", rcdir, dirsep+1);
|
||||
vt_snprintf(incfile, len - 1, "%s/%s.opari.inc", rcdir, dirsep+1);
|
||||
} else {
|
||||
len = strlen(rcdir)+strlen(infile)+12+1;
|
||||
incfile = new char[len];
|
||||
snprintf(incfile, len - 1, "%s/%s.opari.inc", rcdir, infile);
|
||||
vt_snprintf(incfile, len - 1, "%s/%s.opari.inc", rcdir, infile);
|
||||
}
|
||||
} else {
|
||||
len = strlen(infile)+10+1;
|
||||
incfile = new char[len];
|
||||
snprintf(incfile, len - 1, "%s.opari.inc", infile);
|
||||
vt_snprintf(incfile, len - 1, "%s.opari.inc", infile);
|
||||
}
|
||||
|
||||
// transform
|
||||
|
@ -10,8 +10,6 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
@ -107,11 +105,7 @@ main( int argc, char ** argv )
|
||||
{
|
||||
// set/overwrite environment variable VT_UNIFY to zero,
|
||||
// so VampirTrace don't unify local traces (DYNINST Bug?)
|
||||
#if HAVE_SETENV == 1
|
||||
setenv( "VT_UNIFY", "no", 1 );
|
||||
#else
|
||||
putenv( "VT_UNIFY=no" );
|
||||
#endif
|
||||
}
|
||||
|
||||
// create instance of mutator
|
||||
|
@ -29,5 +29,7 @@ vtfilter_SOURCES = \
|
||||
vt_otfhandler.cc \
|
||||
vt_tracefilter.cc
|
||||
|
||||
vtfilter_LDADD = $(OTFLIBRARY)
|
||||
vtfilter_LDADD = \
|
||||
$(top_builddir)/util/util.$(OBJEXT) \
|
||||
$(OTFLIBRARY)
|
||||
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "vt_otfhandler.h"
|
||||
#include "vt_filthandler.h"
|
||||
|
||||
#include "vt_fnmatch.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@ -552,7 +550,7 @@ int main( int argc, char** argv ) {
|
||||
|
||||
for( its = exsym.begin(); its != exsym.end(); ++its ) {
|
||||
|
||||
if( 0 == vt_fnmatch( its->c_str(), itf->name.c_str(), FNM_NOESCAPE ) ) {
|
||||
if( 0 == fnmatch( its->c_str(), itf->name.c_str(), FNM_NOESCAPE ) ) {
|
||||
extok.insert( itf->id );
|
||||
excluded = true;
|
||||
break;
|
||||
@ -564,7 +562,7 @@ int main( int argc, char** argv ) {
|
||||
|
||||
for( its = insym.begin(); its != insym.end(); ++its ) {
|
||||
|
||||
if( 0 == vt_fnmatch( its->c_str(), itf->name.c_str(), FNM_NOESCAPE ) ) {
|
||||
if( 0 == fnmatch( its->c_str(), itf->name.c_str(), FNM_NOESCAPE ) ) {
|
||||
intok.insert( itf->id );
|
||||
break;
|
||||
}
|
||||
@ -1186,7 +1184,7 @@ static map<uint32_t,uint64_t> readFilterFile( const string& filename, const map<
|
||||
while( token ) {
|
||||
map<string,uint32_t>::const_iterator it = nm2tok.begin();
|
||||
for( it = nm2tok.begin(); it != nm2tok.end(); ++it ) {
|
||||
if( vt_fnmatch(token, it->first.c_str(), FNM_NOESCAPE) == 0 ) {
|
||||
if( fnmatch(token, it->first.c_str(), FNM_NOESCAPE) == 0 ) {
|
||||
map<uint32_t,uint64_t>::const_iterator it2 = ret.find(it->second);
|
||||
if( it2 == ret.end() ) {
|
||||
ret.insert(pair<uint32_t,uint64_t>(it->second,ulimit));
|
||||
|
@ -38,5 +38,7 @@ vtunify_SOURCES = \
|
||||
vt_unify_stats_hdlr.cc \
|
||||
vt_unify_tkfac.cc
|
||||
|
||||
vtunify_LDADD = $(OTFLIBRARY)
|
||||
vtunify_LDADD = \
|
||||
$(top_builddir)/util/util.$(OBJEXT) \
|
||||
$(OTFLIBRARY)
|
||||
|
||||
|
7
ompi/contrib/vt/vt/util/Makefile.am
Обычный файл
7
ompi/contrib/vt/vt/util/Makefile.am
Обычный файл
@ -0,0 +1,7 @@
|
||||
noinst_PROGRAMS = dummy
|
||||
|
||||
dummy_SOURCES = \
|
||||
dummy.c \
|
||||
util.h \
|
||||
util.c
|
||||
|
6
ompi/contrib/vt/vt/util/dummy.c
Обычный файл
6
ompi/contrib/vt/vt/util/dummy.c
Обычный файл
@ -0,0 +1,6 @@
|
||||
#include "util.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
258
ompi/contrib/vt/vt/util/util.c
Обычный файл
258
ompi/contrib/vt/vt/util/util.c
Обычный файл
@ -0,0 +1,258 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
static int guess_strlen(const char* fmt, va_list ap)
|
||||
{
|
||||
char* sarg;
|
||||
double darg;
|
||||
float farg;
|
||||
size_t i;
|
||||
int iarg;
|
||||
int len;
|
||||
long larg;
|
||||
|
||||
/* Start off with a fudge factor of 128 to handle the % escapes that
|
||||
we aren't calculating here */
|
||||
|
||||
len = (int)strlen(fmt) + 128;
|
||||
for (i = 0; i < strlen(fmt); ++i) {
|
||||
if ('%' == fmt[i] && i + 1 < strlen(fmt) && '%' != fmt[i + 1]) {
|
||||
++i;
|
||||
switch (fmt[i]) {
|
||||
case 'c':
|
||||
(void)va_arg(ap, int);
|
||||
len += 1; /* let's suppose it's a printable char */
|
||||
break;
|
||||
case 's':
|
||||
sarg = va_arg(ap, char*);
|
||||
|
||||
/* If there's an arg, get the strlen, otherwise we'll
|
||||
* use (null) */
|
||||
|
||||
if (NULL != sarg) {
|
||||
len += (int)strlen(sarg);
|
||||
} else {
|
||||
len += 5;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
case 'i':
|
||||
iarg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (iarg < 0)
|
||||
++len;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
iarg /= 10;
|
||||
} while (0 != iarg);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
case 'X':
|
||||
iarg = va_arg(ap, int);
|
||||
/* Now get the log16 */
|
||||
do {
|
||||
++len;
|
||||
iarg /= 16;
|
||||
} while (0 != iarg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
farg = (float)va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (farg < 0) {
|
||||
++len;
|
||||
farg = -farg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
farg /= 10.0;
|
||||
} while (0 != farg);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
darg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (darg < 0) {
|
||||
++len;
|
||||
darg = -darg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
darg /= 10.0;
|
||||
} while (0 != darg);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
/* Get %ld %lx %lX %lf */
|
||||
if (i + 1 < strlen(fmt)) {
|
||||
++i;
|
||||
switch (fmt[i]) {
|
||||
case 'x':
|
||||
case 'X':
|
||||
larg = va_arg(ap, int);
|
||||
/* Now get the log16 */
|
||||
do {
|
||||
++len;
|
||||
larg /= 16;
|
||||
} while (0 != larg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
darg = va_arg(ap, int);
|
||||
/* Alloc for minus sign */
|
||||
if (darg < 0) {
|
||||
++len;
|
||||
darg = -darg;
|
||||
}
|
||||
/* Alloc for 3 decimal places + '.' */
|
||||
len += 4;
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
darg /= 10.0;
|
||||
} while (0 != darg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
default:
|
||||
larg = va_arg(ap, int);
|
||||
/* Now get the log10 */
|
||||
do {
|
||||
++len;
|
||||
larg /= 10;
|
||||
} while (0 != larg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int vt_asprintf(char** ptr, const char* fmt, ...)
|
||||
{
|
||||
int length;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
length = vt_vasprintf(ptr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int vt_vasprintf(char** ptr, const char* fmt, va_list ap)
|
||||
{
|
||||
int length;
|
||||
va_list ap2;
|
||||
|
||||
/* va_list might have pointer to internal state and using
|
||||
it twice is a bad idea. So make a copy for the second
|
||||
use. Copy order taken from Autoconf docs. */
|
||||
#if defined(HAVE_VA_COPY) && HAVE_VA_COPY
|
||||
va_copy(ap2, ap);
|
||||
#elif defined(HAVE_UNDERSCORE_VA_COPY) && HAVE_UNDERSCORE_VA_COPY
|
||||
__va_copy(ap2, ap);
|
||||
#else
|
||||
memcpy (&ap2, &ap, sizeof(va_list));
|
||||
#endif
|
||||
|
||||
/* guess the size */
|
||||
length = guess_strlen(fmt, ap);
|
||||
|
||||
/* allocate a buffer */
|
||||
*ptr = (char*) malloc((size_t) length + 1);
|
||||
if (NULL == *ptr) {
|
||||
errno = ENOMEM;
|
||||
va_end(ap2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* fill the buffer */
|
||||
length = vsprintf(*ptr, fmt, ap2);
|
||||
#if (defined(HAVE_VA_COPY) && HAVE_VA_COPY) || (defined(HAVE_UNDERSCORE_VA_COPY) && HAVE_UNDERSCORE_VA_COPY)
|
||||
va_end(ap2);
|
||||
#endif /* HAVE_VA_COPY || HAVE_UNDERSCORE_VA_COPY */
|
||||
|
||||
/* realloc */
|
||||
*ptr = (char*)realloc(*ptr, (size_t)length + 1);
|
||||
if (NULL == *ptr) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int vt_snprintf(char* str, size_t size, const char* fmt, ...)
|
||||
{
|
||||
int length;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
length = vt_vsnprintf(str, size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
int vt_vsnprintf(char* str, size_t size, const char* fmt, va_list ap)
|
||||
{
|
||||
int length;
|
||||
char* buf;
|
||||
|
||||
length = vt_vasprintf(&buf, fmt, ap);
|
||||
if (length < 0) {
|
||||
return length;
|
||||
}
|
||||
|
||||
/* return the length when given a null buffer (C99) */
|
||||
if (str) {
|
||||
if ((size_t) length < size) {
|
||||
strcpy(str, buf);
|
||||
} else {
|
||||
memcpy(str, buf, size - 1);
|
||||
str[size] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* free allocated buffer */
|
||||
free(buf);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
char* vt_strdup(const char* s)
|
||||
{
|
||||
char* c;
|
||||
|
||||
if (s == NULL || (c = (char*)malloc(strlen(s)+1)) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(c, s) ;
|
||||
|
||||
return c;
|
||||
}
|
19
ompi/contrib/vt/vt/util/util.h
Обычный файл
19
ompi/contrib/vt/vt/util/util.h
Обычный файл
@ -0,0 +1,19 @@
|
||||
#ifndef _UTIL_H
|
||||
#define _UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN extern "C"
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
EXTERN int vt_asprintf(char** ptr, const char* fmt, ...);
|
||||
EXTERN int vt_snprintf(char* str, size_t size, const char* fmt, ...);
|
||||
EXTERN int vt_vasprintf(char** ptr, const char* fmt, va_list ap);
|
||||
EXTERN int vt_vsnprintf(char* str, size_t size, const char* fmt, va_list ap);
|
||||
EXTERN char* vt_strdup(const char* s);
|
||||
|
||||
#endif /* _UTIL_H */
|
@ -149,7 +149,6 @@ VT_COMMON_SOURCES = \
|
||||
vt_env.h \
|
||||
vt_error.h \
|
||||
vt_fbindings.h \
|
||||
vt_fnmatch.h \
|
||||
vt_inttypes.h \
|
||||
vt_iowrap.h \
|
||||
vt_iowrap_helper.h \
|
||||
@ -165,7 +164,6 @@ VT_COMMON_SOURCES = \
|
||||
vt_otf_sum.h \
|
||||
vt_pform.h \
|
||||
vt_pomp.h \
|
||||
vt_strdup.h \
|
||||
vt_sync.h \
|
||||
vt_thrd.h \
|
||||
vt_trc.h \
|
||||
@ -183,7 +181,6 @@ VT_COMMON_SOURCES = \
|
||||
vt_otf_trc.c \
|
||||
vt_pform_@PLATFORM@.c \
|
||||
vt_pomp_base.c \
|
||||
vt_strdup.c \
|
||||
vt_thrd.c \
|
||||
vt_user_comment.c \
|
||||
vt_user_count.c \
|
||||
@ -209,24 +206,25 @@ VT_HYB_SOURCES = \
|
||||
CC = $(MPICC)
|
||||
AM_CFLAGS = -DBINDIR=\"$(bindir)\" -DDATADIR=\"$(datadir)\" $(RFGCFLAGS) $(BFDCFLAGS) $(MEMHOOKCFLAGS) $(IOWRAPCFLAGS) $(METRCFLAGS)
|
||||
|
||||
libvt_a_LIBADD = $(top_builddir)/util/util.$(OBJEXT)
|
||||
libvt_a_SOURCES = \
|
||||
$(VT_COMMON_SOURCES) \
|
||||
$(OPARILIBDIR)/pomp_fwrapper_base.c
|
||||
|
||||
libvt_mpi_a_CFLAGS = -DVT_MPI $(AM_CFLAGS) $(MPICFLAGS) $(MPIINCDIR)
|
||||
libvt_mpi_a_LIBADD = pomp_fwrapper_base.o
|
||||
libvt_mpi_a_LIBADD = pomp_fwrapper_base.$(OBJEXT) $(top_builddir)/util/util.$(OBJEXT)
|
||||
libvt_mpi_a_SOURCES = \
|
||||
$(VT_COMMON_SOURCES) \
|
||||
$(VT_MPI_SOURCES)
|
||||
|
||||
libvt_omp_a_CFLAGS = $(OMPFLAG) -DVT_OMP $(AM_CFLAGS)
|
||||
libvt_omp_a_LIBADD = pomp_fwrapper_base.o
|
||||
libvt_omp_a_LIBADD = pomp_fwrapper_base.$(OBJEXT) $(top_builddir)/util/util.$(OBJEXT)
|
||||
libvt_omp_a_SOURCES = \
|
||||
$(VT_COMMON_SOURCES) \
|
||||
$(VT_OMP_SOURCES)
|
||||
|
||||
libvt_ompi_a_CFLAGS = $(OMPFLAG) -DVT_OMPI $(AM_CFLAGS) $(MPICFLAGS) $(MPIINCDIR)
|
||||
libvt_ompi_a_LIBADD = pomp_fwrapper_base.o
|
||||
libvt_ompi_a_LIBADD = pomp_fwrapper_base.$(OBJEXT) $(top_builddir)/util/util.$(OBJEXT)
|
||||
libvt_ompi_a_SOURCES = \
|
||||
$(VT_COMMON_SOURCES) \
|
||||
$(VT_HYB_SOURCES)
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "rfg_filter.h"
|
||||
#include "rfg_strmkrs.h"
|
||||
|
||||
#include "vt_fnmatch.h"
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -95,7 +95,7 @@ int RFG_Filter_setDefFile( RFG_Filter* filter, const char* deffile )
|
||||
|
||||
/* set new filter definition file */
|
||||
|
||||
filter->deffile = vt_strdup( deffile );
|
||||
filter->deffile = strdup( deffile );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -161,7 +161,7 @@ int RFG_Filter_readDefFile( RFG_Filter* filter )
|
||||
|
||||
/* copy line so that the original line keep alive */
|
||||
|
||||
line = vt_strdup( orgline );
|
||||
line = strdup( orgline );
|
||||
|
||||
lineno++;
|
||||
|
||||
@ -308,7 +308,7 @@ int RFG_Filter_addCLimit( RFG_Filter* filter, int32_t climit,
|
||||
if( entry->pattern == NULL )
|
||||
return 0;
|
||||
|
||||
entry->pattern[entry->npattern++] = vt_strdup( pattern );
|
||||
entry->pattern[entry->npattern++] = strdup( pattern );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -327,7 +327,7 @@ int RFG_Filter_get( RFG_Filter* filter, const char* rname,
|
||||
{
|
||||
for( j = 0; j < filter->climits[i].npattern; j++ )
|
||||
{
|
||||
if( vt_fnmatch( filter->climits[i].pattern[j], rname, 0 ) == 0 )
|
||||
if( fnmatch( filter->climits[i].pattern[j], rname, 0 ) == 0 )
|
||||
{
|
||||
*r_climit = filter->climits[i].climit;
|
||||
return 1;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "rfg_groups.h"
|
||||
#include "rfg_strmkrs.h"
|
||||
|
||||
#include "vt_fnmatch.h"
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -46,7 +46,7 @@ RFG_Groups* RFG_Groups_init()
|
||||
/* some initializes of data structure elements */
|
||||
|
||||
ret->deffile = NULL;
|
||||
ret->default_group = vt_strdup( "Application" );
|
||||
ret->default_group = strdup( "Application" );
|
||||
|
||||
ret->nassigns = 0;
|
||||
ret->assigns = NULL;
|
||||
@ -102,7 +102,7 @@ int RFG_Groups_setDefFile( RFG_Groups* groups, const char* deffile )
|
||||
|
||||
/* set new group definition file */
|
||||
|
||||
groups->deffile = vt_strdup( deffile );
|
||||
groups->deffile = strdup( deffile );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -118,7 +118,7 @@ int RFG_Groups_setDefaultGroup( RFG_Groups* groups, const char* name )
|
||||
|
||||
/* set new default group */
|
||||
|
||||
groups->default_group = vt_strdup( name );
|
||||
groups->default_group = strdup( name );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -166,7 +166,7 @@ int RFG_Groups_readDefFile( RFG_Groups* groups )
|
||||
|
||||
/* copy line so that the original line keep alive */
|
||||
|
||||
line = vt_strdup( orgline );
|
||||
line = strdup( orgline );
|
||||
|
||||
lineno++;
|
||||
|
||||
@ -286,7 +286,7 @@ int RFG_Groups_addAssign( RFG_Groups* groups, const char* gname,
|
||||
return 0;
|
||||
|
||||
entry = &(groups->assigns[groups->nassigns++]);
|
||||
entry->group = vt_strdup( gname );
|
||||
entry->group = strdup( gname );
|
||||
entry->npattern = 0;
|
||||
entry->pattern = NULL;
|
||||
}
|
||||
@ -306,7 +306,7 @@ int RFG_Groups_addAssign( RFG_Groups* groups, const char* gname,
|
||||
if( entry->pattern == NULL )
|
||||
return 0;
|
||||
|
||||
entry->pattern[entry->npattern++] = vt_strdup( pattern );
|
||||
entry->pattern[entry->npattern++] = strdup( pattern );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -325,7 +325,7 @@ int RFG_Groups_get( RFG_Groups* groups, const char* rname,
|
||||
{
|
||||
for( j = 0; j < groups->assigns[i].npattern; j++ )
|
||||
{
|
||||
if( vt_fnmatch( groups->assigns[i].pattern[j], rname, 0 ) == 0 )
|
||||
if( fnmatch( groups->assigns[i].pattern[j], rname, 0 ) == 0 )
|
||||
{
|
||||
*r_gname = groups->assigns[i].group;
|
||||
return 1;
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "rfg_regions.h"
|
||||
#include "rfg_filter.h"
|
||||
#include "rfg_groups.h"
|
||||
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@ -405,8 +406,8 @@ static void hash_put( RFG_RegionInfo** htab, uint32_t h,
|
||||
uint32_t id = h % HASH_MAX;
|
||||
RFG_RegionInfo* add = ( RFG_RegionInfo* )malloc( sizeof( RFG_RegionInfo ) );
|
||||
add->regionId = h;
|
||||
add->groupName = vt_strdup( g );
|
||||
add->regionName = vt_strdup( r );
|
||||
add->groupName = strdup( g );
|
||||
add->regionName = strdup( r );
|
||||
add->callLimit = l;
|
||||
add->callLimitCD = l;
|
||||
add->next = htab[id];
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_memhook.h"
|
||||
#include "vt_pform.h"
|
||||
#include "vt_strdup.h"
|
||||
#include "vt_trc.h"
|
||||
#if defined (VT_OMPI) || defined (VT_OMP)
|
||||
# include <omp.h>
|
||||
@ -95,8 +94,8 @@ static HashNode *register_region(long addr, char* func, char* file, int lno) {
|
||||
fid = vt_def_file(file);
|
||||
rid = vt_def_region(func, fid, lno, VT_NO_LNO, VT_DEF_GROUP, VT_FUNCTION);
|
||||
nhn = hash_put(addr, rid);
|
||||
nhn->func = vt_strdup(func);
|
||||
nhn->file = vt_strdup(file);
|
||||
nhn->func = strdup(func);
|
||||
nhn->file = strdup(file);
|
||||
nhn->lno = lno;
|
||||
return nhn;
|
||||
}
|
||||
@ -287,13 +286,8 @@ void VT_Dyn_attach()
|
||||
}
|
||||
default:
|
||||
{
|
||||
/* set/overwrite environment variable VT_UNIFY to zero,
|
||||
so VampirTrace don't unify local traces (DYNINST Bug?) */
|
||||
#if defined(HAVE_SETENV) && HAVE_SETENV
|
||||
setenv("VT_UNIFY", "no", 1);
|
||||
#else /* HAVE_SETENV */
|
||||
/* disable unifying local traces */
|
||||
putenv("VT_UNIFY=no");
|
||||
#endif
|
||||
|
||||
/* Wait until mutator send signal to continue execution
|
||||
*/
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "vt_error.h"
|
||||
#include "vt_memhook.h"
|
||||
#include "vt_pform.h"
|
||||
#include "vt_strdup.h"
|
||||
#include "vt_trc.h"
|
||||
#if (defined (VT_OMPI) || defined (VT_OMP))
|
||||
# include <omp.h>
|
||||
@ -64,7 +63,7 @@ static void hash_put(long h, const char* n, const char* fn, int lno) {
|
||||
HashNode *add = (HashNode*)malloc(sizeof(HashNode));
|
||||
add->id = h;
|
||||
add->name = n;
|
||||
add->fname = fn ? (const char*)vt_strdup(fn) : fn;
|
||||
add->fname = fn ? (const char*)strdup(fn) : fn;
|
||||
add->lno = lno;
|
||||
add->vtid = VT_NO_ID;
|
||||
add->next = htab[id];
|
||||
@ -198,7 +197,7 @@ static void get_symtab_bfd(void) {
|
||||
if( dem_name ) {
|
||||
hash_put(addr, dem_name, filename, lno);
|
||||
} else {
|
||||
char *n = vt_strdup(syms[i]->name);
|
||||
char *n = strdup(syms[i]->name);
|
||||
hash_put(addr, n, filename, lno);
|
||||
}
|
||||
}
|
||||
@ -276,7 +275,7 @@ static void get_symtab_nm(const char* nmfilename)
|
||||
/* add symbol to hash table */
|
||||
if( nc >= 3 )
|
||||
{
|
||||
char* n = vt_strdup(funcname);
|
||||
char* n = strdup(funcname);
|
||||
hash_put(addr, n, filename, lno);
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,7 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "vt_env.h"
|
||||
#include "vt_error.h"
|
||||
#include "vt_defs.h"
|
||||
#include "vt_pform.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -21,6 +18,11 @@
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "vt_env.h"
|
||||
#include "vt_error.h"
|
||||
#include "vt_defs.h"
|
||||
#include "vt_pform.h"
|
||||
|
||||
#define VT_MAX_THREADS 65536
|
||||
|
||||
static char* replace_vars(char *v) {
|
||||
@ -357,6 +359,27 @@ int vt_env_is_verbose()
|
||||
return verbose;
|
||||
}
|
||||
|
||||
int vt_env_debug()
|
||||
{
|
||||
static int debug = -1;
|
||||
char* tmp;
|
||||
|
||||
if (debug == -1)
|
||||
{
|
||||
tmp = getenv("VT_DEBUG");
|
||||
if (tmp != NULL && strlen(tmp) > 0)
|
||||
{
|
||||
debug = atoi(tmp);
|
||||
if (debug < 0) debug = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug = 0;
|
||||
}
|
||||
}
|
||||
return debug;
|
||||
}
|
||||
|
||||
int vt_env_do_demangle()
|
||||
{
|
||||
static int do_demangle = -1;
|
||||
|
@ -32,6 +32,7 @@ EXTERN int vt_env_mode(void);
|
||||
EXTERN int vt_env_stat_intv(void);
|
||||
EXTERN int vt_env_stat_show(void);
|
||||
EXTERN int vt_env_is_verbose(void);
|
||||
EXTERN int vt_env_debug(void);
|
||||
EXTERN int vt_env_do_demangle(void);
|
||||
EXTERN int vt_env_do_unify(void);
|
||||
EXTERN int vt_env_do_clean(void);
|
||||
|
@ -10,9 +10,7 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "vt_error.h"
|
||||
#include "vt_env.h"
|
||||
#include "vt_iowrap.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -20,6 +18,10 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vt_error.h"
|
||||
#include "vt_env.h"
|
||||
#include "vt_iowrap.h"
|
||||
|
||||
#define VT_MSG_PFIX "VampirTrace"
|
||||
#define VT_MSG_SIZE 1024
|
||||
|
||||
@ -90,19 +92,15 @@ void vt_cntl_msg(const char* fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
inline void vt_debug_msg(int level, const char* fmt, ...)
|
||||
void vt_debug_msg(int level, const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#if defined(VT_DEBUG) && (VT_DEBUG > 0)
|
||||
if( level <= VT_DEBUG ) {
|
||||
|
||||
if( vt_env_debug() >= level ) {
|
||||
va_start(ap, fmt);
|
||||
vt_print_msg(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#else
|
||||
va_start(ap, fmt); /* only for avoiding a compiler warning */
|
||||
va_end(ap);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
/**
|
||||
* VampirTrace
|
||||
* http://www.tu-dresden.de/zih/vampirtrace
|
||||
*
|
||||
* Copyright (c) 2005-2008, ZIH, TU Dresden, Federal Republic of Germany
|
||||
*
|
||||
* Copyright (c) 1998-2005, Forschungszentrum Juelich GmbH, Federal
|
||||
* Republic of Germany
|
||||
*
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#ifndef _VT_FNMATCH_H
|
||||
#define _VT_FNMATCH_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_FNMATCH_H) && HAVE_FNMATCH_H
|
||||
# include <fnmatch.h>
|
||||
# define vt_fnmatch fnmatch
|
||||
#else /* HAVE_FNMATCH_H */
|
||||
# include <string.h>
|
||||
# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
|
||||
# define vt_fnmatch(_pattern, _string, __flags) \
|
||||
strcmp(_string, _pattern)
|
||||
#endif /* HAVE_FNMATCH_H */
|
||||
|
||||
#endif /* _VT_FNMATCH_H */
|
@ -10,10 +10,14 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -20,7 +22,6 @@
|
||||
#include "vt_env.h"
|
||||
#include "vt_error.h"
|
||||
#include "vt_metric.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
/* metricmap operations */
|
||||
|
||||
@ -49,8 +50,8 @@ static vt_metricmap_t* vt_metricmap_append(vt_metricmap_t* map,
|
||||
}
|
||||
|
||||
map->type = type;
|
||||
map->event_name = vt_strdup(event);
|
||||
map->alias_name = vt_strdup(alias);
|
||||
map->event_name = strdup(event);
|
||||
map->alias_name = strdup(alias);
|
||||
map->next = NULL;
|
||||
|
||||
return map;
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "vt_error.h"
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_metric.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <papi.h>
|
||||
|
||||
@ -57,7 +56,7 @@ static void metricv_add(char* name, int code)
|
||||
VT_METRIC_MAXNUM);
|
||||
else {
|
||||
metricv[nmetrics] = (struct metric*)malloc(sizeof(struct metric));
|
||||
metricv[nmetrics]->name = vt_strdup(name);
|
||||
metricv[nmetrics]->name = strdup(name);
|
||||
metricv[nmetrics]->descr[0] = '\0';
|
||||
metricv[nmetrics]->papi_code = code;
|
||||
nmetrics++;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_metric.h"
|
||||
#include "vt_pform.h"
|
||||
#include "vt_strdup.h"
|
||||
#include "vt_trc.h"
|
||||
|
||||
#include <unistd.h>
|
||||
@ -1055,7 +1054,7 @@ void VTGen_write_DEFINITION_COMMENT(VTGen* gen,
|
||||
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefinitionComment;
|
||||
new_entry->length = length;
|
||||
new_entry->comment = vt_strdup(comment);
|
||||
new_entry->comment = strdup(comment);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1079,7 +1078,7 @@ void VTGen_write_DEF_SCL_FILE(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefSclFile;
|
||||
new_entry->length = length;
|
||||
new_entry->fid = fid;
|
||||
new_entry->fname = vt_strdup(fname);
|
||||
new_entry->fname = strdup(fname);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1128,7 +1127,7 @@ void VTGen_write_DEF_FILE_GROUP(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefFileGroup;
|
||||
new_entry->length = length;
|
||||
new_entry->gid = gid;
|
||||
new_entry->gname = vt_strdup(gname);
|
||||
new_entry->gname = strdup(gname);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1153,7 +1152,7 @@ void VTGen_write_DEF_FILE(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefFile;
|
||||
new_entry->length = length;
|
||||
new_entry->fid = fid;
|
||||
new_entry->fname = vt_strdup(fname);
|
||||
new_entry->fname = strdup(fname);
|
||||
new_entry->gid = gid;
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
@ -1178,7 +1177,7 @@ void VTGen_write_DEF_FUNCTION_GROUP(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefFunctionGroup;
|
||||
new_entry->length = length;
|
||||
new_entry->rdid = rdid;
|
||||
new_entry->rdesc = vt_strdup(rdesc);
|
||||
new_entry->rdesc = strdup(rdesc);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1204,7 +1203,7 @@ void VTGen_write_DEF_FUNCTION(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefFunction;
|
||||
new_entry->length = length;
|
||||
new_entry->rid = rid;
|
||||
new_entry->rname = vt_strdup(rname);
|
||||
new_entry->rname = strdup(rname);
|
||||
new_entry->rdid = rdid;
|
||||
new_entry->sid = sid;
|
||||
|
||||
@ -1231,7 +1230,7 @@ void VTGen_write_DEF_COLLECTIVE_OPERATION(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefCollectiveOperation;
|
||||
new_entry->length = length;
|
||||
new_entry->cid = cid;
|
||||
new_entry->cname = vt_strdup(cname);
|
||||
new_entry->cname = strdup(cname);
|
||||
new_entry->ctype = ctype;
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
@ -1256,7 +1255,7 @@ void VTGen_write_DEF_COUNTER_GROUP(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefCounterGroup;
|
||||
new_entry->length = length;
|
||||
new_entry->gid = gid;
|
||||
new_entry->gname = vt_strdup(gname);
|
||||
new_entry->gname = strdup(gname);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1283,10 +1282,10 @@ void VTGen_write_DEF_COUNTER(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefCounter;
|
||||
new_entry->length = length;
|
||||
new_entry->cid = cid;
|
||||
new_entry->cname = vt_strdup(cname);
|
||||
new_entry->cname = strdup(cname);
|
||||
new_entry->cprop = cprop;
|
||||
new_entry->gid = gid;
|
||||
new_entry->cunit = vt_strdup(cunit);
|
||||
new_entry->cunit = strdup(cunit);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
@ -1312,7 +1311,7 @@ void VTGen_write_DEF_PROCESS_GROUP(VTGen* gen,
|
||||
new_entry->type = BUF_ENTRY_TYPE__DefProcessGroup;
|
||||
new_entry->length = length;
|
||||
new_entry->cid = cid;
|
||||
new_entry->grpn = vt_strdup(grpn);
|
||||
new_entry->grpn = strdup(grpn);
|
||||
new_entry->grpc = grpc;
|
||||
new_entry->grpv = (uint32_t*)calloc(grpc, sizeof(uint32_t));
|
||||
if(new_entry->grpv == NULL)
|
||||
@ -1525,7 +1524,7 @@ void VTGen_write_COMMENT(VTGen* gen, uint64_t* time,
|
||||
new_entry->type = BUF_ENTRY_TYPE__Comment;
|
||||
new_entry->length = length;
|
||||
new_entry->time = *time;
|
||||
new_entry->comment = vt_strdup(comment);
|
||||
new_entry->comment = strdup(comment);
|
||||
|
||||
VTGEN_JUMP(gen, length);
|
||||
VTGEN_CHECK_FLUSHCNTR(gen);
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "vt_memreg.h"
|
||||
#include "vt_metric.h"
|
||||
#include "vt_pform.h"
|
||||
#include "vt_strdup.h"
|
||||
#include "vt_error.h"
|
||||
|
||||
#include <limits.h>
|
||||
@ -92,7 +91,7 @@ static void hash_put(int t, const char* n, int i) {
|
||||
if(t==HASH_TAB__RDESC)
|
||||
{
|
||||
HashNode_rdesc *add = (HashNode_rdesc*)malloc(sizeof(HashNode_rdesc));
|
||||
add->rdesc = vt_strdup(n);
|
||||
add->rdesc = strdup(n);
|
||||
add->rdid = i;
|
||||
add->next = htab_rdesc[id];
|
||||
htab_rdesc[id] = add;
|
||||
@ -100,7 +99,7 @@ static void hash_put(int t, const char* n, int i) {
|
||||
else if(t==HASH_TAB__FILE)
|
||||
{
|
||||
HashNode_file *add = (HashNode_file*)malloc(sizeof(HashNode_file));
|
||||
add->fname = vt_strdup(n);
|
||||
add->fname = strdup(n);
|
||||
add->fid = i;
|
||||
add->next = htab_file[id];
|
||||
htab_file[id] = add;
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "vt_pform.h"
|
||||
#include "vt_error.h"
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -134,7 +133,7 @@ void vt_pform_init() {
|
||||
if(exec_len != -1)
|
||||
{
|
||||
exec[exec_len] = '\0';
|
||||
vt_exec = vt_strdup(exec);
|
||||
vt_exec = strdup(exec);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
/**
|
||||
* VampirTrace
|
||||
* http://www.tu-dresden.de/zih/vampirtrace
|
||||
*
|
||||
* Copyright (c) 2005-2008, ZIH, TU Dresden, Federal Republic of Germany
|
||||
*
|
||||
* Copyright (c) 1998-2005, Forschungszentrum Juelich GmbH, Federal
|
||||
* Republic of Germany
|
||||
*
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "vt_strdup.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *vt_strdup(const char *s)
|
||||
{
|
||||
char *c;
|
||||
|
||||
if( s == NULL || ( c = (char*)malloc( strlen(s)+1 ) ) == NULL )
|
||||
return NULL;
|
||||
|
||||
strcpy( c, s );
|
||||
|
||||
return c;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* VampirTrace
|
||||
* http://www.tu-dresden.de/zih/vampirtrace
|
||||
*
|
||||
* Copyright (c) 2005-2008, ZIH, TU Dresden, Federal Republic of Germany
|
||||
*
|
||||
* Copyright (c) 1998-2005, Forschungszentrum Juelich GmbH, Federal
|
||||
* Republic of Germany
|
||||
*
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#ifndef _VT_STRDUP_H
|
||||
#define _VT_STRDUP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN extern "C"
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN char *vt_strdup(const char *s);
|
||||
|
||||
#endif /* _VT_STRDUP_H */
|
@ -10,6 +10,8 @@
|
||||
* See the file COPYRIGHT in the package base directory for details
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "vt_thrd.h"
|
||||
#include "vt_metric.h"
|
||||
#include "vt_pform.h"
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user