From d4877027c87379aea30b9a27858fffd9b01f527a Mon Sep 17 00:00:00 2001 From: "anodelman%mozilla.com" Date: Thu, 14 Jan 2010 19:04:23 +0000 Subject: [PATCH] bug 474478 (set up talos on winmo) fix for cmanager to use ffprocess as a class p=jmaher a=anodelman git-svn-id: svn://10.0.0.236/trunk@259394 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/testing/performance/talos/cmanager_linux.py | 11 +++++------ mozilla/testing/performance/talos/cmanager_mac.py | 7 +++---- mozilla/testing/performance/talos/cmanager_win32.py | 3 ++- mozilla/testing/performance/talos/ttest.py | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mozilla/testing/performance/talos/cmanager_linux.py b/mozilla/testing/performance/talos/cmanager_linux.py index 6d10e5b617e..fef281db6aa 100644 --- a/mozilla/testing/performance/talos/cmanager_linux.py +++ b/mozilla/testing/performance/talos/cmanager_linux.py @@ -45,8 +45,6 @@ import os import time import threading -import ffprocess - def GetPrivateBytes(pids): """Calculate the amount of private, writeable memory allocated to a process. This code was adapted from 'pmap.c', part of the procps project. @@ -113,7 +111,7 @@ def GetXRes(pids): print "Unexpected error:", sys.exc_info() raise try: - float(data) + data = float(data) XRes += data except: print "Invalid data, not a float" @@ -138,7 +136,7 @@ class CounterManager(threading.Thread): pollInterval = .25 - def __init__(self, process, counters=None, childProcess="mozilla-runtime"): + def __init__(self, ffprocess, process, counters=None, childProcess="mozilla-runtime"): """Args: counters: A list of counters to monitor. Any counters whose name does not match a key in 'counterDict' will be ignored. @@ -150,6 +148,7 @@ class CounterManager(threading.Thread): self.runThread = False self.primaryPid = -1 self.pidList = [] + self.ffprocess = ffprocess self._loadCounters() self.registerCounters(counters) @@ -211,7 +210,7 @@ class CounterManager(threading.Thread): """Updates the list of PIDs we're interested in""" try: self.pidList = [self.primaryPid] - childPids = ffprocess.GetPidsByName(self.childProcess) + childPids = self.ffprocess.GetPidsByName(self.childProcess) for pid in childPids: os.stat('/proc/%s' % pid) self.pidList.append(pid) @@ -225,7 +224,7 @@ class CounterManager(threading.Thread): # TODO: make this function less ugly try: # the last process is the useful one - self.primaryPid = ffprocess.GetPidsByName(self.process)[-1] + self.primaryPid = self.ffprocess.GetPidsByName(self.process)[-1] os.stat('/proc/%s' % self.primaryPid) self.runThread = True self.start() diff --git a/mozilla/testing/performance/talos/cmanager_mac.py b/mozilla/testing/performance/talos/cmanager_mac.py index e9c815afd8d..3304177b012 100644 --- a/mozilla/testing/performance/talos/cmanager_mac.py +++ b/mozilla/testing/performance/talos/cmanager_mac.py @@ -46,8 +46,6 @@ import time import threading import subprocess -import ffprocess - def GetProcessData(pid): """Runs a ps on the process identified by pid and returns the output line as a list (pid, vsz, rss) @@ -97,7 +95,7 @@ class CounterManager(threading.Thread): pollInterval = .25 - def __init__(self, process, counters=None): + def __init__(self, ffprocess, process, counters=None): """Args: counters: A list of counters to monitor. Any counters whose name does not match a key in 'counterDict' will be ignored. @@ -107,6 +105,7 @@ class CounterManager(threading.Thread): self.process = process self.runThread = False self.pid = -1 + self.ffprocess = ffprocess self._loadCounters() self.registerCounters(counters) @@ -171,7 +170,7 @@ class CounterManager(threading.Thread): # TODO: make this function less ugly try: # the last process is the useful one - self.pid = ffprocess.GetPidsByName(self.process)[-1] + self.pid = self.ffprocess.GetPidsByName(self.process)[-1] self.runThread = True self.start() except: diff --git a/mozilla/testing/performance/talos/cmanager_win32.py b/mozilla/testing/performance/talos/cmanager_win32.py index aeba10d2fae..16f5dd8d587 100644 --- a/mozilla/testing/performance/talos/cmanager_win32.py +++ b/mozilla/testing/performance/talos/cmanager_win32.py @@ -42,8 +42,9 @@ import win32pdhutil class CounterManager: - def __init__(self, process, counters=None, childProcess="mozilla-runtime"): + def __init__(self, ffprocess, process, counters=None, childProcess="mozilla-runtime"): self.process = process + self.ffprocess = ffprocess self.childProcess = childProcess self.registeredCounters = {} self.registerCounters(counters) diff --git a/mozilla/testing/performance/talos/ttest.py b/mozilla/testing/performance/talos/ttest.py index ab56254f0c6..dc6c5c5379c 100644 --- a/mozilla/testing/performance/talos/ttest.py +++ b/mozilla/testing/performance/talos/ttest.py @@ -248,7 +248,7 @@ class TTest(object): time.sleep(browser_config['browser_wait']) #set up the counters for this test if counters: - cm = self.cmanager.CounterManager(browser_config['process'], counters) + cm = self.cmanager.CounterManager(self._ffprocess, browser_config['process'], counters) cm.startMonitor() counter_results = {} for counter in counters: