From: Namhyung Kim <namhyung@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@infradead.org, linux-kernel@vger.kernel.org,
peterz@infradead.org, eranian@google.com, jolsa@redhat.com,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 5/9] perf, tools: Add perf download to download event files v2
Date: Wed, 14 May 2014 14:17:55 +0900 [thread overview]
Message-ID: <87zjilkkfw.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1399935074-25167-6-git-send-email-andi@firstfloor.org> (Andi Kleen's message of "Mon, 12 May 2014 15:51:10 -0700")
On Mon, 12 May 2014 15:51:10 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Add a downloader to automatically download the right
> files from a download site.
>
> This is implemented as a script calling wget, similar to
> perf archive. The perf driver automatically calls the right
> binary. The downloader is extensible, but currently only
> implements an Intel event download. It would be straightforward
> to add other sites too for other vendors.
>
> The downloaded event files are put into ~/.cache/pmu-events, where the
> builtin event parser in util/* can find them automatically.
>
> Cc: Use ~/.cache
???
[SNIP]
> @@ -0,0 +1,52 @@
> +#!/bin/bash
> +# download event files for current cpu for perf
> +
> +WGETOPT=${WGETOPT:---no-verbose --timeout 5}
Could you please extend this script to support curl also? It seems the
wget is not installed by default on my system.
> +
> +set -e
> +
> +if [ "$1" == "" ] ; then
> + S=$(awk '
> +/^vendor/ { V=$3 }
> +/^model/ && $2 == ":" { M=$3 }
> +/^cpu family/ { F = $4 }
Inconsistency in using whitespace..
Thanks,
Namhyung
> +END { printf("%s-%s-%X", V, F, M) }' /proc/cpuinfo)
> +else
> + S="$1"
> +fi
> +V=$(echo $S | ( IFS=- read v f m ; echo $v) )
> +
> +CACHEDIR=${XDG_CACHE_HOME:-~/.cache}
> +[ ! -d $CACHEDIR/pmu-events ] && mkdir -p $CACHEDIR/pmu-events
> +cd $CACHEDIR/pmu-events
> +
> +case "$V" in
> +GenuineIntel)
> + echo "Downloading models file"
> + URLBASE=${URLBASE:-https://download.01.org/perfmon}
> + MAPFILE=${MAPFILE:-mapfile.csv}
> + echo "Downloading readme.txt"
> + wget -N $WGETOPT $URLBASE/readme.txt
> + ;;
> +
> +# Add more CPU vendors here
> +
> +*)
> + echo "Unsupported CPU vendor $V"
> + exit 1
> + ;;
> +esac
> +
> +wget -N $WGETOPT $URLBASE/$MAPFILE
> +
> +echo "Downloading events file"
> +awk -v urlbase=$URLBASE -v cpu="$S" -F, \
> + '$1 == cpu && $4 == "core" { print urlbase $3; exit 0 }' \
> + $MAPFILE > url$$
> +if [ -s url$$ ] ; then
> + wget $WGETOPT -q -i url$$ -O $S-core.json
> +else
> + echo "CPU $S not found"
> +fi
> +rm -f url$$
> +
next prev parent reply other threads:[~2014-05-14 5:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 22:51 perf: Add support for full Intel event lists v3 Andi Kleen
2014-05-12 22:51 ` [PATCH 1/9] perf, tools: Add jsmn `jasmine' JSON parser Andi Kleen
2014-05-14 3:25 ` Namhyung Kim
2014-05-14 5:00 ` Andi Kleen
2014-05-12 22:51 ` [PATCH 2/9] perf, tools: Add support for text descriptions of events and alias add Andi Kleen
2014-05-12 22:51 ` [PATCH 3/9] perf, tools: Add support for reading JSON event files Andi Kleen
2014-05-14 5:10 ` Namhyung Kim
2014-05-15 20:18 ` Andi Kleen
2014-05-12 22:51 ` [PATCH 4/9] perf, tools: Automatically look for event file name for cpu v2 Andi Kleen
2014-05-12 22:51 ` [PATCH 5/9] perf, tools: Add perf download to download event files v2 Andi Kleen
2014-05-14 5:17 ` Namhyung Kim [this message]
2014-05-15 20:10 ` Andi Kleen
2014-05-12 22:51 ` [PATCH 6/9] perf, tools: Allow events with dot Andi Kleen
2014-05-12 22:51 ` [PATCH 7/9] perf, tools: Query terminal width and use in perf list Andi Kleen
2014-05-12 22:51 ` [PATCH 8/9] perf, tools, test: Add test case for alias and JSON parsing Andi Kleen
2014-05-14 5:27 ` Namhyung Kim
2014-05-12 22:51 ` [PATCH 9/9] perf, tools, record: Always allow to overide default period v2 Andi Kleen
2014-05-14 5:50 ` Namhyung Kim
2014-05-15 20:51 ` Andi Kleen
2014-05-15 16:09 ` perf: Add support for full Intel event lists v3 Hagen Paul Pfeifer
2014-05-15 19:12 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjilkkfw.fsf@sejong.aot.lge.com \
--to=namhyung@gmail.com \
--cc=acme@infradead.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome