To allow specific oprofile binaries to be used
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lambda r: r.count, thresholds['symbol'])
self.reference_dict = dict([ (r.name, r) for r in self.references ])
lambda r: r.count, thresholds['symbol'])
self.reference_dict = dict([ (r.name, r) for r in self.references ])
- def annotate(self, report, conn):
+ def annotate(self, report, conn, options):
fn_re = re.compile('^[0-9a-f]+\s+<[^>]+>: /\* (\S+) total:')
symbols = [ s for s in self.references if s.name != '(no symbols)' ]
fn_re = re.compile('^[0-9a-f]+\s+<[^>]+>: /\* (\S+) total:')
symbols = [ s for s in self.references if s.name != '(no symbols)' ]
- command = ['opannotate', '--source', '--assembly',
+ command = [options.opannotate, '--source', '--assembly',
'--include-file=' + self.name,
'-i', ','.join([ s.name for s in symbols ])]
'--include-file=' + self.name,
'-i', ','.join([ s.name for s in symbols ])]
for binary in self.binaries:
binary.threshold(thresholds)
for binary in self.binaries:
binary.threshold(thresholds)
- def annotate(self, conn):
+ def annotate(self, conn, options):
for binary in self.binaries:
for binary in self.binaries:
- binary.annotate(self, conn)
+ binary.annotate(self, conn, options)
@staticmethod
def parse(doc, hostname):
@staticmethod
def parse(doc, hostname):
return report
@staticmethod
return report
@staticmethod
- def extract(connection):
- fd = connection.execute(['opreport', '--xml'])
+ def extract(connection, options):
+ fd = connection.execute([options.opreport, '--xml'])
doc = parseXML(fd)
if connection.host:
doc = parseXML(fd)
if connection.host:
parser.add_option('-o', '--output-dir', dest = 'outdir',
help = 'create output in directory DIR', metavar = 'DIR',
default = default_outdir)
parser.add_option('-o', '--output-dir', dest = 'outdir',
help = 'create output in directory DIR', metavar = 'DIR',
default = default_outdir)
+ parser.add_option('--opreport', dest = 'opreport', default = 'opreport',
+ help = 'use opreport binary at PATH', metavar = 'PATH')
+ parser.add_option('--opannotate', dest = 'opannotate',
+ default = 'opannotate',
+ help = 'use opannotate binary at PATH', metavar = 'PATH')
(options, args) = parser.parse_args()
(options, args) = parser.parse_args()
conn = Connection(options.host)
conn = Connection(options.host)
- report = Report.extract(conn)
+ report = Report.extract(conn, options)
report.threshold(default_thresholds)
report.threshold(default_thresholds)
+ report.annotate(conn, options)
write_report(report, resourcedir, options.outdir)
write_report(report, resourcedir, options.outdir)