add new commands to oprofile_command script
authorwoojin <woojin2.jung@samsung.com>
Sat, 13 Apr 2013 02:58:27 +0000 (11:58 +0900)
committerwoojin <woojin2.jung@samsung.com>
Sat, 13 Apr 2013 02:58:27 +0000 (11:58 +0900)
Change-Id: I6815be64f33d185e93c6a6b13f00162f48f09986

oprofile.manifest [new file with mode: 0644]
packaging/oprofile.manifest [new file with mode: 0644]
packaging/oprofile.spec
utils/oprofile_command

diff --git a/oprofile.manifest b/oprofile.manifest
new file mode 100644 (file)
index 0000000..86dbb26
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_" />
+    </request>
+</manifest>
diff --git a/packaging/oprofile.manifest b/packaging/oprofile.manifest
new file mode 100644 (file)
index 0000000..86dbb26
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_" />
+    </request>
+</manifest>
index c7c8a39..cfa5629 100644 (file)
@@ -24,11 +24,11 @@ rm -rf %{buildroot}
 %make_install  
 
 %files  
-%{_bindir}/opcontrol  
-%{_bindir}/oprofile_command
-%{_bindir}/oprofiled  
-%{_bindir}/ophelp  
-%{_bindir}/op-check-perfevents
+%attr(755,root,root) %{_bindir}/opcontrol  
+%attr(755,root,root) %{_bindir}/oprofile_command
+%attr(755,root,root) %{_bindir}/oprofiled  
+%attr(755,root,root) %{_bindir}/ophelp  
+%attr(755,root,root) %{_bindir}/op-check-perfevents
 
 %ifarch %{arm}  
 %{_datadir}/oprofile/arm/armv7  
index 74587d3..b67e020 100755 (executable)
@@ -1,8 +1,18 @@
 #!/bin/bash
 
+KILL=/usr/bin/killall
 OPCONTROL=/usr/bin/opcontrol
 OPHELP=/usr/bin/ophelp
 
+is_app_executable()
+{
+       if [[ $1 =~ ^((/opt/apps)|(/opt/usr/apps))/[a-zA-Z0-9]{10}/bin/[a-zA-Z0-9_\\-]{1,}(\.exe)?$ ]] ; then 
+               return 1
+       else
+               return 0
+       fi
+}
+
 op_init()
 {
        $OPCONTROL --init
@@ -132,11 +142,35 @@ disable_watchdog()
        echo 0 > /proc/sys/kernel/nmi_watchdog
 }
 
+ls_app()
+{
+       is_app_executable $APPPATH
+       if [[ "$?" -ne 1 ]] ; then
+               echo "Invalid application executable path!"
+               exit 1
+       fi
+       ls $APPPATH
+}
 
+kill_app()
+{
+       is_app_executable $APPPATH
+       if [[ "$?" -ne 1 ]] ; then
+               echo "Invalid application executable path!"
+               exit 1
+       fi
+       $KILL $APPPATH
+}
 
 echo $@
 #echo $@ >> /home/developer/oprofile_history
 
+if [[ `id -u` != "0" ]] ; then
+       echo "You must be root to run this script!"
+#      echo "You are not root!" >> /home/developer/oprofile_history
+       exit 1
+fi
+
 if [[ -n $1 ]]; then
        case "$1" in
                init)
@@ -166,6 +200,9 @@ if [[ -n $1 ]]; then
                list)
                        op_list
                        ;;
+               status)
+                       op_status
+                       ;;
                save)
                        if [[ -n $2 ]]; then
                                SAVENAME=$2
@@ -197,6 +234,24 @@ if [[ -n $1 ]]; then
                watchdogoff)
                        disable_watchdog
                        ;;
+               lsapp)
+                       if [[ -n $2 ]]; then
+                               APPPATH=$2
+                       else
+                               echo "Application executable path is not given!"
+                               exit 1
+                       fi
+                       ls_app
+                       ;;
+               killapp)
+                       if [[ -n $2 ]]; then
+                               APPPATH=$2
+                       else
+                               echo "Application executable path is not given!"
+                               exit 1
+                       fi
+                       kill_app
+                       ;;
                *)
                        echo "Unknown option!" >&2
                        exit 1