summaryrefslogtreecommitdiffstats
path: root/lib/bb/server/process.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 11:44:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 11:44:54 +0100
commit61080391726d3e4798faeb8d35df9f32a0653491 (patch)
treef6bab1f1b38e04b0e5a44e75e80fc0e7af8b9284 /lib/bb/server/process.py
parent077657e50ad032c0fa876bf54e9802af2686e0fb (diff)
downloadbitbake-61080391726d3e4798faeb8d35df9f32a0653491.tar.gz
cooker/process.py: Move profiling code to a place it can be reused by different server mechanisms
The cooker profiling code isn't server specific so move it to a place where different server backends can use it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/process.py')
-rw-r--r--lib/bb/server/process.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 5d7f8aa9d..88f819106 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -95,33 +95,7 @@ class ProcessServer(Process):
self._idlefunctions[function] = data
def run(self):
- if self.configuration.profile:
- return self.profile_main()
- else:
- return self.main()
-
- def profile_main(self):
- import cProfile
- profiler = cProfile.Profile()
- try:
- return profiler.runcall(self.main)
- finally:
- profiler.dump_stats(self.profile_filename)
- self.write_profile_stats()
- sys.__stderr__.write("Raw profiling information saved to %s and "
- "processed statistics to %s\n" %
- (self.profile_filename,
- self.profile_processed_filename))
-
- def write_profile_stats(self):
- import pstats
- with open(self.profile_processed_filename, 'w') as outfile:
- stats = pstats.Stats(self.profile_filename, stream=outfile)
- stats.sort_stats('time')
- stats.print_stats()
- stats.print_callers()
- stats.sort_stats('cumulative')
- stats.print_stats()
+ bb.cooker.server_main(self.cooker, self.main)
def main(self):
# Ignore SIGINT within the server, as all SIGINT handling is done by