13 #ifndef _VT_UNIFY_SYNC_H_
14 #define _VT_UNIFY_SYNC_H_
21 # include "vt_unify_esync.h"
22 #endif // VT_ETIMESYNC
24 #include "vt_inttypes.h"
36 typedef enum { METHOD_OFFSET, METHOD_ENHANCED } MethodTypeT;
39 typedef std::pair<uint64_t, uint64_t> TimeRangeT;
51 void setSyncMethod(
const MethodTypeT & method )
54 assert( method != METHOD_ENHANCED );
55 #endif // VT_ETIMESYNC
57 m_syncMethod = method;
61 MethodTypeT getSyncMethod()
const
67 void setTimeRange(
const uint32_t & proc,
const uint64_t & minTime,
68 const uint64_t & maxTime )
73 m_proc2TimeRange[proc] = TimeRangeT( minTime, maxTime );
78 TimeRangeT getTimeRange(
const uint32_t & proc = 0 )
const
81 std::map<uint32_t, TimeRangeT>::const_iterator it =
82 m_proc2TimeRange.find( proc );
83 assert( it != m_proc2TimeRange.end() );
90 uint64_t getMinStartTime()
const
92 return m_minStartTime;
98 void updateSyncParam(
const uint32_t & proc )
100 assert( m_eTimeSync );
101 m_eTimeSync->updateSyncParam( proc );
105 void resetSyncParam(
const uint32_t & proc )
107 assert( m_eTimeSync );
108 m_eTimeSync->resetSyncParam( proc );
111 #endif // VT_ETIMESYNC
115 uint64_t correctTime(
const uint32_t & process,
const uint64_t & time )
const
118 uint32_t mprocess = process & VT_TRACEID_BITMASK;
120 std::map<uint32_t, UnifyControlS*>::const_iterator it =
121 StreamId2UnifyCtl.find( mprocess );
122 assert( it != StreamId2UnifyCtl.end() );
125 if( m_syncMethod == METHOD_ENHANCED )
127 const int64_t & offset = it->second->sync_offset;
128 const double & drift = it->second->sync_drift;
130 return (uint64_t)( offset + (uint64_t)( drift * (
double)time ) );
133 #endif // VT_ETIMESYNC
135 const int64_t * ltime = it->second->ltime;
136 const int64_t * offset = it->second->offset;
139 (uint64_t)( ( (double)time +
140 ( ( ( (
double)offset[1] - (double)offset[0] ) /
141 ( (double)ltime[1] - (
double)ltime[0] ) )
142 * ( (double)time - (
double)ltime[0]) )
143 + (double)offset[0] ) - m_minStartTime );
150 MethodTypeT m_syncMethod;
154 std::map<uint32_t, TimeRangeT> m_proc2TimeRange;
157 uint64_t m_minStartTime;
162 #endif // VT_ETIMESYNC
169 #endif // _VT_UNIFY_SYNC_H_
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_esync.h:28
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_sync.h:31