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
This commit is contained in:
anodelman%mozilla.com
2010-01-14 19:04:23 +00:00
parent 04b3a5b4e0
commit d4877027c8
4 changed files with 11 additions and 12 deletions

View File

@@ -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()

View File

@@ -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:

View File

@@ -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)

View File

@@ -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: