1564b9527SAdrian Hunter#!/bin/bash
2564b9527SAdrian Hunter# description: export perf data to a sqlite3 database
3564b9527SAdrian Hunter# args: [database name] [columns] [calls]
4564b9527SAdrian Huntern_args=0
5564b9527SAdrian Hunterfor i in "$@"
6564b9527SAdrian Hunterdo
7564b9527SAdrian Hunter    if expr match "$i" "-" > /dev/null ; then
8564b9527SAdrian Hunter	break
9564b9527SAdrian Hunter    fi
10564b9527SAdrian Hunter    n_args=$(( $n_args + 1 ))
11564b9527SAdrian Hunterdone
12564b9527SAdrian Hunterif [ "$n_args" -gt 3 ] ; then
13564b9527SAdrian Hunter    echo "usage: export-to-sqlite-report [database name] [columns] [calls]"
14564b9527SAdrian Hunter    exit
15564b9527SAdrian Hunterfi
16564b9527SAdrian Hunterif [ "$n_args" -gt 2 ] ; then
17564b9527SAdrian Hunter    dbname=$1
18564b9527SAdrian Hunter    columns=$2
19564b9527SAdrian Hunter    calls=$3
20564b9527SAdrian Hunter    shift 3
21564b9527SAdrian Hunterelif [ "$n_args" -gt 1 ] ; then
22564b9527SAdrian Hunter    dbname=$1
23564b9527SAdrian Hunter    columns=$2
24564b9527SAdrian Hunter    shift 2
25564b9527SAdrian Hunterelif [ "$n_args" -gt 0 ] ; then
26564b9527SAdrian Hunter    dbname=$1
27564b9527SAdrian Hunter    shift
28564b9527SAdrian Hunterfi
29564b9527SAdrian Hunterperf script $@ -s "$PERF_EXEC_PATH"/scripts/python/export-to-sqlite.py $dbname $columns $calls
30