pmctest.py (231699) | pmctest.py (240101) |
---|---|
1#!/usr/bin/env python 2# Copyright (c) 2012, Neville-Neil Consulting 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: 8# --- 17 unchanged lines hidden (view full) --- 26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31# 32# Author: George V. Neville-Neil 33# | 1#!/usr/bin/env python 2# Copyright (c) 2012, Neville-Neil Consulting 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: 8# --- 17 unchanged lines hidden (view full) --- 26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31# 32# Author: George V. Neville-Neil 33# |
34# $FreeBSD: head/tools/test/hwpmc/pmctest.py 231699 2012-02-14 18:57:10Z gnn $ | 34# $FreeBSD: head/tools/test/hwpmc/pmctest.py 240101 2012-09-04 20:14:37Z gnn $ |
35 36# Description: A program to run a simple program against every available 37# pmc counter present in a system. 38# 39# To use: 40# 41# pmctest.py -p ls > /dev/null 42# --- 19 unchanged lines hidden (view full) --- 62 parser = OptionParser() 63 parser.add_option("-p", "--program", dest="program", 64 help="program to execute") 65 parser.add_option("-w", "--wait", action="store_true", dest="wait", 66 default=True, help="wait after each execution") 67 68 (options, args) = parser.parse_args() 69 | 35 36# Description: A program to run a simple program against every available 37# pmc counter present in a system. 38# 39# To use: 40# 41# pmctest.py -p ls > /dev/null 42# --- 19 unchanged lines hidden (view full) --- 62 parser = OptionParser() 63 parser.add_option("-p", "--program", dest="program", 64 help="program to execute") 65 parser.add_option("-w", "--wait", action="store_true", dest="wait", 66 default=True, help="wait after each execution") 67 68 (options, args) = parser.parse_args() 69 |
70 if (options.program == None): 71 print "specify program, such as ls, with -p/--program" 72 sys.exit() 73 |
|
70 p = subprocess.Popen(["pmccontrol", "-L"], stdout=PIPE) 71 counters = p.communicate()[0] 72 73 if len(counters) <= 0: 74 print "no counters found" 75 sys.exit() 76 77 for counter in counters.split(): --- 17 unchanged lines hidden --- | 74 p = subprocess.Popen(["pmccontrol", "-L"], stdout=PIPE) 75 counters = p.communicate()[0] 76 77 if len(counters) <= 0: 78 print "no counters found" 79 sys.exit() 80 81 for counter in counters.split(): --- 17 unchanged lines hidden --- |