summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-30 08:25:13 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:45 +0000
commitb8aedaa6b54eb81739c288b59a11e1df9f182ec5 (patch)
treec4b94e5cb4447cd08c5a790e06977ef4783a40cf /bitbake
parentb890c19a3308ff88d8450a2811afd2b084f3aafe (diff)
downloadpoky-b8aedaa6b54eb81739c288b59a11e1df9f182ec5.tar.gz
cooker: no cached in progressbar and add ETA
Rather than updating the progress bar based on the recipe being processed (whether cached or parsed), consider only parsed recipes. This reduces the instability in progress rate introduced by the cached entries, and allows the ETA to be resurrected and be a bit more useful. (Bitbake rev: 618480f7739f6ae846f67a57bee5a78efb37839d) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py24
-rw-r--r--bitbake/lib/bb/event.py4
-rw-r--r--bitbake/lib/bb/ui/knotty.py4
3 files changed, 12 insertions, 20 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f5a7b02921..e7fdb5a692 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -993,12 +993,10 @@ class CookerParser(object):
993 self.total = len(filelist) 993 self.total = len(filelist)
994 994
995 self.current = 0 995 self.current = 0
996 self.started = False
997 self.bb_cache = None 996 self.bb_cache = None
998 self.task_queue = None 997 self.task_queue = None
999 self.result_queue = None 998 self.result_queue = None
1000 self.fromcache = None 999 self.fromcache = None
1001 self.progress_chunk = self.total / 100
1002 self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or 1000 self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or
1003 multiprocessing.cpu_count()) 1001 multiprocessing.cpu_count())
1004 1002
@@ -1013,6 +1011,8 @@ class CookerParser(object):
1013 self.task_queue.put((filename, appends)) 1011 self.task_queue.put((filename, appends))
1014 else: 1012 else:
1015 self.fromcache.append((filename, appends)) 1013 self.fromcache.append((filename, appends))
1014 self.toparse = self.total - len(self.fromcache)
1015 self.progress_chunk = self.toparse / 100
1016 1016
1017 def worker(input, output, cfgdata): 1017 def worker(input, output, cfgdata):
1018 signal.signal(signal.SIGINT, signal.SIG_IGN) 1018 signal.signal(signal.SIGINT, signal.SIG_IGN)
@@ -1061,14 +1061,10 @@ class CookerParser(object):
1061 bb.event.fire(event, self.cfgdata) 1061 bb.event.fire(event, self.cfgdata)
1062 self.shutdown() 1062 self.shutdown()
1063 return False 1063 return False
1064 elif not self.started:
1065 self.started = True
1066 bb.event.fire(bb.event.ParseStarted(self.total, self.skipped, self.masked),
1067 self.cfgdata)
1068 return True
1069 elif not self.bb_cache: 1064 elif not self.bb_cache:
1070 self.bb_cache = bb.cache.Cache(self.cfgdata) 1065 self.bb_cache = bb.cache.Cache(self.cfgdata)
1071 self.launch_processes() 1066 self.launch_processes()
1067 bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
1072 return True 1068 return True
1073 1069
1074 try: 1070 try:
@@ -1076,11 +1072,17 @@ class CookerParser(object):
1076 filename, appends = self.fromcache.pop() 1072 filename, appends = self.fromcache.pop()
1077 _, result = self.bb_cache.load(filename, appends, self.cfgdata) 1073 _, result = self.bb_cache.load(filename, appends, self.cfgdata)
1078 parsed = False 1074 parsed = False
1075 self.cached += 1
1079 else: 1076 else:
1080 result = self.result_queue.get() 1077 result = self.result_queue.get()
1081 if isinstance(result, Exception): 1078 if isinstance(result, Exception):
1082 raise result 1079 raise result
1080
1083 parsed = True 1081 parsed = True
1082 self.parsed += 1
1083 if self.parsed % self.progress_chunk == 0:
1084 bb.event.fire(bb.event.ParseProgress(self.parsed),
1085 self.cfgdata)
1084 except KeyboardInterrupt: 1086 except KeyboardInterrupt:
1085 self.shutdown(clean=False) 1087 self.shutdown(clean=False)
1086 raise 1088 raise
@@ -1088,10 +1090,6 @@ class CookerParser(object):
1088 self.error += 1 1090 self.error += 1
1089 parselog.critical(str(e)) 1091 parselog.critical(str(e))
1090 else: 1092 else:
1091 if parsed:
1092 self.parsed += 1
1093 else:
1094 self.cached += 1
1095 self.virtuals += len(result) 1093 self.virtuals += len(result)
1096 1094
1097 for virtualfn, info in result: 1095 for virtualfn, info in result:
@@ -1100,10 +1098,6 @@ class CookerParser(object):
1100 else: 1098 else:
1101 self.bb_cache.add_info(virtualfn, info, self.cooker.status, 1099 self.bb_cache.add_info(virtualfn, info, self.cooker.status,
1102 parsed=parsed) 1100 parsed=parsed)
1103 finally:
1104 # only fire events on percentage boundaries
1105 if self.current % self.progress_chunk == 0:
1106 bb.event.fire(bb.event.ParseProgress(self.current), self.cfgdata)
1107 1101
1108 self.current += 1 1102 self.current += 1
1109 return True 1103 return True
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 5b0a183acd..009cbf93ba 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -298,11 +298,9 @@ class MultipleProviders(Event):
298 298
299class ParseStarted(Event): 299class ParseStarted(Event):
300 """Recipe parsing for the runqueue has begun""" 300 """Recipe parsing for the runqueue has begun"""
301 def __init__(self, total, skipped, masked): 301 def __init__(self, total):
302 Event.__init__(self) 302 Event.__init__(self)
303 self.total = total 303 self.total = total
304 self.skipped = skipped
305 self.masked = masked
306 304
307class ParseCompleted(Event): 305class ParseCompleted(Event):
308 """Recipe parsing for the runqueue has completed""" 306 """Recipe parsing for the runqueue has completed"""
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 8e5249bb62..0c0cdf1fe7 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -31,7 +31,7 @@ from bb.ui import uihelper
31 31
32logger = logging.getLogger("BitBake") 32logger = logging.getLogger("BitBake")
33widgets = ['Parsing recipes: ', progressbar.Percentage(), ' ', 33widgets = ['Parsing recipes: ', progressbar.Percentage(), ' ',
34 progressbar.Bar()] 34 progressbar.Bar(), ' ', progressbar.ETA()]
35 35
36class BBLogFormatter(logging.Formatter): 36class BBLogFormatter(logging.Formatter):
37 """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" 37 """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is"""
@@ -147,7 +147,7 @@ def init(server, eventHandler):
147 continue 147 continue
148 if isinstance(event, bb.event.ParseCompleted): 148 if isinstance(event, bb.event.ParseCompleted):
149 if interactive: 149 if interactive:
150 pbar.update(event.total) 150 pbar.update(pbar.maxval)
151 else: 151 else:
152 sys.stdout.write("done.\n") 152 sys.stdout.write("done.\n")
153 sys.stdout.flush() 153 sys.stdout.flush()