00001 #ifndef _VERBOSE_H
00002 #define _VERBOSE_H
00003
00004 #include <stdio.h>
00005 #include <errno.h>
00006
00007 #include "trace.h"
00008 #include "envelope.h"
00009 #include "register.h"
00010 #include "trace-common.h"
00011
00025 class TraceControlPoints : public Trace {
00026 private:
00027
00028 double lastBeginExecuteTime;
00029 int lastbeginMessageSize;
00030
00032 double lastBeginIdle;
00033
00035 double totalUntracedTime;
00036
00038 double whenStoppedTracing;
00039
00041 double totalEntryMethodTime;
00042
00044 double totalIdleTime;
00045
00047 double memUsage;
00048
00050 long totalEntryMethodInvocations;
00051
00052
00054 double lastResetTime;
00055
00056 public:
00057 int b1, b2, b3;
00058 long b2mlen;
00059 long b3mlen;
00060
00061
00062 int nesting_level;
00063
00064
00065 public:
00066 TraceControlPoints(char **argv);
00067
00068
00069 void traceBegin(void);
00070 void traceEnd(void);
00071
00072
00073
00074 void userEvent(int eventID);
00075
00076 void userBracketEvent(int eventID, double bt, double et);
00077
00078
00079 void creation(envelope *, int epIdx, int num=1);
00080 void creationMulticast(envelope *, int epIdx, int num=1, const int *pelist=NULL);
00081 void creationDone(int num=1);
00082
00083 void messageRecv(char *env, int pe);
00084
00085
00086
00087
00088
00089 void beginExecute(envelope *);
00090 void beginExecute(CmiObjId *tid);
00091 void beginExecute(
00092 int event,
00093 int msgType,
00094 int ep,
00095 int srcPe,
00096 int ml,
00097 CmiObjId* idx);
00098 void endExecute(void);
00099
00100
00101 void beginIdle(double curWallTime);
00102 void endIdle(double curWallTime);
00103
00104
00105 void beginComputation(void);
00106 void endComputation(void);
00107
00108
00109 void malloc(void *where, int size, void **stack, int stackSize);
00110 void free(void *where, int size);
00111
00112
00113 void traceClose();
00114
00115
00116
00117
00118
00120 void resetTimings();
00121
00123 void resetAll();
00124
00126 double idleRatio(){
00127 double t = CmiWallTimer() - lastResetTime;
00128 return (totalIdleTime) / (t-untracedTime());
00129 }
00130
00131 double untracedTime(){
00132 if(whenStoppedTracing == 0){
00133 return totalUntracedTime;
00134 } else {
00135 return totalUntracedTime + (CmiWallTimer()-whenStoppedTracing);
00136 }
00137
00138 }
00139
00141 double overheadRatio(){
00142 double t = CmiWallTimer() - lastResetTime;
00143 return (t - totalIdleTime - totalEntryMethodTime) / (t-untracedTime());
00144 }
00145
00147 double memoryUsageMB(){
00148 return ((double)memUsage) / 1024.0 / 1024.0;
00149 }
00150
00152 double grainSize(){
00153 return (double)totalEntryMethodTime / totalEntryMethodInvocations;
00154 }
00155
00156 double bytesPerEntry() {
00157 return (double)(b2mlen + b3mlen) / (double)(b2+b3);
00158 }
00159
00160
00161 };
00162
00163
00164 TraceControlPoints *localControlPointTracingInstance();
00165
00166
00168 #endif
00169