#!/bin/sh # # OProfile User Interface # Copyright (C) 2007 Nokia Corporation. All rights reserved. # # Author: Robert Bradford # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA # # This script converts the Oprofile archive contents from # the measurement architecture to the current architecture. # # Usage: oparchconv dir=$1/var/lib/oprofile if [ ! -d $1 ]; then echo "ERROR: '$1' is not a directory" exit 1 fi if [ ! -d $dir ]; then echo "ERROR: '$dir' is not a directory" exit 1 fi if [ -e $dir/.converted ]; then echo "'$dir' is already converted, ignoring..." exit 0 fi if [ -z "$(which opimport)" ]; then echo "ERROR: 'opimport' tool (included into Oprofile source package) is missing" exit 1 fi fail=0 find $dir/samples/ -type f | while read i; do echo "$i" opimport -a $dir/abi -o "$i.new" "$i" if [ $? = 0 ]; then mv "$i.new" "$i" else echo "ERROR: opimport for '$i' failed" rm -f "$i.new" fail=1 fi done if [ "$fail" = "1" ]; then echo "ERROR: conversion failed!" exit 1 fi touch $dir/.converted echo "DONE: data in '$dir' converted to current architecture!" exit 0