a396c1d6eeb298a1a17b4b20ebc0cafe07dab49a max Mon Aug 9 03:57:39 2021 -0700 small addition to browserrace tool, no redmine diff --git src/utils/browserRace src/utils/browserRace index 85dad70..f0602c2 100755 --- src/utils/browserRace +++ src/utils/browserRace @@ -42,30 +42,31 @@ lines = os.popen(cmd).read().splitlines() # please do not suggest using subprocess in code review. Thx. rows = [l.split("\t") for l in lines] logging.info("Got %d public sessions" % len(rows)) return rows def timeWeb(url): t = time.process_time() requests.get(url) elapsed_time = time.process_time() - t return elapsed_time def timeSessions(sessions, server1, server2, outFname): sum1 = 0 sum2 = 0 ofh = open(outFname, "w") + ofh.write("#user\tsession\ttime1\ttime2\n") for user, session in sessions: logging.info("Session: %s %s" % (user, session)) path = "cgi-bin/hgTracks?hgS_doOtherUser=submit&hgS_otherUserName=%s&hgS_otherUserSessionName=%s"% (user, session) url1 = "http://%s.gi.ucsc.edu/%s" % (server1, path) url2 = "http://%s.gi.ucsc.edu/%s" % (server2, path) # the second call always has an advantage due to warm caches so flip the order if random.random() < 0.5: time1 = timeWeb(url1) time2 = timeWeb(url2) else: time2 = timeWeb(url2) time1 = timeWeb(url1) sum1 += time1 sum2 += time2