Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9881223c authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo-4.14-20170816' of...

Merge tag 'perf-core-for-mingo-4.14-20170816' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf core improvements and fixes:

New features:

- Support exporting Intel PT data to sqlite3 with python perf scripts,
  this is in addition to the postgresql support that was already there (Adrian Hunter)

Infrastructure changes:

- Handle perf tool builds with less features in perf shell tests, such
  as those with NO_LIBDWARF=1 or even without 'perf probe' (Arnaldo Carvalho de Melo)

- Replace '|&' with '2>&1 |' to work with more shells in the just
  introduced perf test shell harness (Kim Phillips)

Architecture related fixes:

- Fix endianness problem when loading parameters in the BPF prologue
  generated by perf, noticed using 'perf test BPF' in s390x systems (Wang Nan, Thomas Richter)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 927d2c21 35435cd0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -104,9 +104,9 @@ system, asynchronous, interrupt, transaction abort, trace begin, trace end, and
in transaction, respectively.

While it is possible to create scripts to analyze the data, an alternative
approach is available to export the data to a postgresql database.  Refer to
script export-to-postgresql.py for more details, and to script
call-graph-from-postgresql.py for an example of using the database.
approach is available to export the data to a sqlite or postgresql database.
Refer to script export-to-sqlite.py or export-to-postgresql.py for more details,
and to script call-graph-from-sql.py for an example of using the database.

There is also script intel-pt-events.py which provides an example of how to
unpack the raw data for power events and PTWRITE.
+8 −0
Original line number Diff line number Diff line
#!/bin/bash

#
# export perf data to a sqlite3 database. Can cover
# perf ip samples (excluding the tracepoints). No special
# record requirements, just record what you want to export.
#
perf record $@
+29 −0
Original line number Diff line number Diff line
#!/bin/bash
# description: export perf data to a sqlite3 database
# args: [database name] [columns] [calls]
n_args=0
for i in "$@"
do
    if expr match "$i" "-" > /dev/null ; then
	break
    fi
    n_args=$(( $n_args + 1 ))
done
if [ "$n_args" -gt 3 ] ; then
    echo "usage: export-to-sqlite-report [database name] [columns] [calls]"
    exit
fi
if [ "$n_args" -gt 2 ] ; then
    dbname=$1
    columns=$2
    calls=$3
    shift 3
elif [ "$n_args" -gt 1 ] ; then
    dbname=$1
    columns=$2
    shift 2
elif [ "$n_args" -gt 0 ] ; then
    dbname=$1
    shift
fi
perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/export-to-sqlite.py $dbname $columns $calls
+41 −29
Original line number Diff line number Diff line
#!/usr/bin/python2
# call-graph-from-postgresql.py: create call-graph from postgresql database
# Copyright (c) 2014, Intel Corporation.
# call-graph-from-sql.py: create call-graph from sql database
# Copyright (c) 2014-2017, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
@@ -11,18 +11,19 @@
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.

# To use this script you will need to have exported data using the
# export-to-postgresql.py script.  Refer to that script for details.
# To use this script you will need to have exported data using either the
# export-to-sqlite.py or the export-to-postgresql.py script.  Refer to those
# scripts for details.
#
# Following on from the example in the export-to-postgresql.py script, a
# Following on from the example in the export scripts, a
# call-graph can be displayed for the pt_example database like this:
#
#	python tools/perf/scripts/python/call-graph-from-postgresql.py pt_example
#	python tools/perf/scripts/python/call-graph-from-sql.py pt_example
#
# Note this script supports connecting to remote databases by setting hostname,
# port, username, password, and dbname e.g.
# Note that for PostgreSQL, this script supports connecting to remote databases
# by setting hostname, port, username, password, and dbname e.g.
#
#	python tools/perf/scripts/python/call-graph-from-postgresql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example"
#	python tools/perf/scripts/python/call-graph-from-sql.py "hostname=myhost username=myuser password=mypassword dbname=pt_example"
#
# The result is a GUI window with a tree representing a context-sensitive
# call-graph.  Expanding a couple of levels of the tree and adjusting column
@@ -291,13 +292,24 @@ class MainWindow(QMainWindow):

if __name__ == '__main__':
	if (len(sys.argv) < 2):
		print >> sys.stderr, "Usage is: call-graph-from-postgresql.py <database name>"
		print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>"
		raise Exception("Too few arguments")

	dbname = sys.argv[1]

	is_sqlite3 = False
	try:
		f = open(dbname)
		if f.read(15) == "SQLite format 3":
			is_sqlite3 = True
		f.close()
	except:
		pass

	if is_sqlite3:
		db = QSqlDatabase.addDatabase('QSQLITE')
	else:
		db = QSqlDatabase.addDatabase('QPSQL')

		opts = dbname.split()
		for opt in opts:
			if '=' in opt:
+3 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ import datetime
#	pt_example=# \q
#
# An example of using the database is provided by the script
# call-graph-from-postgresql.py.  Refer to that script for details.
# call-graph-from-sql.py.  Refer to that script for details.
#
# Tables:
#
@@ -340,7 +340,8 @@ if branches:
		'to_sym_offset	bigint,'
		'to_ip		bigint,'
		'branch_type	integer,'
		'in_tx		boolean)')
		'in_tx		boolean,'
		'call_path_id	bigint)')
else:
	do_query(query, 'CREATE TABLE samples ('
		'id		bigint		NOT NULL,'
Loading