MOAB: Mesh Oriented datABase  (version 5.4.1)
moab_mpe.h
Go to the documentation of this file.
00001 #ifndef MOAB_MPE_H
00002 #define MOAB_MPE_H
00003 
00004 #include "moab/MOABConfig.h"
00005 #ifdef MOAB_HAVE_LIBMPE
00006 #include "moab_mpi.h"
00007 #include "mpe.h"
00008 #else
00009 
00010 /* Define dummy logging functions */
00011 
00012 /* mpe_misc.h */
00013 
00014 #define MPE_Seq_begin( A, B ) \
00015     {                         \
00016         if( ( A ) || ( B ) )  \
00017         {                     \
00018         }                     \
00019     }
00020 
00021 #define MPE_Seq_end( A, B )  \
00022     {                        \
00023         if( ( A ) || ( B ) ) \
00024         {                    \
00025         }                    \
00026     }
00027 
00028 #define MPE_DelTag( A, B, C, D )                   \
00029     (                                              \
00030         {                                          \
00031             if( ( A ) || ( B ) || ( C ) || ( D ) ) \
00032             {                                      \
00033             }                                      \
00034         },                                         \
00035         MPI_SUCCESS )
00036 #define MPE_GetTags( A, B, C, D ) ( ( A ) = *( C ), *( D ) = 0, if( B ){}, MPI_SUCCESS )
00037 #define MPE_ReturnTags( A, B, C )         \
00038     (                                     \
00039         {                                 \
00040             if( ( A ) || ( B ) || ( C ) ) \
00041             {                             \
00042             }                             \
00043         },                                \
00044         0 )
00045 #define MPE_TagsEnd() ( MPI_SUCCESS )
00046 
00047 #define MPE_IO_Stdout_to_file( A, B ) \
00048     {                                 \
00049         if( ( A ) || ( B ) )          \
00050         {                             \
00051         }                             \
00052     }
00053 
00054 #define MPE_GetHostName( A, B ) \
00055     {                           \
00056         if( ( A ) || ( B ) )    \
00057         {                       \
00058         }                       \
00059     }
00060 
00061 #define MPI_Start_debugger()
00062 
00063 /*
00064 #if (defined(__STDC__) || defined(__cplusplus))
00065 #define  MPE_Errors_to_dbx ( MPI_Comm *, int *, ... );
00066 #else
00067 void MPE_Errors_to_dbx ( MPI_Comm *, int *, char *, char *, int * );
00068 #endif
00069 void MPE_Errors_call_debugger ( char *, char *, char ** );
00070 void MPE_Errors_call_xdbx     ( char *, char * );
00071 void MPE_Errors_call_dbx_in_xterm ( char *, char * );
00072 void MPE_Signals_call_debugger ( void );
00073 
00074 int  MPE_Decomp1d ( int, int, int, int *, int * );
00075 
00076 void MPE_Comm_global_rank ( MPI_Comm, int, int * );
00077 */
00078 
00079 /* mpe_log.h */
00080 
00081 #define MPE_LOG_OK              0
00082 #define MPE_Log_OK              MPE_LOG_OK
00083 /* no problems */
00084 #define MPE_LOG_LOCKED_OUT      1
00085 #define MPE_Log_LOCKED_OUT      MPE_LOG_LOCKED_OUT
00086 /* logs are being worked on, cannot insert any new entries */
00087 #define MPE_LOG_NO_MEMORY       2
00088 #define MPE_Log_NO_MEMORY       MPE_LOG_NO_MEMORY
00089 /* could not allocate memory for logging data */
00090 #define MPE_LOG_FILE_PROB       3
00091 #define MPE_Log_FILE_PROB       MPE_LOG_FILE_PROB
00092 /* cound not open file for writing out the logged info */
00093 #define MPE_LOG_NOT_INITIALIZED 4
00094 #define MPE_Log_NOT_INITIALIZED MPE_LOG_NOT_INITIALIZED
00095 /* logging not initialized */
00096 #define MPE_LOG_PACK_FAIL       5
00097 #define MPE_Log_PACK_FAIL       MPE_LOG_PACK_FAIL
00098 
00099 #define MPE_Init_log()            ( MPI_SUCCESS )
00100 #define MPE_Initialized_logging() 1
00101 
00102 #define MPE_Describe_state( A, B, C, D )       \
00103     {                                          \
00104         if( ( A ) || ( B ) || ( C ) || ( D ) ) \
00105         {                                      \
00106         }                                      \
00107     }
00108 #define MPE_Describe_event( A, B, C ) \
00109     {                                 \
00110         if( ( A ) || ( B ) || ( C ) ) \
00111         {                             \
00112         }                             \
00113     }
00114 #define MPE_Log_get_event_number()
00115 #define MPE_Log_send( A, B, C )       \
00116     {                                 \
00117         if( ( A ) || ( B ) || ( C ) ) \
00118         {                             \
00119         }                             \
00120     }
00121 #define MPE_Log_receive( A, B, C )    \
00122     {                                 \
00123         if( ( A ) || ( B ) || ( C ) ) \
00124         {                             \
00125         }                             \
00126     }
00127 #define MPE_Log_event( A, B, C )      \
00128     {                                 \
00129         if( ( A ) || ( B ) || ( C ) ) \
00130         {                             \
00131         }                             \
00132     }
00133 #define MPE_Start_log()
00134 #define MPE_Stop_log()
00135 #define MPE_Finish_log( A ) \
00136     {                       \
00137         if( A )             \
00138         {                   \
00139         }                   \
00140     }
00141 
00142 #endif
00143 
00144 #ifdef __cplusplus
00145 
00146 namespace moab
00147 {
00148 
00149 class MPEState
00150 {
00151   private:
00152     int sid, eid;
00153     bool ok;
00154 
00155   public:
00156     MPEState( const char* name, const char* color = 0 )
00157         : sid( MPE_Log_get_event_number() ), eid( MPE_Log_get_event_number() ), ok( true )
00158     {
00159         MPE_Describe_state( sid, eid, name, color ? color : "yellow" );
00160     }
00161 
00162     MPEState() : ok( false ) {}
00163     bool valid() const
00164     {
00165         return ok;
00166     }
00167 
00168     void start( int data = 0, const char* str = 0 )
00169     {
00170         MPE_Log_event( sid, data, str );
00171     }
00172     void start( const char* str, int data = 0 )
00173     {
00174         MPE_Log_event( sid, data, str );
00175     }
00176     void start( const char* str, const char* str2 )
00177     {
00178         MPE_Log_event( sid, 0, ( std::string( str ).append( str2 ) ).c_str() );
00179     }
00180     void end( int data = 0, const char* str = 0 )
00181     {
00182         MPE_Log_event( eid, data, str );
00183     }
00184     void end( const char* str, int data = 0 )
00185     {
00186         MPE_Log_event( eid, data, str );
00187     }
00188 };
00189 
00190 class MPEEvent
00191 {
00192   private:
00193     int id;
00194 
00195   public:
00196     MPEEvent( const char* name, const char* color = 0 ) : id( MPE_Log_get_event_number() )
00197     {
00198         MPE_Describe_event( id, name, color ? color : "red" );
00199     }
00200     void log( int data = 0, const char* str = 0 )
00201     {
00202         MPE_Log_event( id, data, str );
00203     }
00204     void log( const char* str, int data = 0 )
00205     {
00206         MPE_Log_event( id, data, str );
00207     }
00208 };
00209 
00210 } /* namespace moab */
00211 
00212 #endif /* __cplusplus */
00213 
00214 #endif /* MOAB_MPE_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines