+
+ /* keep the overflow count correct. The heartbeat event makes sure
+ * that we do not miss an overflow.*/
+
+ cycle_count = (LttCycleCount)*(guint32 *)(tf->cur_event_pos + EVENT_ID_SIZE);
+ //g_debug("event cycle count %llu", cycle_count);
+ //
+ //gint64 delta_count = (gint64)(cycle_count - tf->pre_cycle_count);
+ //LttCycleCount res_delta_count;
+ gboolean comp_count = cycle_count < tf->pre_cycle_count;
+ tf->pre_cycle_count = cycle_count;
+
+ if(unlikely(comp_count)) {
+ /* Wrapped */
+ tf->overflow_nsec += tf->one_overflow_nsec;
+ tf->count++; //increment overflow count
+ }
+
+ if(unlikely(evId == TRACE_BLOCK_START)) {
+ lEventNSec = 0;
+ } else if(unlikely(evId == TRACE_BLOCK_END)) {
+ lEventNSec = ((double)
+ (tf->a_block_end->cycle_count - tf->a_block_start->cycle_count)
+ * tf->nsec_per_cycle);
+ }
+ /* heartbeat cycle counter is only numheartbeat<<32, not meaningful
+ */
+#if 0
+ else if(unlikely(evId == TRACE_TIME_HEARTBEAT)) {
+
+ tf->last_heartbeat = (TimeHeartbeat*)(tf->cur_event_pos+EVENT_HEADER_SIZE);
+ lEventNSec = ((double)(tf->last_heartbeat->cycle_count
+ - tf->a_block_start->cycle_count)
+ * tf->nsec_per_cycle);
+ }
+#endif //0
+ else {
+
+ lEventNSec = (gint64)((double)cycle_count * tf->nsec_per_cycle)
+ +tf->overflow_nsec;
+ }
+