kernel_optimize_test/tools/perf
Adrian Hunter 64adadb3f9 perf scripts python: export-to-sqlite.py: Export IPC information
Export cycle and instruction counts on samples and calls tables.

Committer testing:

First runs some workload collecting intel_pt with the 'cyc' ter just for
userspace:

  [root@quaco adrian.hunter]# perf record -o simple-retpoline.perf.data -e intel_pt/cyc/u ./simple-retpoline
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.035 MB simple-retpoline.perf.data ]
  [root@quaco adrian.hunter]#

Then use the export-to-sqlite.py script to see if the changes in this
cset don't make it to break and if the changes in the db schema are the
ones expected:

  [root@quaco adrian.hunter]# perf script -i simple-retpoline.perf.data --itrace=be -s ~acme/libexec/perf-core/scripts/python/export-to-sqlite.py simple-retpoline.db branches calls
  2019-05-31 11:50:46.942710 Creating database ...
  2019-05-31 11:50:46.949663 Writing records...
  2019-05-31 11:50:47.224033 Adding indexes
  2019-05-31 11:50:47.231599 Done
  [root@quaco adrian.hunter]#

Now lets use the db:

  [root@quaco adrian.hunter]# sqlite3 simple-retpoline.db
  SQLite version 3.26.0 2018-12-01 12:34:55
  Enter ".help" for usage hints.
  sqlite> .schema samples
  CREATE TABLE samples (id integer NOT NULL PRIMARY KEY,evsel_id bigint,machine_id bigint,thread_id bigint,comm_id bigint,dso_id bigint,symbol_id bigint,sym_offset bigint,ip bigint,time bigint,cpuinteger,to_dso_id bigint,to_symbol_id bigint,to_sym_offset bigint,to_ip bigint,branch_type integer,in_tx boolean,call_path_id bigint,insn_count bigint,cyc_count bigint);
  sqlite>

Cool, the 'insn_count' and 'cyc_count' are there, now lets see if we can
use them in a query:

  sqlite> select insn_count,cyc_count from samples where cyc_count > 1500 and insn_count < 10;
  6|1507
  sqlite> select insn_count,cyc_count from samples where cyc_count > 1500;
  118|2210
  140|1516
  3783|1861
  132|1521
  6|1507
  sqlite>

Seems to work :-)

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190520113728.14389-17-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-06-05 09:47:57 -03:00
..
arch Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-06-02 11:08:12 -07:00
bench perf bench numa: Add define for RUSAGE_THREAD if not present 2019-05-02 16:00:20 -04:00
Documentation perf db-export: Add brief documentation 2019-06-05 09:47:57 -03:00
examples/bpf perf trace: Beautify 'fspick' arguments 2019-05-28 18:37:42 -03:00
include/bpf
jvmti
pmu-events perf vendor events arm64: Add Cortex-A57 and Cortex-A72 events 2019-05-15 16:36:49 -03:00
python
scripts perf scripts python: export-to-sqlite.py: Export IPC information 2019-06-05 09:47:57 -03:00
tests perf tests: Add map_groups__merge_in test 2019-05-28 18:37:44 -03:00
trace perf trace: Beautify 'sync_file_range' arguments 2019-05-28 18:37:43 -03:00
ui perf annotate TUI browser: Do not use member from variable within its own initialization 2019-05-28 18:37:44 -03:00
util perf db-export: Export IPC information 2019-06-05 09:47:57 -03:00
.gitignore
Build
builtin-annotate.c perf annotate: Remove hist__account_cycles() from callback 2019-05-15 16:36:46 -03:00
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c
builtin-config.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c
builtin-help.c
builtin-inject.c perf inject: Enable COMPRESSED record decompression 2019-05-15 16:36:49 -03:00
builtin-kallsyms.c
builtin-kmem.c perf tools, tools lib traceevent: Rename "pevent" member of struct tep_event to "tep" 2019-04-01 15:18:10 -03:00
builtin-kvm.c
builtin-list.c perf list: Output tool events 2019-04-01 14:49:25 -03:00
builtin-lock.c
builtin-mem.c
builtin-probe.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
builtin-record.c perf parse-regs: Split parse_regs 2019-05-15 16:36:49 -03:00
builtin-report.c perf report: Implement perf.data record decompression 2019-05-15 16:36:49 -03:00
builtin-sched.c
builtin-script.c perf script: Add output of IPC ratio 2019-06-05 09:47:56 -03:00
builtin-stat.c perf stat: Support 'percore' event qualifier 2019-05-16 14:17:24 -03:00
builtin-timechart.c
builtin-top.c perf top: Lower message level for failure on synthesizing events for pre-existing BPF programs 2019-05-28 18:37:45 -03:00
builtin-trace.c perf trace: Beautify 'sync_file_range' arguments 2019-05-28 18:37:43 -03:00
builtin-version.c tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines 2019-04-01 15:18:10 -03:00
builtin.h
check-headers.sh
command-list.txt
CREDITS
design.txt
Makefile
Makefile.config treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile.perf Linux 5.2-rc3 2019-06-03 11:56:35 +02:00
MANIFEST
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh perf-with-kcore.sh: Always allow fix_buildid_cache_permissions 2019-05-28 18:37:42 -03:00
perf.c
perf.h perf record: Implement COMPRESSED event record and its attributes 2019-05-15 16:36:49 -03:00