lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 14 May 2014 14:17:55 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	acme@...radead.org, linux-kernel@...r.kernel.org,
	peterz@...radead.org, eranian@...gle.com, jolsa@...hat.com,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 5/9] perf, tools: Add perf download to download event files v2

On Mon, 12 May 2014 15:51:10 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.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$$
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ