+ indexApp1 = 0
+ indexApp2 = eventAppList.index("App2")
+ indexApp2Start = indexApp2
+ #print "DEBUG: App1: %d" % indexApp1
+ #print "DEBUG: App2: %d" % indexApp2
+ #print "DEBUG: eventList: %d" % len(eventList)
+ isApp1 = True
+ while counter < len(eventList):
+ # Interleave events from App1 and App2
+ if isApp1 is True:
+ i = indexApp1
+ indexApp1 = indexApp1 + 1
+ if indexApp2 < len(eventList):
+ isApp1 = False
+ else:
+ i = indexApp2
+ indexApp2 = indexApp2 + 1
+ if indexApp1 < indexApp2Start:
+ isApp1 = True
+ print "DEBUG: i: %d" % i