]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Remove possibility of generating next solution in loop.
authorKarel Kočí <cynerd@email.cz>
Fri, 17 Jul 2015 09:50:04 +0000 (11:50 +0200)
committerKarel Kočí <cynerd@email.cz>
Fri, 17 Jul 2015 10:07:08 +0000 (12:07 +0200)
Only possibility now is generating all solutions on initialisation.
Remove solution generating phase.

conf.py
scripts/initialize.py
scripts/loop.py
scripts/solution.py

diff --git a/conf.py b/conf.py
index 206f723d3a170b3ebca9e188ee1a2925172e2610..e5a40595b130970938cb14af25cc1dfff3b50e1c 100644 (file)
--- a/conf.py
+++ b/conf.py
@@ -5,10 +5,6 @@ import os
 # This defines environment variable for linux kernel.
 # Change this to change target architecture
 ARCH = 'x86'
-# gen_all_solutions_oninit
-# If True, all solutions are generated at initalization.
-# If False, every loop is generated one solution.
-gen_all_solution_oninit = True # If True, all solutions are generated at initialization.
 
 # kernle_env
 # Enviroment variables for Linux
@@ -33,7 +29,7 @@ boot_command = ['scripts/novaboot/novaboot', nbscript] + novaboot_args
 
 # picosat_args
 # Arguments passed to PicoSAT.
-picosat_args = []
+picosat_args = ['--all']
 
 ## Programs output show/hide
 # These options hides output of launched programs from terminal.
@@ -74,7 +70,6 @@ rules_file = build_folder + 'rules' # Also defined in parse_kconfig
 variable_count_file = build_folder + 'variable_count' # Also defined in parse_kconfig
 config_map_file = build_folder + 'config_map'
 config_solved_file = build_folder + 'config_solved'
-solved_file = build_folder + 'solved'
 required_file = build_folder + 'required'
 dot_config_fragment_file = build_folder + 'dot_config_fragment'
 dot_config_back_file = build_folder + 'dot_config_back'
index da54aeef4f171aa92839578f56b2e844176ec248..2c2ca595ec8bc53d5e253474d4da6388d3cf00ed 100755 (executable)
@@ -17,11 +17,10 @@ def all():
        base()
        parse_kconfig()
        gen_requred()
-       if conf.gen_all_solution_oninit:
-               try:
-                       solution.generate()
-               except exceptions.NoSolution:
-                       pass
+       try:
+               solution.generate()
+       except exceptions.NoSolution:
+               pass
 
 def base():
        print('Initialize base...')
index 0fd36391bd6b9e139522b4059ec70652f446f1dc..712b0549c47278a32007c541c1c11c84efd6f13e 100755 (executable)
@@ -23,16 +23,7 @@ def step():
                phase_message(2)
                phase_set(3)
        elif phs == 3:
-               if not conf.gen_all_solution_oninit:
-                       phase_message(3)
-                       solution.generate()
-               iteration_inc()
-               phase_set(4)
-       elif phs == 4:
-               phase_message(4)
-               phase_set(5)
-       elif phs == 5:
-               phase_message(5)
+               phase_message(3)
                try:
                        solution.apply()
                except exceptions.NoApplicableSolution:
@@ -42,54 +33,52 @@ def step():
                                pass
                        print('\nAll done.')
                        exit(0)
-               phase_set(6)
-       elif phs == 6:
-               phase_message(6)
-               phase_set(7)
-       elif phs == 7:
-               phase_message(7)
+               phase_set(4)
+       elif phs == 4:
+               phase_message(4)
+               phase_set(5)
+       elif phs == 5:
+               phase_message(5)
                try:
                        kernel.config()
                except exceptions.ConfigurationError:
                        if not conf.ignore_misconfig:
                                print("Configuration mismatch. Exiting.")
                                sys.exit(-2)
-               phase_set(8)
-       elif phs == 8:
-               phase_message(8)
+               phase_set(6)
+       elif phs == 6:
+               phase_message(6)
                if conf.only_config:
                        phase_set(3)
                else:
-                       phase_set(9)
+                       phase_set(7)
+       elif phs == 7:
+               phase_message(7)
+               kernel.make()
+               phase_set(8)
+       elif phs == 8:
+               phase_message(8)
+               phase_set(9)
        elif phs == 9:
                phase_message(9)
-               kernel.make()
+               boot.boot()
                phase_set(10)
        elif phs == 10:
                phase_message(10)
-               phase_set(11)
-       elif phs == 11:
-               phase_message(11)
-               boot.boot()
-               phase_set(12)
-       elif phs == 12:
-               phase_message(12)
                phase_set(3)
 
 # Phase #
 phases = ("Not Initialized",           #0
                  "Initializing",                       #1
                  "Initialized",                        #2
-                 "Solution generating",        #3
-                 "Solution generated",         #4
-                 "Solution applying",          #5
-                 "Solution applied",           #6
-                 "Kernel configuration",       #7
-                 "Kernel configured",          #8
-                 "Kernel build",                       #9
-                 "Kernel built",                       #10
-                 "System boot",                        #11
-                 "Benchmark successful"        #12
+                 "Solution applying",          #3
+                 "Solution applied",           #4
+                 "Kernel configuration",       #5
+                 "Kernel configured",          #6
+                 "Kernel build",                       #7
+                 "Kernel built",                       #8
+                 "System boot",                        #9
+                 "Benchmark successful"        #10
                  )
 
 def phase_get():
index 930297b9e624ffb6f6bcef0c61da2f26b9cc9434..722aaafcd7093117a29cae384cb8b4b2cc2758d9 100644 (file)
@@ -17,7 +17,7 @@ def generate():
        if not os.path.isfile(sf(conf.rules_file)):
                raise exceptions.MissingFile(conf.rules_file,"Run parse_kconfig.")
 
-       if os.path.isfile(sf(conf.solution_file)) and conf.gen_all_solution_oninit:
+       if os.path.isfile(sf(conf.solution_file)):
                raise exceptions.SolutionGenerated()
 
        w_file = tempfile.NamedTemporaryFile(delete=False)
@@ -28,11 +28,6 @@ def generate():
                        ln = lnn.rstrip()
                        if ln not in lines:
                                lines.add(ln)
-       if os.path.isfile(sf(conf.solved_file)):
-               for lnn in open(sf(conf.solved_file), 'r'):
-                       ln = lnn.rstrip()
-                       if ln not in lines:
-                               lines.add(ln)
        if os.path.isfile(sf(conf.required_file)):
                for lnn in open(sf(conf.required_file), 'r'):
                        ln = lnn.rstrip()
@@ -57,8 +52,7 @@ def generate():
                pass
 
        picosat_cmd = [sf(conf.picosat), w_file.name]
-       if (conf.gen_all_solution_oninit):
-               picosat_cmd += ['--all']
+       picosat_cmd += conf.picosat_args
 
        satprc = subprocess.Popen(picosat_cmd, stdout = subprocess.PIPE)
        with open(os.path.join(sf(conf.log_folder), "picosat.log"), 'a') as f:
@@ -77,10 +71,6 @@ def generate():
                                                for sl in solut:
                                                        fm.write(str(sl) + ' ')
                                                fm.write('\n')
-                                       with open(sf(conf.solved_file), 'a') as fs:
-                                               for sl in solut:
-                                                       fs.write(str(-1 * sl) + ' ')
-                                               fs.write('\n')
                                except ValueError:
                                        pass
                                solut = []