1
1
- configure: VPATH building: Moved adding of -I$top_srcdir to CPPFLAGS to the end of configure to prevent using this flags for configure checks
	- VT libs: Fixed potential segmentation fault (infinite recursion) when writing intermediate statistics (VT_STAT_INTV != 0)
	- vtunify: Fixed header include to disable OpenMP in the library version of vtunify (libvt-mpi-unify)
	- fixed several Coverity warnings

This commit was SVN r28187.
Этот коммит содержится в:
Matthias Jurenz 2013-03-20 15:22:21 +00:00
родитель 147c6ff9e7
Коммит cf926da7e1
10 изменённых файлов: 88 добавлений и 90 удалений

Просмотреть файл

@ -7,6 +7,8 @@
- fixed a potential minor bug in CUPTI activity stream handling - fixed a potential minor bug in CUPTI activity stream handling
- workaround for CUDA 5.0 bug: do not call cuDeviceSynchronize(), if - workaround for CUDA 5.0 bug: do not call cuDeviceSynchronize(), if
stream reuse is enabled and a CUDA stream is about to be destroyed stream reuse is enabled and a CUDA stream is about to be destroyed
- fixed segmentation fault when writing intermediate statistics
(VT_STAT_INTV != 0)
- vtdyn: do not instrument regions where using a trap is required - vtdyn: do not instrument regions where using a trap is required
- plugin counters: Merge a set of post-mortem counters and write them - plugin counters: Merge a set of post-mortem counters and write them
under a single async key. This speeds up the unification. under a single async key. This speeds up the unification.

Просмотреть файл

@ -63,12 +63,7 @@ AS_IF([test "$?" = "0"],
[AC_MSG_ERROR([VampirTrace does not allow whitespace in the source directory path!])]) [AC_MSG_ERROR([VampirTrace does not allow whitespace in the source directory path!])])
AC_SUBST(top_vt_srcdir) AC_SUBST(top_vt_srcdir)
AS_IF([test "$top_vt_builddir" != "$top_vt_srcdir"], AS_IF([test "$top_vt_builddir" != "$top_vt_srcdir"],
[ [AC_MSG_NOTICE([detected VPATH build])])
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"
])
# Check for file system case sensitivity # Check for file system case sensitivity
ACVT_CSFS ACVT_CSFS
@ -464,6 +459,14 @@ AS_IF([test x"$enable_config_titles" = "xyes" -a x"$check_vtrun" = "xno"],
[AC_MSG_NOTICE([disabled via command line switch])]) [AC_MSG_NOTICE([disabled via command line switch])])
AM_CONDITIONAL(AMBUILDVTRUN, test x"$build_vtrun" = "xyes") AM_CONDITIONAL(AMBUILDVTRUN, test x"$build_vtrun" = "xyes")
# If it's a VPATH build, add the top-level source directory as an include path
# to find '<srcdir>/config_bottom.h' and '<srcdir>/util/util.h'
AS_IF([test "$top_vt_builddir" != "$top_vt_srcdir"],
[
CPPFLAGS='-I$(top_srcdir)'" $CPPFLAGS"
CPPFLAGS_FOR_BUILD='-I$(top_srcdir)'" $CPPFLAGS_FOR_BUILD"
])
# Output files # Output files
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
extlib/Makefile extlib/Makefile

Просмотреть файл

@ -8,10 +8,13 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define MAX_LINE_LEN 0x20000 /* max. file line length */ #define MAX_LINE_LEN 0x20000 /* max. file line length */
@ -96,50 +99,49 @@ struct RFG_Filter_struct
static int get_file_content( RFG_Filter* filter ) static int get_file_content( RFG_Filter* filter )
{ {
FILE* f; int ret = 1;
size_t i;
uint8_t err = 0; int fd;
const size_t bsize = 1024;
if( !filter || !filter->file_name || *(filter->file_name) == '\0' ) if( !filter || !filter->file_name || *(filter->file_name) == '\0' )
return 0; return 0;
/* open filter definition file */ /* open the filter file */
if( ( fd = open( filter->file_name, O_RDONLY ) ) == -1 )
f = fopen( filter->file_name, "r" );
if( !f )
return 0; return 0;
filter->file_content = (char*)malloc( bsize * sizeof( char ) ); do
if( !filter->file_content ) err = 1;
else filter->file_content_size = bsize;
i = 0;
while( !err && ( ( filter->file_content[i++] = fgetc( f ) ) != (char)EOF ) )
{ {
/* enlarge buffer, if necessary */ struct stat file_stat;
if( i == filter->file_content_size ) /* get the file size */
if( fstat(fd, &file_stat) == -1 || file_stat.st_size == 0 )
{ {
filter->file_content = ret = 0;
(char*)realloc( filter->file_content, break;
( filter->file_content_size + bsize ) * sizeof( char ) );
if( !filter->file_content )
{
err = 1;
break;
}
filter->file_content_size += bsize;
} }
}
/* append '\0' to buffer */ /* allocate the buffer for storing the filter file content */
if( !err) filter->file_content[i-1] = '\0'; filter->file_content = (char*)malloc( file_stat.st_size * sizeof( char ) );
if( !filter->file_content )
{
ret = 0;
break;
}
/* close filter definition file */ /* read the filter file */
fclose( f ); if( read(fd, filter->file_content, file_stat.st_size ) == -1 )
{
ret = 0;
break;
}
return (int)!err; } while( 0 );
/* close the filter file */
close( fd );
return ret;
} }
static int get_file_content_line( RFG_Filter* filter, char* buf, static int get_file_content_line( RFG_Filter* filter, char* buf,
@ -993,7 +995,7 @@ int RFG_Filter_getCallPathRules( RFG_Filter* filter, uint32_t hash,
{ {
RFG_FilterCallPathRulesHN* cpath_rules_hn; RFG_FilterCallPathRulesHN* cpath_rules_hn;
if( !filter && !r_callLimit ) if( !filter || !r_callLimit )
return 0; return 0;
if( size == 0 || size > RFG_FILTER_MAX_CPATH_SIZE ) if( size == 0 || size > RFG_FILTER_MAX_CPATH_SIZE )

Просмотреть файл

@ -89,7 +89,7 @@ namespace {
if ( line >= outer->lines.size() ) return; if ( line >= outer->lines.size() ) return;
pos = outer->lines[line].find(sentinel) + slen; pos = outer->lines[line].find(sentinel) + slen;
pos = outer->lines[line].find_first_not_of(" \t", pos); pos = outer->lines[line].find_first_not_of(" \t", pos);
if ( outer->lines[line][pos] == '&' ) ++pos; if ( pos != string::npos && outer->lines[line][pos] == '&' ) ++pos;
optr = &(outer->lines[line][pos]); optr = &(outer->lines[line][pos]);
iptr = &(inner->lines[line][pos]); iptr = &(inner->lines[line][pos]);
} }

Просмотреть файл

@ -18,7 +18,7 @@
// //
HooksProcessMarginsC::HooksProcessMarginsC() : HooksBaseC(), HooksProcessMarginsC::HooksProcessMarginsC() : HooksBaseC(),
m_maxThreads( 1 ) m_maxThreads( 1 ), m_threadContexts( 0 )
{ {
// Empty // Empty
} }

Просмотреть файл

@ -13,7 +13,7 @@
#ifndef _VT_UNIFY_H_ #ifndef _VT_UNIFY_H_
#define _VT_UNIFY_H_ #define _VT_UNIFY_H_
#include "config.h" #include "vt_unify_config.h"
#ifdef VT_MPI #ifdef VT_MPI
# include "vt_unify_mpi.h" # include "vt_unify_mpi.h"

Просмотреть файл

@ -628,6 +628,7 @@ readDataFile()
break; break;
} }
case 31: // partype_default case 31: // partype_default
default:
{ {
if( value.compare( "seq" ) == 0 ) if( value.compare( "seq" ) == 0 )
{ {
@ -655,14 +656,6 @@ readDataFile()
} }
break; break;
} }
default:
{
std::cerr << ExeName << ": "
<< data_file << ":" << line_no << ": "
<< "could not be parsed" << std::endl;
error = true;
break;
}
} }
} }

Просмотреть файл

@ -242,7 +242,7 @@ VTGen* VTGen_open(const char* tname, const char* tnamesuffix,
void VTGen_guarantee(VTGen* gen, uint64_t* time, size_t size) void VTGen_guarantee(VTGen* gen, uint64_t* time, size_t size)
{ {
if (time) if (!time)
{ {
VTGEN_ALLOC(gen, VTGEN_ALIGN_LENGTH(size)); VTGEN_ALLOC(gen, VTGEN_ALIGN_LENGTH(size));
} }

Просмотреть файл

@ -98,7 +98,7 @@ struct vt_plugin_cntr_defines {
/* called when activating events */ /* called when activating events */
static void maybe_register_new_thread(VTThrd * thrd, uint32_t tid); static void maybe_register_new_thread(VTThrd * thrd, uint32_t tid);
/* called when activating events */ /* called when activating events */
static void add_events(struct vt_plugin current_plugin, VTThrd * thrd); static void add_events(const struct vt_plugin * current_plugin, VTThrd * thrd);
static uint32_t post_mortem_asynch_key(void); static uint32_t post_mortem_asynch_key(void);
@ -571,7 +571,7 @@ void vt_plugin_cntr_thread_init(VTThrd * thrd, uint32_t tid) {
maybe_register_new_thread(thrd, tid); maybe_register_new_thread(thrd, tid);
/* now, that the thread is registered, register the counters */ /* now, that the thread is registered, register the counters */
add_events(vt_plugin_handles[i][j], thrd); add_events(&(vt_plugin_handles[i][j]), thrd);
} }
} }
@ -742,64 +742,64 @@ static void maybe_register_new_thread(VTThrd * thrd, uint32_t tid) {
} }
} }
static void add_events(struct vt_plugin current_plugin, VTThrd * thrd) { static void add_events(const struct vt_plugin * current_plugin, VTThrd * thrd) {
int j; int j;
struct vt_plugin_single_counter * current; struct vt_plugin_single_counter * current;
uint32_t * current_size; uint32_t * current_size;
struct vt_plugin_cntr_defines * plugin_cntr_defines = struct vt_plugin_cntr_defines * plugin_cntr_defines =
(struct vt_plugin_cntr_defines *) thrd->plugin_cntr_defines; (struct vt_plugin_cntr_defines *) thrd->plugin_cntr_defines;
/* get the current counters for this thread and synch type*/ /* get the current counters for this thread and synch type*/
current = plugin_cntr_defines->counters[current_plugin.info.synch]; current = plugin_cntr_defines->counters[current_plugin->info.synch];
if (current == NULL) { if (current == NULL) {
plugin_cntr_defines->counters[current_plugin.info.synch] = plugin_cntr_defines->counters[current_plugin->info.synch] =
calloc(VT_PLUGIN_COUNTERS_PER_THREAD, sizeof(struct vt_plugin_single_counter)); calloc(VT_PLUGIN_COUNTERS_PER_THREAD, sizeof(struct vt_plugin_single_counter));
current = plugin_cntr_defines->counters[current_plugin.info.synch]; current = plugin_cntr_defines->counters[current_plugin->info.synch];
} }
/* get the number of counters for this thread and synch type*/ /* get the number of counters for this thread and synch type*/
current_size current_size
= &(plugin_cntr_defines->size_of_counters[current_plugin.info.synch]); = &(plugin_cntr_defines->size_of_counters[current_plugin->info.synch]);
vt_cntl_msg(3, "Process %i Thread %s-%s adds own plugin metrics", vt_cntl_msg(3, "Process %i Thread %s-%s adds own plugin metrics",
vt_my_ptrace, thrd->name, thrd->name_suffix); vt_my_ptrace, thrd->name, thrd->name_suffix);
for (j = 0; j < current_plugin.num_selected_events; j++) { for (j = 0; j < current_plugin->num_selected_events; j++) {
if (*current_size >= VT_PLUGIN_COUNTERS_PER_THREAD) { if (*current_size >= VT_PLUGIN_COUNTERS_PER_THREAD) {
vt_error_msg("You're about to add more then %i plugin counters," vt_error_msg("You're about to add more then %i plugin counters,"
"which is impossible\n", VT_PLUGIN_COUNTERS_PER_THREAD); "which is impossible\n", VT_PLUGIN_COUNTERS_PER_THREAD);
continue; continue;
} }
if (current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_CALLBACK) { if (current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_CALLBACK) {
if (*current_size == 0) { if (*current_size == 0) {
} }
} }
/* add counter */ /* add counter */
current[*current_size].from_plugin_id = current_plugin.info.add_counter( current[*current_size].from_plugin_id = current_plugin->info.add_counter(
current_plugin.selected_events[j]); current_plugin->selected_events[j]);
/* add successfully? */ /* add successfully? */
if (current[*current_size].from_plugin_id < 0) { if (current[*current_size].from_plugin_id < 0) {
vt_error_msg( vt_error_msg(
"Error while adding plugin counter \"%s\" to thread \"%s%s\"\n", "Error while adding plugin counter \"%s\" to thread \"%s%s\"\n",
current_plugin.selected_events[j], thrd->name, thrd->name_suffix); current_plugin->selected_events[j], thrd->name, thrd->name_suffix);
continue; continue;
} }
/* get the vampir trace id for the counter */ /* get the vampir trace id for the counter */
current[*current_size].vt_counter_id = current_plugin.vt_counter_ids[j]; current[*current_size].vt_counter_id = current_plugin->vt_counter_ids[j];
current[*current_size].vt_asynch_key = current_plugin.vt_asynch_keys[j]; current[*current_size].vt_asynch_key = current_plugin->vt_asynch_keys[j];
current[*current_size].enable_counter = current_plugin.info.enable_counter; current[*current_size].enable_counter = current_plugin->info.enable_counter;
current[*current_size].disable_counter current[*current_size].disable_counter
= current_plugin.info.disable_counter; = current_plugin->info.disable_counter;
/* per type stuff */ /* per type stuff */
if (current_plugin.info.synch == VT_PLUGIN_CNTR_SYNCH) if (current_plugin->info.synch == VT_PLUGIN_CNTR_SYNCH)
/* synch counters have to implement getValue */ /* synch counters have to implement getValue */
current[*current_size].getValue = current_plugin.info.get_current_value; current[*current_size].getValue = current_plugin->info.get_current_value;
if ((current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_EVENT) if ((current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_EVENT)
|| (current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_POST_MORTEM)) { || (current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_POST_MORTEM)) {
/* these have to implement getAllValues */ /* these have to implement getAllValues */
current[*current_size].getAllValues = current_plugin.info.get_all_values; current[*current_size].getAllValues = current_plugin->info.get_all_values;
} }
if (current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_CALLBACK) { if (current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_CALLBACK) {
/* callback should set the callback function */ /* callback should set the callback function */
/* allocate resources */ /* allocate resources */
#if (defined(VT_MT) || defined (VT_HYB) || defined(VT_JAVA)) #if (defined(VT_MT) || defined (VT_HYB) || defined(VT_JAVA))
@ -807,11 +807,11 @@ static void add_events(struct vt_plugin current_plugin, VTThrd * thrd) {
(VTThrdMutex **) &(current[*current_size].callback_mutex) (VTThrdMutex **) &(current[*current_size].callback_mutex)
); );
/* try to set callback function */ /* try to set callback function */
if (current_plugin.info.set_callback_function(&current[*current_size], if (current_plugin->info.set_callback_function(&current[*current_size],
current[*current_size].from_plugin_id, callback_function)) { current[*current_size].from_plugin_id, callback_function)) {
vt_error_msg("Asynchronous callback plugin %s failed " vt_error_msg("Asynchronous callback plugin %s failed "
"to set callback function for counter %s.\n", current_plugin.name, "to set callback function for counter %s.\n", current_plugin->name,
current_plugin.selected_events[j]); current_plugin->selected_events[j]);
} }
current[*current_size].callback_values = malloc( current[*current_size].callback_values = malloc(
@ -828,18 +828,18 @@ static void add_events(struct vt_plugin current_plugin, VTThrd * thrd) {
} }
current[*current_size].tid = VT_MY_THREAD;/* current[*current_size].tid = VT_MY_THREAD;/*
switch (current_plugin.info.run_per) { switch (current_plugin->info.run_per) {
case VT_PLUGIN_CNTR_PER_PROCESS: case VT_PLUGIN_CNTR_PER_PROCESS:
if (thread_group != INVALID_GROUP_NUMBER) if (thread_group != INVALID_GROUP_NUMBER)
current[*current_size].tid = thread_group; current[*current_size].tid = thread_group;
break; break;
case VT_PLUGIN_CNTR_PER_HOST: case VT_PLUGIN_CNTR_PER_HOST:
if (current_plugin.info.run_per == VT_PLUGIN_CNTR_PER_HOST) if (current_plugin->info.run_per == VT_PLUGIN_CNTR_PER_HOST)
if (host_group != INVALID_GROUP_NUMBER) if (host_group != INVALID_GROUP_NUMBER)
current[*current_size].tid = host_group; current[*current_size].tid = host_group;
break; break;
case VT_PLUGIN_CNTR_ONCE: case VT_PLUGIN_CNTR_ONCE:
if (current_plugin.info.run_per == VT_PLUGIN_CNTR_ONCE) if (current_plugin->info.run_per == VT_PLUGIN_CNTR_ONCE)
if (all_group != INVALID_GROUP_NUMBER) if (all_group != INVALID_GROUP_NUMBER)
current[*current_size].tid = all_group; current[*current_size].tid = all_group;
break; break;
@ -1012,9 +1012,10 @@ void vt_plugin_cntr_write_callback_data(uint64_t *time, uint32_t tid) {
(struct vt_plugin_cntr_defines *) VTThrdv[tid]->plugin_cntr_defines; (struct vt_plugin_cntr_defines *) VTThrdv[tid]->plugin_cntr_defines;
if (plugin_cntr_defines == NULL) if (plugin_cntr_defines == NULL)
if (plugin_cntr_defines->size_of_counters[VT_PLUGIN_CNTR_ASYNCH_CALLBACK] return;
== 0) if (plugin_cntr_defines->size_of_counters[VT_PLUGIN_CNTR_ASYNCH_CALLBACK]
return; == 0)
return;
for (i = 0; for (i = 0;
i < plugin_cntr_defines->size_of_counters[VT_PLUGIN_CNTR_ASYNCH_CALLBACK]; i < plugin_cntr_defines->size_of_counters[VT_PLUGIN_CNTR_ASYNCH_CALLBACK];
i++) { i++) {
@ -1124,8 +1125,11 @@ void vt_plugin_cntr_write_post_mortem(VTThrd * thrd) {
/* get data */ /* get data */
number_of_values_by_counter[counter_index] = current_counter.getAllValues( number_of_values_by_counter[counter_index] = current_counter.getAllValues(
current_counter.from_plugin_id, &(time_values_by_counter[counter_index])); current_counter.from_plugin_id, &(time_values_by_counter[counter_index]));
if (time_values_by_counter[counter_index] == NULL) if (time_values_by_counter[counter_index] == NULL) {
free(time_values_by_counter);
free(number_of_values_by_counter);
return; return;
}
} }
/* initialized with 0! */ /* initialized with 0! */
counter_current_indices = calloc(number_of_counters, sizeof(*counter_current_indices)); counter_current_indices = calloc(number_of_counters, sizeof(*counter_current_indices));

Просмотреть файл

@ -3490,10 +3490,7 @@ void vt_enter_stat(uint32_t tid, uint64_t* time)
if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return; if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return;
VTGen_write_ENTER(VTTHRD_GEN(VTThrdv[tid]), time, VTGen_write_ENTER_STAT(VTTHRD_GEN(VTThrdv[tid]), time);
vt_trc_regid[VT__TRC_STAT], 0);
update_counter(tid, time);
} }
void vt_exit_stat(uint32_t tid, uint64_t* time) void vt_exit_stat(uint32_t tid, uint64_t* time)
@ -3502,10 +3499,7 @@ void vt_exit_stat(uint32_t tid, uint64_t* time)
if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return; if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return;
update_counter(tid, time); VTGen_write_LEAVE_STAT(VTTHRD_GEN(VTThrdv[tid]), time);
if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return;
VTGen_write_LEAVE(VTTHRD_GEN(VTThrdv[tid]), time, 0, 0);
} }
void vt_enter_flush(uint32_t tid, uint64_t* time) void vt_enter_flush(uint32_t tid, uint64_t* time)