diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 988f2cad07..a0e282b854 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1467,7 +1467,7 @@ class Feeder(multiprocessing.Process): | |||
1467 | continue | 1467 | continue |
1468 | 1468 | ||
1469 | class Parser(multiprocessing.Process): | 1469 | class Parser(multiprocessing.Process): |
1470 | def __init__(self, jobs, results, quit, init): | 1470 | def __init__(self, jobs, results, quit, init, profile): |
1471 | self.jobs = jobs | 1471 | self.jobs = jobs |
1472 | self.results = results | 1472 | self.results = results |
1473 | self.quit = quit | 1473 | self.quit = quit |
@@ -1475,8 +1475,28 @@ class Parser(multiprocessing.Process): | |||
1475 | multiprocessing.Process.__init__(self) | 1475 | multiprocessing.Process.__init__(self) |
1476 | self.context = bb.utils.get_context().copy() | 1476 | self.context = bb.utils.get_context().copy() |
1477 | self.handlers = bb.event.get_class_handlers().copy() | 1477 | self.handlers = bb.event.get_class_handlers().copy() |
1478 | self.profile = profile | ||
1478 | 1479 | ||
1479 | def run(self): | 1480 | def run(self): |
1481 | |||
1482 | if not self.profile: | ||
1483 | self.realrun() | ||
1484 | return | ||
1485 | |||
1486 | try: | ||
1487 | import cProfile as profile | ||
1488 | except: | ||
1489 | import profile | ||
1490 | prof = profile.Profile() | ||
1491 | try: | ||
1492 | profile.Profile.runcall(prof, self.realrun) | ||
1493 | finally: | ||
1494 | logfile = "profile-parse-%s.log" % multiprocessing.current_process().name | ||
1495 | prof.dump_stats(logfile) | ||
1496 | bb.utils.process_profilelog(logfile) | ||
1497 | print("Raw profiling information saved to %s and processed statistics to %s.processed" % (logfile, logfile)) | ||
1498 | |||
1499 | def realrun(self): | ||
1480 | if self.init: | 1500 | if self.init: |
1481 | self.init() | 1501 | self.init() |
1482 | 1502 | ||
@@ -1577,7 +1597,7 @@ class CookerParser(object): | |||
1577 | self.feeder = Feeder(self.willparse, self.jobs, self.feeder_quit) | 1597 | self.feeder = Feeder(self.willparse, self.jobs, self.feeder_quit) |
1578 | self.feeder.start() | 1598 | self.feeder.start() |
1579 | for i in range(0, self.num_processes): | 1599 | for i in range(0, self.num_processes): |
1580 | parser = Parser(self.jobs, self.result_queue, self.parser_quit, init) | 1600 | parser = Parser(self.jobs, self.result_queue, self.parser_quit, init, self.cooker.configuration.profile) |
1581 | parser.start() | 1601 | parser.start() |
1582 | self.processes.append(parser) | 1602 | self.processes.append(parser) |
1583 | 1603 | ||