# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is standalone Firefox Windows performance test. # # The Initial Developer of the Original Code is Google Inc. # Portions created by the Initial Developer are Copyright (C) 2006 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Annie Sullivan (original author) # Ben Hearsum (OS independence) # Alice Nodelman # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** """A generic means of running an URL based browser test follows the following steps - creates a profile - tests the profile - gets metrics for the current test environment - loads the url - collects info on any counters while test runs - waits for a 'dump' from the browser """ __author__ = 'annie.sullivan@gmail.com (Annie Sullivan)' import platform import os import re import shutil import time import sys import subprocess import utils import ffprocess import ffsetup if platform.system() == "Linux": from cmanager_linux import * platform_type = 'unix_' elif platform.system() in ("Windows", "Microsoft"): from cmanager_win32 import * platform_type = 'win_' elif platform.system() == "Darwin": from cmanager_mac import * platform_type = 'unix_' def run_test(process_name, command_line): if (process_name): process = subprocess.Popen(command_line, stdout=subprocess.PIPE, universal_newlines=True, shell=True, bufsize=0, env=os.environ) handle = process.stdout #give process a chance to open ffprocess.Sleep() counters = [ 'Private Bytes' ]; #set up the counters for this test cm = CounterManager(process_name, counters) cm.startMonitor() counter_results = {} for counter in counters: counter_results[counter] = [] total_time = 0; timeout = 1100; resolution = 1; while total_time < timeout: # Sleep for [resolution] seconds time.sleep(resolution) total_time += resolution # Get the output from all the possible counters for count_type in counters: val = cm.getCounterValue(count_type) if (val): counter_results[count_type].append(val) print val #stop the counter manager since this test is complete cm.stopMonitor() #kill any remaining firefox processes if (process_name): ffprocess.Sleep() ffprocess.TerminateAllProcesses(process_name) print "*** DONE *** "; print counter_results; if __name__=='__main__': run_test("iexplore", "") # run_test("firefox", "c:\\\\users\\\\schrep\\\\firefoxes\\\\ff20012\\\\firefox.exe -P ff20012") run_test("firefox", "c:\\\\users\\\\schrep\\\\firefoxes\\\\ff3b4\\\\firefox.exe -P ff3b4")