00001 /* 00002 * Copyright (c) 2003-2004, University of Amsterdam, The Netherlands. 00003 * All rights reserved. 00004 * 00005 * Author(s): 00006 * Frank Seinstra <fjseins@wins.uva.nl> 00007 */ 00008 00009 #ifndef __PxPrint_h_ 00010 #define __PxPrint_h_ 00011 00012 00013 #include "Core/Array/Pattern/PxSystem.h" 00014 #include "Core/Array/Pattern/PxxStream.h" 00015 #include "mpi.h" 00016 00017 namespace Impala 00018 { 00019 namespace Core 00020 { 00021 namespace Array 00022 { 00023 namespace Pattern 00024 { 00025 00026 00027 /********************************************************************** 00028 *** Various Print Functions *** 00029 **********************************************************************/ 00030 00031 inline void 00032 PxPrintTime(double t1, double t2) 00033 { 00034 PX_COUT << "Recorded Time from CPU " << PxMyCPU() << ": " 00035 << (int)((t2-t1)*1000000) << " (uSec) or " << (t2-t1) 00036 << " (Sec)" << PX_ENDL; 00037 } 00038 00039 00040 inline void 00041 PxPrintTimeOnCPU(double t1, double t2, int cpu) 00042 { 00043 PX_COUT_ON(cpu) << "Recorded Time from CPU " << cpu << ": " 00044 << (int)((t2-t1)*1000000) << " (uSec) or " << (t2-t1) 00045 << " (Sec)" << PX_ENDL; 00046 } 00047 00048 00049 inline void 00050 PxPrintTimeOnAll(double t1, double t2) 00051 { 00052 PX_COUT_ON_ALL << "Recorded Time from CPU " << PxMyCPU() << ": " 00053 << (int)((t2-t1)*1000000) << " (uSec) or " << (t2-t1) 00054 << " (Sec)" << PX_ENDL; 00055 } 00056 00057 00058 inline void 00059 PxPrintMsg(char *msg) 00060 { 00061 PX_COUT << msg << PX_ENDL; 00062 } 00063 00064 00065 inline void 00066 PxPrintMsgOnCPU(char *msg, int cpu) 00067 { 00068 PX_COUT_ON(cpu) << msg << "(cpu " << cpu << ")" << PX_ENDL; 00069 } 00070 00071 00072 inline void 00073 PxPrintMsgOnAll(char *msg) 00074 { 00075 PX_COUT_ON_ALL << msg << "(cpu " << PxMyCPU() << ")" << PX_ENDL; 00076 } 00077 00078 00079 inline void 00080 PxPrintError(char *msg) 00081 { 00082 PX_CERR << "ERROR: " << msg << PX_ENDL; 00083 } 00084 00085 00086 inline void 00087 PxPrintErrorOnCPU(char *msg, int cpu) 00088 { 00089 PX_CERR_ON(cpu) << "ERROR: " << msg << "(cpu " << cpu << ")" 00090 << PX_ENDL; 00091 } 00092 00093 00094 inline void 00095 PxPrintErrorOnAll(char *msg) 00096 { 00097 PX_CERR_ON_ALL << "ERROR: " << msg << "(cpu " << PxMyCPU() << ")" 00098 << PX_ENDL; 00099 } 00100 00101 00102 } // namespace Pattern 00103 } // namespace Array 00104 } // namespace Core 00105 } // namespace Impala 00106 00107 #endif /* __PxPrint_h_ */