]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
scripts: suspend-resume: Write "all" complete cycle information.
authorAlankrita G <alankritag@nvidia.com>
Tue, 17 Mar 2015 10:57:43 +0000 (16:27 +0530)
committerIshan Mittal <imittal@nvidia.com>
Fri, 1 Apr 2016 05:07:07 +0000 (10:37 +0530)
- Also only integer part of result is stored

Change-Id: I84fd89b1426d17d4fee46fde94bce14fe792d789
Signed-off-by: Alankrita G <alankritag@nvidia.com>
Reviewed-on: http://git-master/r/718435
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
scripts/parse_suspend_resume_ftrace.py

index 5cd30e53b1b2d2bc6877cad328d460b5c1c63d7e..ef5ce632c4ff691ac92a22b3850692022657e937 100644 (file)
@@ -4,11 +4,14 @@ import time
 from datetime import datetime
 
 
-cycle =0
+cycle1 =[]
 str1 = ""
+cycle=0;
+flag = 0;
+COUNT = 13;
 
 date = datetime.now()
-fp = open('res' + str(date)+'.txt','w')
+fp = open('res.txt','w')
 
 #open file for reading suspend-resume details
 with open("ftrace.txt", "r") as file:
@@ -66,7 +69,7 @@ with open("ftrace.txt", "r") as file:
                  dpm_end = float(line.split(" .N.1")[1].replace(" ","").split(":")[0])
             driver_ename = line.split("device_pm_callback_end: ")[1].split(",")[0]
             if driver_ename == driver_sname:
-                fp.write("      " +driver_ename.ljust(50) + " ------>       " + str((dpm_end - dpm_start)*1000000) + " us \n")
+                fp.write("      " +driver_ename.ljust(50) + " ------>       " + str(int((dpm_end - dpm_start)*1000000)) + " us \n")
 
         if "thaw_processes[0] end" in line:
             try:
@@ -140,38 +143,39 @@ with open("ftrace.txt", "r") as file:
                  except IndexError:
                      syssusend =float(line.split("N.1")[1].replace(" ","").split(":")[0])
                  str1 = str1 + "SYSTEM CORE SUSPEND took " +str(syssusend-syssusstart) +" secs\n"
+fp.close();
 
+lines=0;
 
-
-
-with open('res' + str(date)+'.txt', "r") as file:
+with open('res.txt', "r") as file:
      length = 0
      for line in file:
-          matchObj = re.match( r'Cycle (.*) took (.*?) sec.*', line, re.M|re.I)
+          lines +=1;
+          matchObj = re.match( r'Cycle (.*?) took (.*?) sec.*', line, re.M|re.I)
           if matchObj:
+              digit = re.findall(r'\d+', line)
               flag = 1;
-
-          matchObj1 = re.match( r'(.*)Cycle (.*) starts(.*)', line, re.M|re.I)
-          if matchObj1:
+          #matchObj1 = re.match( r'\n', line, re.M|re.I)
+          if line == "\n" and flag:
               flag = 0;
-              if length == 19:
-                   digit = re.findall(r'\d+', line)
-                   cycle =  int(digit[0]) - 1
-                   break;
+              if length >= COUNT:
+                   cycle1.append(int(digit[0]))
               length = 0;
 
           if flag:
                matchObj1 = re.match( r'(.*)\n', line, re.M|re.I)
                if matchObj1:
                    length = length + 1;
+
 fp = open('/var/www/suspend-resume/result' + str(date) + '.txt','w')
-with open('res' + str(date)+'.txt', "r") as file:
-     for line in file:
-          matchObj1 = re.match( r'(.*)Cycle ' + str(cycle) + ' starts(.*)', line, re.M|re.I)
-          if matchObj1:
+for i in range(len(cycle1)):
+    with open('res.txt', "r") as file:
+        for line in file:
+             matchObj1 = re.match( r'(.*)Cycle ' + str(cycle1[i]) + ' starts(.*)', line, re.M|re.I)
+             if matchObj1:
                 flag = 1;
-          matchObj = re.match( r'(.*)Cycle ' + str(cycle+1) + ' starts(.*)',  line, re.M|re.I)
-          if matchObj:
-              flag = 0;
-          if flag:
-               fp.write(line);
+             matchObj = re.match( r'(.*)Cycle ' + str(cycle1[i] + 1) + ' starts(.*)',  line, re.M|re.I)
+             if matchObj:
+                 flag = 0;
+             if flag:
+                 fp.write(line);