#!/usr/bin/python #$Id$ import sys, os, string, time, re, string, math def getSample(tok): child = os.popen('ps axo %cpu,command | grep "' + tok + '" | grep -v grep | grep -v python') while 1: line = child.readline() if not line: break # Acts as a Perl chomp line = re.sub(r"[\r\n]+$", "", line) lineRec = string.split(line, ' ') print lineRec[1] err = child.close() if __name__ == "__main__": while 1: getSample(sys.argv[1]) time.sleep(int(sys.argv[2]))