%files
%{_bindir}/opcontrol
+%{_bindir}/oprofile_command
%{_bindir}/oprofiled
%{_bindir}/ophelp
%{_bindir}/op-check-perfevents
%{_datadir}/oprofile/arm/armv7-common
%{_datadir}/oprofile/arm/armv7-scorpion
%{_datadir}/oprofile/arm/armv7-scorpionmp
+%{_datadir}/oprofile/arm/mpcore
%exclude %{_datadir}/oprofile/arm/armv6
-%exclude %{_datadir}/oprofile/arm/mpcore
%exclude %{_datadir}/oprofile/arm/xscale1
%exclude %{_datadir}/oprofile/arm/xscale2
%else
%endif
%ifarch %{ix86}
-%{_datadir}/oprofile/i386
+%{_datadir}/oprofile/i386/arch_perfmon
+%{_datadir}/oprofile/i386/atom
+%{_datadir}/oprofile/i386/core
+%{_datadir}/oprofile/i386/core_2
+%{_datadir}/oprofile/i386/core_i7
+%{_datadir}/oprofile/i386/ivybridge
+%{_datadir}/oprofile/i386/nehalem
+%{_datadir}/oprofile/i386/p6_mobile
+%{_datadir}/oprofile/i386/sandybridge
+%{_datadir}/oprofile/i386/westmere
+%exclude %{_datadir}/oprofile/i386/athlon
+%exclude %{_datadir}/oprofile/i386/p4
+%exclude %{_datadir}/oprofile/i386/p4-ht
+%exclude %{_datadir}/oprofile/i386/pii
+%exclude %{_datadir}/oprofile/i386/piii
+%exclude %{_datadir}/oprofile/i386/ppro
%else
%exclude %{_datadir}/oprofile/i386
%endif
LIBS=@POPT_LIBS@ @LIBERTY_LIBS@
bin_PROGRAMS = ophelp op-check-perfevents
-dist_bin_SCRIPTS = opcontrol
+dist_bin_SCRIPTS = opcontrol oprofile_command
op_check_perfevents_SOURCES = op_perf_events_checker.c
op_check_perfevents_CPPFLAGS = ${AM_CFLAGS} @PERF_EVENT_FLAGS@
AM_CFLAGS = @OP_CFLAGS@
AM_LDFLAGS = @OP_LDFLAGS@
-dist_bin_SCRIPTS = opcontrol
+dist_bin_SCRIPTS = opcontrol oprofile_command
op_check_perfevents_SOURCES = op_perf_events_checker.c
op_check_perfevents_CPPFLAGS = ${AM_CFLAGS} @PERF_EVENT_FLAGS@
ophelp_SOURCES = ophelp.c
--- /dev/null
+#!/bin/bash
+
+OPCONTROL=/usr/bin/opcontrol
+OPHELP=/usr/bin/ophelp
+
+op_init()
+{
+ $OPCONTROL --init
+}
+
+op_startdaemon()
+{
+ $OPCONTROL --start-daemon
+}
+
+op_start()
+{
+ $OPCONTROL --start && echo start_ok
+}
+
+op_dump()
+{
+ $OPCONTROL --dump
+}
+
+op_stop()
+{
+ $OPCONTROL --stop
+}
+
+op_shutdown()
+{
+ $OPCONTROL --shutdown
+}
+
+op_reset()
+{
+ $OPCONTROL --reset
+}
+
+op_deinit()
+{
+ $OPCONTROL --deinit
+}
+
+op_list()
+{
+ $OPCONTROL --list-events 2> /dev/null
+}
+
+op_status()
+{
+ $OPCONTROL --status 2> /dev/null | grep ^Event
+}
+
+op_save()
+{
+ $OPCONTROL --save=$SAVENAME
+}
+
+op_help()
+{
+ $OPHELP -e $EVENTQUERY
+}
+
+op_setup()
+{
+# validate $SETUPOPTION
+ while [[ "$#" -ne 0 ]]
+ do
+ arg=`printf %s $1 | awk -F= '{printf $1}'`
+ val=`printf %s $1 | awk -F= '{printf $2}'`
+ shift
+
+ if [[ -z "$val" ]] ; then
+ echo "Invalid setup option!"
+ exit 1
+ fi
+
+ case "$arg" in
+ separate)
+ SEPARATE=$val
+ ;;
+ vmlinux)
+ VMLINUX=$val
+ ;;
+ image)
+ IMAGEPATH=$val
+ ;;
+ callgraph)
+ CALLGRAPH=$val
+ ;;
+ event)
+ EVENT=$val
+ ;;
+ *)
+ echo "Unknown setup option!"
+ exit 1
+ ;;
+ esac
+ done
+
+ if [[ -n "$SEPARATE" ]] ; then
+ SETUPARGS="$SETUPARGS --separate=$SEPARATE"
+ fi
+
+ if [[ -n "$VMLINUX" ]] ; then
+ if [[ "$VMLINUX" == "no" ]] ; then
+ SETUPARGS="$SETUPARGS --no-vmlinux"
+ else
+ SETUPARGS="$SETUPARGS --vmlinux=$VMLINUX"
+ fi
+ fi
+
+ if [[ -n "$IMAGEPATH" ]] ; then
+ SETUPARGS="$SETUPARGS --image=$IMAGEPATH"
+ fi
+
+ if [[ -n "$CALLGRAPH" ]] ; then
+ SETUPARGS="$SETUPARGS --callgraph=$CALLGRAPH"
+ fi
+
+ if [[ -n "$EVENT" ]] ; then
+ SETUPARGS="$SETUPARGS --event=$EVENT"
+ fi
+
+ $OPCONTROL --setup $SETUPARGS
+}
+
+disable_watchdog()
+{
+ echo 0 > /proc/sys/kernel/nmi_watchdog
+}
+
+
+
+echo $@
+#echo $@ >> /home/developer/oprofile_history
+
+if [[ -n $1 ]]; then
+ case "$1" in
+ init)
+ op_init
+ ;;
+ startdaemon)
+ op_startdaemon
+ ;;
+ start)
+ op_start
+ ;;
+ dump)
+ op_dump
+ ;;
+ stop)
+ op_stop
+ ;;
+ shutdown)
+ op_shutdown
+ ;;
+ reset)
+ op_reset
+ ;;
+ deinit)
+ op_deinit
+ ;;
+ list)
+ op_list
+ ;;
+ save)
+ if [[ -n $2 ]]; then
+ SAVENAME=$2
+ else
+ echo "Save name is not given!"
+ exit 1
+ fi
+ op_save
+ ;;
+ ophelp)
+ if [[ -n $2 ]]; then
+ EVENTQUERY=$2
+ else
+ echo "Event query is not given!"
+ exit 1
+ fi
+ op_help
+ ;;
+ setup)
+ if [[ $# -ge 2 ]]; then
+ shift
+ SETUPOPTION=$@
+ else
+ echo "Setup option is not given!"
+ exit 1
+ fi
+ op_setup $@
+ ;;
+ watchdogoff)
+ disable_watchdog
+ ;;
+ *)
+ echo "Unknown option!" >&2
+ exit 1
+ ;;
+ esac
+fi
+
+