Changes to VT:
- 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.
Этот коммит содержится в:
родитель
147c6ff9e7
Коммит
cf926da7e1
@ -7,6 +7,8 @@
|
||||
- fixed a potential minor bug in CUPTI activity stream handling
|
||||
- workaround for CUDA 5.0 bug: do not call cuDeviceSynchronize(), if
|
||||
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
|
||||
- plugin counters: Merge a set of post-mortem counters and write them
|
||||
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_SUBST(top_vt_srcdir)
|
||||
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"
|
||||
])
|
||||
[AC_MSG_NOTICE([detected VPATH build])])
|
||||
|
||||
# Check for file system case sensitivity
|
||||
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])])
|
||||
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
|
||||
AC_CONFIG_FILES([Makefile
|
||||
extlib/Makefile
|
||||
|
@ -8,10 +8,13 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#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 )
|
||||
{
|
||||
FILE* f;
|
||||
size_t i;
|
||||
uint8_t err = 0;
|
||||
const size_t bsize = 1024;
|
||||
int ret = 1;
|
||||
|
||||
int fd;
|
||||
|
||||
if( !filter || !filter->file_name || *(filter->file_name) == '\0' )
|
||||
return 0;
|
||||
|
||||
/* open filter definition file */
|
||||
|
||||
f = fopen( filter->file_name, "r" );
|
||||
if( !f )
|
||||
/* open the filter file */
|
||||
if( ( fd = open( filter->file_name, O_RDONLY ) ) == -1 )
|
||||
return 0;
|
||||
|
||||
filter->file_content = (char*)malloc( bsize * sizeof( char ) );
|
||||
if( !filter->file_content ) err = 1;
|
||||
else filter->file_content_size = bsize;
|
||||
do
|
||||
{
|
||||
struct stat file_stat;
|
||||
|
||||
i = 0;
|
||||
while( !err && ( ( filter->file_content[i++] = fgetc( f ) ) != (char)EOF ) )
|
||||
/* get the file size */
|
||||
if( fstat(fd, &file_stat) == -1 || file_stat.st_size == 0 )
|
||||
{
|
||||
/* enlarge buffer, if necessary */
|
||||
|
||||
if( i == filter->file_content_size )
|
||||
{
|
||||
filter->file_content =
|
||||
(char*)realloc( filter->file_content,
|
||||
( filter->file_content_size + bsize ) * sizeof( char ) );
|
||||
if( !filter->file_content )
|
||||
{
|
||||
err = 1;
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
filter->file_content_size += bsize;
|
||||
}
|
||||
|
||||
/* allocate the buffer for storing the filter file content */
|
||||
filter->file_content = (char*)malloc( file_stat.st_size * sizeof( char ) );
|
||||
if( !filter->file_content )
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* append '\0' to buffer */
|
||||
if( !err) filter->file_content[i-1] = '\0';
|
||||
/* read the filter file */
|
||||
if( read(fd, filter->file_content, file_stat.st_size ) == -1 )
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* close filter definition file */
|
||||
fclose( f );
|
||||
} while( 0 );
|
||||
|
||||
return (int)!err;
|
||||
/* close the filter file */
|
||||
close( fd );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if( !filter && !r_callLimit )
|
||||
if( !filter || !r_callLimit )
|
||||
return 0;
|
||||
|
||||
if( size == 0 || size > RFG_FILTER_MAX_CPATH_SIZE )
|
||||
|
@ -89,7 +89,7 @@ namespace {
|
||||
if ( line >= outer->lines.size() ) return;
|
||||
pos = outer->lines[line].find(sentinel) + slen;
|
||||
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]);
|
||||
iptr = &(inner->lines[line][pos]);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
//
|
||||
|
||||
HooksProcessMarginsC::HooksProcessMarginsC() : HooksBaseC(),
|
||||
m_maxThreads( 1 )
|
||||
m_maxThreads( 1 ), m_threadContexts( 0 )
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
#ifndef _VT_UNIFY_H_
|
||||
#define _VT_UNIFY_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "vt_unify_config.h"
|
||||
|
||||
#ifdef VT_MPI
|
||||
# include "vt_unify_mpi.h"
|
||||
|
@ -628,6 +628,7 @@ readDataFile()
|
||||
break;
|
||||
}
|
||||
case 31: // partype_default
|
||||
default:
|
||||
{
|
||||
if( value.compare( "seq" ) == 0 )
|
||||
{
|
||||
@ -655,14 +656,6 @@ readDataFile()
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (time)
|
||||
if (!time)
|
||||
{
|
||||
VTGEN_ALLOC(gen, VTGEN_ALIGN_LENGTH(size));
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ struct vt_plugin_cntr_defines {
|
||||
/* called when activating events */
|
||||
static void maybe_register_new_thread(VTThrd * thrd, uint32_t tid);
|
||||
/* 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);
|
||||
|
||||
@ -571,7 +571,7 @@ void vt_plugin_cntr_thread_init(VTThrd * thrd, uint32_t tid) {
|
||||
maybe_register_new_thread(thrd, tid);
|
||||
|
||||
/* 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;
|
||||
struct vt_plugin_single_counter * current;
|
||||
uint32_t * current_size;
|
||||
struct vt_plugin_cntr_defines * plugin_cntr_defines =
|
||||
(struct vt_plugin_cntr_defines *) thrd->plugin_cntr_defines;
|
||||
/* 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) {
|
||||
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));
|
||||
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*/
|
||||
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_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) {
|
||||
vt_error_msg("You're about to add more then %i plugin counters,"
|
||||
"which is impossible\n", VT_PLUGIN_COUNTERS_PER_THREAD);
|
||||
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) {
|
||||
}
|
||||
}
|
||||
/* add counter */
|
||||
current[*current_size].from_plugin_id = current_plugin.info.add_counter(
|
||||
current_plugin.selected_events[j]);
|
||||
current[*current_size].from_plugin_id = current_plugin->info.add_counter(
|
||||
current_plugin->selected_events[j]);
|
||||
|
||||
/* add successfully? */
|
||||
if (current[*current_size].from_plugin_id < 0) {
|
||||
vt_error_msg(
|
||||
"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;
|
||||
}
|
||||
/* get the vampir trace id for the counter */
|
||||
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].enable_counter = current_plugin.info.enable_counter;
|
||||
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].enable_counter = current_plugin->info.enable_counter;
|
||||
current[*current_size].disable_counter
|
||||
= current_plugin.info.disable_counter;
|
||||
= current_plugin->info.disable_counter;
|
||||
|
||||
/* 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 */
|
||||
current[*current_size].getValue = current_plugin.info.get_current_value;
|
||||
if ((current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_EVENT)
|
||||
|| (current_plugin.info.synch == VT_PLUGIN_CNTR_ASYNCH_POST_MORTEM)) {
|
||||
current[*current_size].getValue = current_plugin->info.get_current_value;
|
||||
if ((current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_EVENT)
|
||||
|| (current_plugin->info.synch == VT_PLUGIN_CNTR_ASYNCH_POST_MORTEM)) {
|
||||
/* 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 */
|
||||
/* allocate resources */
|
||||
#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)
|
||||
);
|
||||
/* try to set callback function */
|
||||
if (current_plugin.info.set_callback_function(¤t[*current_size],
|
||||
if (current_plugin->info.set_callback_function(¤t[*current_size],
|
||||
current[*current_size].from_plugin_id, callback_function)) {
|
||||
vt_error_msg("Asynchronous callback plugin %s failed "
|
||||
"to set callback function for counter %s.\n", current_plugin.name,
|
||||
current_plugin.selected_events[j]);
|
||||
"to set callback function for counter %s.\n", current_plugin->name,
|
||||
current_plugin->selected_events[j]);
|
||||
}
|
||||
|
||||
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;/*
|
||||
switch (current_plugin.info.run_per) {
|
||||
switch (current_plugin->info.run_per) {
|
||||
case VT_PLUGIN_CNTR_PER_PROCESS:
|
||||
if (thread_group != INVALID_GROUP_NUMBER)
|
||||
current[*current_size].tid = thread_group;
|
||||
break;
|
||||
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)
|
||||
current[*current_size].tid = host_group;
|
||||
break;
|
||||
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)
|
||||
current[*current_size].tid = all_group;
|
||||
break;
|
||||
@ -1012,6 +1012,7 @@ void vt_plugin_cntr_write_callback_data(uint64_t *time, uint32_t tid) {
|
||||
(struct vt_plugin_cntr_defines *) VTThrdv[tid]->plugin_cntr_defines;
|
||||
|
||||
if (plugin_cntr_defines == NULL)
|
||||
return;
|
||||
if (plugin_cntr_defines->size_of_counters[VT_PLUGIN_CNTR_ASYNCH_CALLBACK]
|
||||
== 0)
|
||||
return;
|
||||
@ -1124,9 +1125,12 @@ void vt_plugin_cntr_write_post_mortem(VTThrd * thrd) {
|
||||
/* get data */
|
||||
number_of_values_by_counter[counter_index] = current_counter.getAllValues(
|
||||
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;
|
||||
}
|
||||
}
|
||||
/* initialized with 0! */
|
||||
counter_current_indices = calloc(number_of_counters, sizeof(*counter_current_indices));
|
||||
vt_libassert(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;
|
||||
|
||||
VTGen_write_ENTER(VTTHRD_GEN(VTThrdv[tid]), time,
|
||||
vt_trc_regid[VT__TRC_STAT], 0);
|
||||
|
||||
update_counter(tid, time);
|
||||
VTGen_write_ENTER_STAT(VTTHRD_GEN(VTThrdv[tid]), 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;
|
||||
|
||||
update_counter(tid, time);
|
||||
if (VTTHRD_TRACE_STATUS(VTThrdv[tid]) != VT_TRACE_ON) return;
|
||||
|
||||
VTGen_write_LEAVE(VTTHRD_GEN(VTThrdv[tid]), time, 0, 0);
|
||||
VTGen_write_LEAVE_STAT(VTTHRD_GEN(VTThrdv[tid]), time);
|
||||
}
|
||||
|
||||
void vt_enter_flush(uint32_t tid, uint64_t* time)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user