Messages in this thread | | | From | Namhyung Kim <> | Subject | Re: [PATCH 5/9] perf, tools: Add perf download to download event files v2 | Date | Wed, 14 May 2014 14:17:55 +0900 |
| |
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$$ > +
| |