author Hamed Gorjiara Fri, 14 Dec 2018 23:48:48 +0000 (15:48 -0800) committer Hamed Gorjiara Fri, 14 Dec 2018 23:48:48 +0000 (15:48 -0800)
1  2
src/analyzer/tunerloganalyzer.py

@@@ -136,13 -130,12 +140,13 @@@ def analyzeLogs(file)
-               dump(file, row)
+               data.append(dump(file, row))
rows.append(row)
-       return rows
+       return rows, data

-def tunerNumberAnalysis(file, rows):
+def tunerCountAnalysis(file, rows):
+      global PROBLEMS
tunercount = {}
tunernumber = {}
for row in rows:
tunernumber[mystr] += "-" + str(row["TUNERNUMBER"])

problems = set(map(lambda x: x["PROBLEM"], rows))
-       print "Number of repititive tuners"
+       print ("Number of repititive tuners")
for key in tunercount:
if tunercount[key] > 1:
-                      print (key + "(ids:" + tunernumber[key]  + ") = #" + str(tunercount[key]))
+                      print key + "(ids:" + tunernumber[key]  + ") = #" + str(tunercount[key])
+
+def combineRowForEachTuner(rows):
+      global PROBLEMS
+      newRows = []
+      combined = None
+      for row in rows:
+              if row["PROBLEM"] == PROBLEMS[0]:
+                      combined = row
+              for key in row:
+                      if row[key]:
+                              combined[key] = row[key]
+              if row["PROBLEM"] == PROBLEMS[len(PROBLEMS)-1]:
+                      newRows.append(combined)
+      return newRows

+ def transformDataset(rows):
+       print(rows)
++
++
def main():
file = open("tuner.csv", "w")
-       rows = analyzeLogs(file)
+       rows, data = analyzeLogs(file)
-      tunerNumberAnalysis(file, rows)
+      tunerCountAnalysis(file, combineRowForEachTuner(rows) )
file.close()
-       return
+       #transformDataset(data)