def time_fetch(full_name, which_rev=None, n=1): times1 = [ None ] * n times2 = [ None ] * n for i in range(n): t = time.time() viewvc.fetch_log(full_name, which_rev) times1[i] = time.time() - t for i in range(n): t = time.time() fetch_log2(full_name, which_rev) times2[i] = time.time() - t times1.sort() times2.sort() i1 = int(n*.05) i2 = int(n*.95)+1 times1 = times1[i1:i2] times2 = times2[i1:i2] t1 = reduce(lambda x,y: x+y, times1, 0) / len(times1) t2 = reduce(lambda x,y: x+y, times2, 0) / len(times2) print "t1=%.4f (%.4f .. %.4f) t2=%.4f (%.4f .. %.4f)" % \ (t1, times1[0], times1[-1], t2, times2[0], times2[-1])
def compare_fetch(full_name, which_rev=None): # d1 and d2 are: # ( HEAD revision, branch name, TAGS { name : revision }, [ LogEntry ] ) d1 = viewvc.fetch_log(full_name, which_rev) d2 = fetch_log2(full_name, which_rev) print 'comparing external tools vs a parser module:' compare_data(d1, d2) if tparse: d2 = fetch_log3(full_name, which_rev) print 'comparing external tools vs the tparse module:' compare_data(d1, d2)