def yield_timed_calls(filename):
    try:
        f = open(filename)
    except __HOLE__, error:
        print >> sys.stderr, "I/O error while opening file: %s" % error
        return

    for line in f:
        try:
            labels = line.split(':')[:3]
        except Exception, error:
            print >> sys.stderr, "Unhandled Exception:", error, filename
            return
        if labels[1:] in [['LOG', 'T']]:
            if len(line.split(':')) != 5:
                continue
            try:
                call = line.split(':')[3] + ':'
                if call[:11] == "epoll_wait_":
                    call = "epoll_wait_:"
                else:
                    call = re.sub(r'_B:|_D:|_E:|_F:|_f:|_K:|_k:|_P:|_p:|_S:|_U:',    ':', call)
                time = line.split(':')[4]
                msec = int(time.split('.')[0]) * 10 ** 6 \
                        + int(time.split('.')[1])
            except Exception, error:
                print >> sys.stderr, "Unhandled Exception:", error, filename
                return
            # special handling of epoll - it should go to cache later
            yield call + str(msec)
    f.close()
dataset/ETHPy150Open columbia/libtrack/libtrack/parser/scripts/patterns.py/yield_timed_calls