00001
00007 #if !defined(INC_OSKI_TRACE_H) && !defined(OSKI_UNBIND)
00008
00009 #define INC_OSKI_TRACE_H
00010
00011 #include <oski/common.h>
00012 #include <oski/simplelist.h>
00013
00019 typedef struct
00020 {
00021 oski_id_t id;
00023 oski_id_t kernel_id;
00024 const void *args;
00025 size_t args_bytes;
00027 size_t num_calls;
00028 double time_elapsed;
00030 }
00031 oski_tracerec_t;
00032
00036 #define INVALID_TRACEREC ((oski_tracerec_t *)NULL)
00037
00051 typedef int (*oski_traceargscmp_funcpt) (const void *a, const void *b);
00052
00057 typedef simplelist_t *oski_trace_t;
00058
00060 #define INVALID_TRACE ((oski_trace_t)NULL)
00061
00063 #define TIME_NOT_AVAIL ((double)(-1.0))
00064
00066 oski_trace_t oski_CreateTrace (void);
00067
00069 void oski_DestroyTrace (oski_trace_t trace);
00070
00072 int oski_RecordCalls (oski_trace_t trace, oski_id_t kernel_id,
00073 const void *args, size_t args_bytes,
00074 oski_traceargscmp_funcpt func_compare,
00075 size_t num_new_calls, double time_elapsed);
00076
00078 #define oski_RecordCall(trace, id, args, args_size, func, time_elapsed) \
00079 oski_RecordCalls(trace, id, args, args_size, func, 1, time_elapsed)
00080
00083 size_t oski_GetNumCalls (const oski_trace_t trace,
00084 oski_id_t kernel_id, const void *args,
00085 size_t args_bytes,
00086 oski_traceargscmp_funcpt func_compare);
00087
00092 int oski_MatchesTraceRecord (const oski_tracerec_t * rec,
00093 oski_id_t kernel_id, const void *args,
00094 size_t args_bytes,
00095 oski_traceargscmp_funcpt func_compare);
00096
00097
00098 #if defined(IND_TAG_CHAR) && defined(VAL_TAG_CHAR)
00099
00100 #include <oski/mangle.h>
00101
00102 #if defined(DO_NAME_MANGLING)
00103
00105 #define oski_EstimateTraceTimeTotal MANGLE_(oski_EstimateTraceTimeTotal)
00106 #define oski_EstimateTraceTime MANGLE_(oski_EstimateTraceTime)
00107 #define oski_CountTraceFlopsPerNz MANGLE_(oski_CountTraceFlopsPerNz)
00108
00109 #endif
00110
00116 double oski_EstimateTraceTimeTotal (const oski_trace_t trace,
00117 double time_stream);
00118
00124 double oski_EstimateTraceTime (const oski_trace_t trace,
00125 double time_stream, oski_id_t kernel_id,
00126 const void *args, size_t args_bytes,
00127 oski_traceargscmp_funcpt func_compare);
00128
00133 double oski_CountTraceFlopsPerNz (const oski_trace_t trace,
00134 oski_id_t kernel_id, const void *args,
00135 size_t args_bytes,
00136 oski_traceargscmp_funcpt func_compare);
00137
00138 #endif
00139
00140 #endif
00141
00142 #if defined(OSKI_UNBIND)
00143 # include <oski/mangle.h>
00144 # undef oski_EstimateTraceTimeTotal
00145 # undef oski_EstimateTraceTime
00146 # undef oski_CountTraceFlopsPerNz
00147 #endif
00148
00149