1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
static char rcsid[] =
"$Id: trc.c,v 1.7 2000/02/15 17:06:20 pvmsrc Exp $";
/*
* PVM version 3.4: Parallel Virtual Machine System
* University of Tennessee, Knoxville TN.
* Oak Ridge National Laboratory, Oak Ridge TN.
* Emory University, Atlanta GA.
* Authors: J. J. Dongarra, G. E. Fagg, M. Fischer
* G. A. Geist, J. A. Kohl, R. J. Manchek, P. Mucci,
* P. M. Papadopoulos, S. L. Scott, and V. S. Sunderam
* (C) 1997 All Rights Reserved
*
* NOTICE
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted
* provided that the above copyright notice appear in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation.
*
* Neither the Institutions (Emory University, Oak Ridge National
* Laboratory, and University of Tennessee) nor the Authors make any
* representations about the suitability of this software for any
* purpose. This software is provided ``as is'' without express or
* implied warranty.
*
* PVM version 3 was funded in part by the U.S. Department of Energy,
* the National Science Foundation and the State of Tennessee.
*/
/*
* trc.c
*
* Tracer Library Interface Routines
*
*/
/* Tracer Library External Header */
#include <stdio.h>
#ifndef WIN32
#include <sys/time.h>
#else
#include <sys/timeb.h>
#include <time.h>
#endif
#include <pvm3.h>
#include <pvmtev.h>
#include "job.h"
extern int mytid; /* from cons.c */
extern int joboffset; /* from cons.c */
extern struct job *joblist; /* from cons.c */
/* Set Up Tracer Library */
int
trc_init()
{
/* Initialize Tracer */
trc_tracer_init();
/* Set Tracer Globals */
TRC_HOST_ADD_NOTIFY_CODE = TrcHostAddTag;
TRC_HOST_DEL_NOTIFY_CODE = TrcHostDelTag;
TRC_VERSION = trc_copy_str( pvm_version() );
TRC_NAME = "Console";
TRC_TID = mytid;
/* Check Hosts */
trc_initialize_hosts( (TRC_ID) NULL );
return( 0 );
}
struct job *get_job_trcid( ID )
TRC_ID ID;
{
struct job *jp;
jp = joblist->j_link;
while ( jp != joblist )
{
if ( jp->j_trcid == ID )
return( jp );
jp = jp->j_link;
}
fprintf( stderr, "Warning: Matching Job Trace ID Not Found\n" );
return( (struct job *) NULL );
}
/* Tracer Stub Routines - Called by library... */
/* Status Message Handler */
void
status_msg( ID, msg )
TRC_ID ID;
char *msg;
{
struct job *jp;
/* Find Corresponding Job */
jp = get_job_trcid( ID );
if ( jp != NULL )
fprintf( stderr, "[%d] libpvmtrc: %s\n",
jp->j_jid - joboffset, msg );
}
/* Trace Event Line Header */
void
event_dump_hdr( ID, tid )
TRC_ID ID;
int tid;
{
struct job *jp;
int show;
jp = get_job_trcid( ID );
if ( jp != NULL ) {
show = pvm_getopt( PvmShowTids );
if ( show )
fprintf( ID->trace_out, "[T%d:t%x] ",
jp->j_jid - joboffset, tid );
}
}
/* Task Output Line Header */
void
output_dump_hdr( ID, tid )
TRC_ID ID;
int tid;
{
struct job *jp;
int show;
jp = get_job_trcid( ID );
if ( jp != NULL ) {
show = pvm_getopt( PvmShowTids );
if ( show )
fprintf( ID->output_fp, "[%d:t%x] ",
jp->j_jid - joboffset, tid );
}
}
|