'''
Extract individual attributes
'''

fdIn = open('allMachines.txt', 'r')
fdOutCSp = open('CPUSpeed.txt', 'w')
fdOutNumcore = open('NumCores.txt', 'w')
fdOutCFree = open('CPUFree.txt', 'w')
fdOutMSize = open('MemorySize.txt', 'w')
fdOutMFree = open('MemoryFree.txt', 'w')
fdOutDSize = open('DiskSize.txt', 'w')
fdOutDFree = open('DiskFree.txt', 'w')
fdOutOS = open('OS.txt', 'w')
fdOut1mLd = open('1mLd.txt', 'w')
fdOut5mLd = open('5mLd.txt', 'w')
fdOut15mLd = open('15mLd.txt', 'w')
fdOutBWIn = open('Rx.txt', 'w')
fdOutBWOut = open('Tx.txt', 'w')

firstLine = False
count = 0
maxCount = -1
maxCountTime = -1
#current = 1335139200 + 3600*12
current = 1335139200 + 86400 * 7
for line in fdIn:
    if firstLine == False:
        firstLine = True
        continue
    count += 1
    tmp = line.split('\t')
    if int(tmp[1]) != current: continue
    '''
    if int(tmp[1]) != current:
        current = int(tmp[1])
        if maxCount < count:
            maxCount = count
            maxCountTime = tmp[1]
        count = 0
    '''

    fdOutCSp.write(tmp[2] + '\n')
    fdOutNumcore.write(tmp[3] + '\n')
    fdOutCFree.write(tmp[4] + '\n')
    fdOutMSize.write(tmp[5] + '\n')
    fdOutMFree.write(tmp[6] + '\n')
    fdOutDSize.write(tmp[7] + '\n')
    fdOutDFree.write(tmp[8] + '\n')
    fdOutOS.write(tmp[9] + '\n')
    fdOut1mLd.write(tmp[10] + '\n')
    fdOut5mLd.write(tmp[11] + '\n')
    fdOut15mLd.write(tmp[12] + '\n')
    fdOutBWIn.write(tmp[13] + '\n')
    fdOutBWOut.write(tmp[14] + '\n')
    
fdIn.close()
fdOutCSp.close()
fdOutNumcore.close()
fdOutCFree.close()
fdOutMSize.close()
fdOutMFree.close()
fdOutDSize.close()
fdOutDFree.close()
fdOutOS.close()
fdOut1mLd.close()
fdOut5mLd.close()
fdOut15mLd.close()
fdOutBWIn.close()
fdOutBWOut.close()

#print maxCount, maxCountTime
