1
1

Add a trace utility that provides info on progress through functions. This is not enabled yet - need Jeff or Brian to add it to the configure/build system.

This commit was SVN r7222.
Этот коммит содержится в:
Ralph Castain 2005-09-07 18:52:28 +00:00
родитель b31c2f8e77
Коммит 2c6e47e38c
6 изменённых файлов: 129 добавлений и 18 удалений

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

@ -3,14 +3,14 @@
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -19,6 +19,7 @@
#include "orte_config.h"
#include "opal/class/opal_object.h"
#include "opal/util/trace.h"
#include "opal/util/output.h"
#include "opal/util/malloc.h"
#include "opal/util/if.h"
@ -36,7 +37,7 @@
* @retval ORTE_SUCCESS Upon success.
* @retval ORTE_ERROR Upon failure.
*
* This function performs
* This function performs
*/
int opal_finalize(void)
{
@ -62,10 +63,13 @@ int opal_finalize(void)
/* finalize the memory manager / tracker */
opal_mem_free_finalize();
/* finalize the memory allocator */
opal_malloc_finalize();
/* finalize the trace system */
opal_trace_finalize();
/* finalize the output system. This has to come *after* the
malloc code, as the malloc code needs to call into this, but
the malloc code turning off doesn't affect opal_output that

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

@ -3,14 +3,14 @@
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
*
* Additional copyrights may follow
*
*
* $HEADER$
*/
@ -20,6 +20,7 @@
#include "opal/util/malloc.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "opal/memory/memory.h"
#include "opal/mca/base/base.h"
#include "opal/runtime/opal.h"
@ -29,7 +30,7 @@
#include "opal/include/constants.h"
#include "opal/util/error.h"
static const char *
opal_err2str(int errnum)
{
@ -51,7 +52,7 @@ opal_err2str(int errnum)
case OPAL_ERR_BAD_PARAM:
retval = "Bad parameter";
break;
default:
default:
retval = NULL;
}
@ -65,7 +66,7 @@ opal_err2str(int errnum)
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*
* This function performs
* This function performs
*/
int opal_init(void)
{
@ -75,6 +76,9 @@ int opal_init(void)
/* initialize the output system */
opal_output_init();
/* init the trace function */
opal_trace_init();
/* initialize the memory manager / tracker */
opal_mem_free_init();

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

@ -3,14 +3,14 @@
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
#
# Additional copyrights may follow
#
#
# $HEADER$
#
@ -31,7 +31,7 @@ headers = \
cmd_line.h \
convert.h \
daemon_init.h \
error.h \
error.h \
few.h \
if.h \
malloc.h \
@ -47,7 +47,8 @@ headers = \
show_help.h \
show_help_lex.h \
stacktrace.h \
strncpy.h
strncpy.h \
trace.h
libopalutil_la_SOURCES = \
$(headers) \
@ -56,7 +57,7 @@ libopalutil_la_SOURCES = \
cmd_line.c \
convert.c \
daemon_init.c \
error.c \
error.c \
few.c \
if.c \
malloc.c \
@ -72,7 +73,8 @@ libopalutil_la_SOURCES = \
show_help.c \
show_help_lex.l \
stacktrace.c \
strncpy.c
strncpy.c \
trace.c
# Conditionally install the header files

43
opal/util/trace.c Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
/* @file */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
int opal_trace_handle;
void opal_trace_init(void)
{
#if ENABLE_TRACE
opal_output_stream_t tracer;
/* get a file setup for opal_output to use for the trace */
tracer.lds_file_suffix = "trace";
tracer.lds_want_file = true;
opal_trace_handle = opal_output_open(&tracer);
#endif
}
void opal_trace_finalize(void)
{
#if ENABLE_TRACE
opal_output_close(opal_trace_handle);
#endif
}

55
opal/util/trace.h Обычный файл
Просмотреть файл

@ -0,0 +1,55 @@
/* @file */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OPAL_TRACE_H_
#define OPAL_TRACE_H_
#include "ompi_config.h"
#ifndef ENABLE_TRACE
#define ENABLE_TRACE 0
#endif
#if ENABLE_TRACE
#include "opal/util/output.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define OPAL_TRACE()
do { \
opal_output(opal_trace_handle, "TRACE: %s @ %s:%d", \
__func__, __FILE__, __LINE__); \
} while (0)
#else
#define OPAL_TRACE()
#endif /* ENABLE_TRACE */
extern int opal_trace_handle;
OMPI_DECLSPEC void opal_trace_init(void);
OMPI_DECLSPEC void opal_trace_finalize(void);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OPAL_TRACE_H */

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

@ -27,6 +27,7 @@
#include "orte/include/orte_types.h"
#include "opal/util/output.h"
#include "opal/util/trace.h"
#include "orte/dps/dps.h"
#include "orte/mca/gpr/gpr.h"
@ -64,6 +65,8 @@ int orte_rmgr_base_proc_stage_gate_init(orte_jobid_t job)
orte_gpr_trigger_id_t id;
size_t trig_level;
OPAL_TRACE();
/* setup the counters */
OBJ_CONSTRUCT(&value, orte_gpr_value_t);
value.addr_mode = ORTE_GPR_OVERWRITE | ORTE_GPR_TOKENS_XAND | ORTE_GPR_KEYS_OR;