summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
commitd9fc4acc572c6647a4f27b838d35d27d805d190e (patch)
tree262a8de35d8c7567312757da5f1f66efdc8cece5 /bin/pemerge.py
downloadportage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.gz
portage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.bz2
portage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.zip
Migration (without history) of the current stable line to subversion.
svn path=/main/branches/2.0/; revision=1941
Diffstat (limited to 'bin/pemerge.py')
-rwxr-xr-xbin/pemerge.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/bin/pemerge.py b/bin/pemerge.py
new file mode 100755
index 00000000..08de6eda
--- /dev/null
+++ b/bin/pemerge.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python -O
+
+import profile,time,sys,os
+sys.path = ["/usr/lib/portage/bin","/usr/lib/portage/pym"]+sys.path
+
+def clock():
+ return time.time()
+profile.time.clock = clock
+
+profile.run("import emerge", os.getcwd()+"/prof")
+
+class StatsProcesser:
+ def __init__(self, stats):
+ self.output = []
+ self.last = ""
+ import sys
+ sys.stdout = self
+ stats.print_stats()
+ sys.stdout = sys.__stdout__
+ funcs = ["?"]
+ for line in self.output:
+ spline = line.split()
+ if len(spline) == 6 and spline[0][0].isdigit():
+ func = spline[5][spline[5].index("(")+1:-1]
+ print line
+ if func not in funcs:
+ funcs.append(func)
+ func = "\\(" + func + "\\)"
+ stats.print_callers(func)
+
+ def write(self, text):
+ new = self.last + text
+ new = new.split("\n")
+ if len(new) > 1:
+ self.output += new[:-1]
+ self.last = new[-1]
+
+import pstats
+p = pstats.Stats("prof")
+dir(p)
+p.sort_stats("time")
+p.print_stats()
+
+sp = StatsProcesser(p)